Application Development 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: 

Populating Internal table

Former Member
0 Kudos

hi all,

I have four internal tables ITAB, KTAB, LTAB,FTAB

Fields in the first internal table ITAB

VBELN LIKE VBAK-VBELN

MATNR LIKE VBAP-MATNR

KWMENG LIKE VBAP-KWMENG

Fields in the second internal table KTAB

D_ VBELN LIKE LIPS-VBELN

LFIMG LIKE LIPS-LFIMG

Fields in the third internal table LTAB

S_ VBELN LIKE VBFA-VBELN

Fields in the final internal table FTAB

VBELN LIKE VBAK-VBELN

MATNR LIKE VBAP-MATNR

KWMENG LIKE VBAP-KWMENG

D_VBELN LIKE LIPS-VBELN

LFIMG LIKE LIPS-LFIMG

S_VBELN LIKE VBFA-VBELN

ITAB, KTAB, LTAB are populated with different select statements,

now, i want to move those values into FTAB,

please,give me a hint,

thanks & regards,

kc

1 ACCEPTED SOLUTION

Former Member
0 Kudos

It depends on your requirement.

If you need data from these tables based on conditions, etc, you have to loop at the first itab and then read the other tables.

Loop at itab.
  read table ktab with key d_vbeln = itab-vbeln binary search.
    if sy-subrc eq 0.
*--   populate ftab with corresponding fields. e.g
      ftab-lfimg = ktab-lfimg.
    endif.

   read table ltab with key d_vbeln = itab-vbeln binary search.
    if sy-subrc eq 0.
*--  populate ftab with corresponding fields. e.g
    endif.
  append ftab.
  clear ftab.
endloop.

remember to sort your tables since binary search is used.

5 REPLIES 5

Former Member
0 Kudos
loop at itab.
   move corresponding itab to ftab.

   read table ktab with key d_vbeln eq itab-vbeln
   if sy-subrc eq 0.
     move corresponding ktab to ftab.
   endif.

   read table ltab with key s_vbeln eq itab-vbeln
   if sy-subrc eq 0.
     move corresponding ltab to ftab.
   endif.

   append ftab.
   clear ftab.

endloop.

0 Kudos

hi chandra,

i have tried with your hint,

FTAB is populating with only ITAB, first internal table,

any other way,please,

regards,

kc

Former Member
0 Kudos

It depends on your requirement.

If you need data from these tables based on conditions, etc, you have to loop at the first itab and then read the other tables.

Loop at itab.
  read table ktab with key d_vbeln = itab-vbeln binary search.
    if sy-subrc eq 0.
*--   populate ftab with corresponding fields. e.g
      ftab-lfimg = ktab-lfimg.
    endif.

   read table ltab with key d_vbeln = itab-vbeln binary search.
    if sy-subrc eq 0.
*--  populate ftab with corresponding fields. e.g
    endif.
  append ftab.
  clear ftab.
endloop.

remember to sort your tables since binary search is used.

former_member188827
Active Contributor
0 Kudos

create workareas of types of internal tables.

then use

move wa1-vbeln to wa4-vbeln.(wa1 type itab,wa4 type ftab)

move wa2-lfimg to wa4-lfimg.(wa2 type ktab)

.

.

.

append wa4 to ftab.

please reward points if it helps...

Message was edited by:

abapuser

Former Member
0 Kudos

welcome to SDN.

Remember that

VBAK-VBELN is Sales order

LIKP-VBELN IS DELIVERY NUMBER .

<b> lips-vgbel = vbap-vbeln

and lips-vgpos = vbap-posnr</b>

once u have this relation in place u can do teh

read in the loop and place the fields .

dont do the read without the relationship .

understand the key relation ship between sales order and delivery number and then move .

regards,

vijay.