03-01-2007 11:45 AM
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
03-01-2007 11:52 AM
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.
03-01-2007 11:52 AM
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.
03-02-2007 5:02 AM
hi chandra,
i have tried with your hint,
FTAB is populating with only ITAB, first internal table,
any other way,please,
regards,
kc
03-01-2007 11:52 AM
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.
03-01-2007 11:53 AM
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
03-01-2007 11:56 AM
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.