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

MODIFY INTERNAL TABLE

Former Member
0 Likes
365

pls help its is very argent

is it possible modify internal table with 2nd internal table

ihave two iternal table andboth have same structure .

1st itab has one partner1 .

2nd itab has 3 records (partner2 name)for the same partner1 now i want to merge both the itabs.

so i want all partner2 for a particular partner1 in itab1

for a one partner1 there can be more than one partner2

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
337

Yes it is.

LOOP AT it1.

READ TABLE it2 WITH KEY ? = it1-?.

IF sy-subrc = 0.

MOVE it2-? TO it1-?.

MODIFY it1.

ENDIF.

ENDLOOP.

or

SORT : itab1 by common column,

itab2 by common column.

LOOP AT ITAB1.

READ TABLE ITAB2 WITH common column = ITAB1-KEY binary search.

If sy-subrc eq 0.

Move itab2-addres to itab1-address.

append itab1.

clear itab1.

endif.

2 REPLIES 2
Read only

Former Member
0 Likes
338

Yes it is.

LOOP AT it1.

READ TABLE it2 WITH KEY ? = it1-?.

IF sy-subrc = 0.

MOVE it2-? TO it1-?.

MODIFY it1.

ENDIF.

ENDLOOP.

or

SORT : itab1 by common column,

itab2 by common column.

LOOP AT ITAB1.

READ TABLE ITAB2 WITH common column = ITAB1-KEY binary search.

If sy-subrc eq 0.

Move itab2-addres to itab1-address.

append itab1.

clear itab1.

endif.

Read only

Former Member
0 Likes
337

You can use

APPEND LINES OF itab1 TO itab2.