‎2007 Jan 29 11:41 AM
Dear Friends,
I have an internal table A like below show, i am looping the interal table
A and inside i am reading the internal table B to assign the field value STLKN
based on PLNKN and modifying the internal table A. So for all (PLNKN) 5 values
(STLKN) 1 is assiged. this is ok
now my requirement is for the second 5 (PLNKN)value in internal table B , the value 5(STLKN) should assign by appending new records.
when you see the internal table B contains two 5 PLNKN and
two 7 value in PLNKN and contains different STLKN values.
when i loop internal table A and modify only the first value is assigned.
now remaining value to be appended for the second value 5 PLNKN
if not understandable below i given example.
WARPL ABNUM PLNKN STLKN Internal table A
211--
0
211--
0
211--
0
211--
0
211--
0
211--
1
211--
1
211--
1
211--
1
211--
1
211--
6
211--
6
211--
7
-
example-here need to append----
211--
5 like this
211--
5
211--
5
211--
5
211--
5
-
211--
1
PLLNR----
PLNKN -
STLKN Internal table B
106900--
0
106900--
1
106900--
5
106900--
6
106900--
7
106900--
1
can anyone give the code for this. keep in mind the internal table B contains
more than 2 or 3 values repeated in PLNKN.
Thnaks in advance
karthik
‎2007 Jan 29 12:19 PM
Hi Karthik,
In the second case when you are modifying internal table A use the where clause as
MODIFY itab a some fields tranporting ur fields where stkln = Internal Table B-stkln and plnkn = Internal Table B-PLNKN.
If i have understood ur requiremen correctly .
Please reward if useful.
‎2007 Jan 29 7:29 PM
Hi Karthik,
Try this code below.
i_a_temp[] = i_tab_a.
Loop at i_a_temp into wa_a_temp.
read table i_tab_b into wa_tab_b with key plnkn = wa_a_temp-plnkn.
if sy-subrc eq 0.
i_b_temp[] = i_tab_b[].
delete i_b_temp where plnkn ne wa_a_temp-plnkn.
describe table i_b_temp line v_lines.
do v_lines times.
read i_b_temp into wa_b_temp with key plnkn = wa_a_temp-plnkn
stlkn = wa_a_temp-stlkn.
if sy-subrc NE 0.
wa_a_temp-stlkn = wa_b_temp-stlkn.
append wa_a_temp to i_tab_a.
endif.
enddo.
endif.
endloop.
Kindly give rewards if helpful!
mariposa