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

doubt in Internal table

Former Member
0 Likes
473

Hi All.

I have 2 internal table with different structure.it_ekpo and it_ekko

it_ekpo: this internal table gets records from EKPO

and it_ekko: this interanl table gets records from EKKO

i need merge both internal table value in singel interanl table as It_merge.

please help me

Thanks.

Jay

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
456

Hi,

Please try this.


LOOP AT IT_EKPO.
  READ TABLE IT_EKKO WITH KEY EBELN = IT_EKPO-EBELN  BINARY SEARCH.
  
  IF SY-SUBRC = 0.
    MOVE-CORRESPONDING IT_EKKO TO IT_MERGE.
  ENDIF.

  MOVE-CORRESPONDING IT_EKPO TO IT_MERGE.
  APPEND IT_MERGE.
ENDLOOP.

Regards,

Ferry Lianto

3 REPLIES 3
Read only

Former Member
0 Likes
456

Loop at IT_EKKO.

Loop at IT_EKPO where ebeln = it_ekko-vbeln.

clear it_merge.

move-corresponding it_ekko to it_merge.

move-corresponding it_ekpo to it_merge.

append it_merge.

endloop.

endloop.

Read only

Former Member
0 Likes
456

sort it_ekko by ebeln.

Loop at it_ekpo.

lt_merge-ebelp = it_ekpo-ebelp.

read table it_ekko with key ebeln = it_ekpo-ebeln

binary search.

lt_merge-ebeln = it_ekko-ebeln.

append lt_merge.

endloop.

Read only

ferry_lianto
Active Contributor
0 Likes
457

Hi,

Please try this.


LOOP AT IT_EKPO.
  READ TABLE IT_EKKO WITH KEY EBELN = IT_EKPO-EBELN  BINARY SEARCH.
  
  IF SY-SUBRC = 0.
    MOVE-CORRESPONDING IT_EKKO TO IT_MERGE.
  ENDIF.

  MOVE-CORRESPONDING IT_EKPO TO IT_MERGE.
  APPEND IT_MERGE.
ENDLOOP.

Regards,

Ferry Lianto