Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

While using READ TABLE for internal table, the next record gets refresh

Former Member
0 Likes
1,420

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?

5 REPLIES 5
Read only

mlizcano1
Explorer
0 Likes
1,160

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?.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,160

Why don't you just use the debugger to analyze the issue? (set breakpoint at the line you want and run the program)

Read only

DoanManhQuynh
Active Contributor
0 Likes
1,160

maybe the mystery is in ELSE which we cant see.

Read only

former_member1716
Active Contributor
0 Likes
1,160

akash suraj,

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.

Read only

dev_parbutteea
Active Contributor
0 Likes
1,160

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.