‎2019 Nov 26 9:01 PM
Hi,
I have a ITAB1, am looping this and want to capture the entry in another ITAB2.
Say I have 4 entries in ITAB1, after loop ITAB2 has 4 entries.
LOOP AT ITAB1 INTO wa_itab1.
READ TABLE ITAB2 TRANSPORTING NO FIELDS WITH KEY exidv = wa_itab1-exidv.
IF sy-subrc EQ 0.
CLEAR:wa_itab1.
CONTINUE.
ELSE.
PERFORM print_et TABLES gt_hukey USING …….
ENDIF.
APPEND wa_itab1 TO itab2.
CLEAR wa_itab1.
So here the ITAB2 gets refreshed all the time.
What could be reason, is there anything wrong with READ...TRANSPORTING... because of which this is happening?
‎2019 Nov 26 9:54 PM
if in your table ITAB1 the field exidv for the 4 rows is diferent, when you read the ITAB2 the sy-subrc is 4 then never continue, and append all rows in the second table.
there are some questions, are the structure of itab1 and itab2 equal?; do you wants move all rows to itab2?; rhat is the condition for move the rows?.
‎2019 Nov 26 10:14 PM
Why don't you just use the debugger to analyze the issue? (set breakpoint at the line you want and run the program)
‎2019 Nov 27 5:05 AM
‎2019 Nov 27 5:06 AM
can you let us know your complete code, i would like to know how the entries from ITAB1 is moved to ITAB2. Without the full code it will be difficult to suggest a solution in your case.
‎2019 Nov 27 9:48 AM
Hi,
use a watchpoint on itab2 to see at which point it gets refreshed or simply search for refresh itab2 in your code 🙂 ....
my guess would be in perform print_et.. it could be refreshing all data after doing the print function.