‎2007 Jul 13 12:22 PM
hi all,
this is my code .....i have four internal table and want all fields of that four table into final internal table.....
SELECT * FROM LFA1
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
WHERE KTOKK IN S_VGROUP.
SELECT * FROM LFM1
INTO CORRESPONDING FIELDS OF TABLE IT_LFM1
FOR ALL ENTRIES IN IT_FINAL
WHERE LIFNR = IT_FINAL-LIFNR.
SELECT * FROM LFBW
INTO CORRESPONDING FIELDS OF TABLE IT_LFBW
FOR ALL ENTRIES IN IT_FINAL
WHERE BUKRS IN S_VGROUP
AND LIFNR = IT_FINAL-LIFNR.
SELECT * FROM J_1IMOVEND
INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND
FOR ALL ENTRIES IN IT_FINAL
WHERE LIFNR = IT_FINAL-LIFNR.
how to collect data from remaining three table into IT_FINAL table based on vendor no as i hv written in querry.....
Regards,
Imran
‎2007 Jul 13 12:36 PM
Hi,
try to loop table it_final and read all the others tables after append into the new table.
SELECT * FROM LFA1
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
WHERE KTOKK IN S_VGROUP.
<b>if not it_final[] is initial.</b>
SELECT * FROM LFM1
INTO CORRESPONDING FIELDS OF TABLE IT_LFM1
FOR ALL ENTRIES IN IT_FINAL
WHERE LIFNR = IT_FINAL-LIFNR.
SELECT * FROM LFBW
INTO CORRESPONDING FIELDS OF TABLE IT_LFBW
FOR ALL ENTRIES IN IT_FINAL
WHERE BUKRS IN S_VGROUP
AND LIFNR = IT_FINAL-LIFNR.
SELECT * FROM J_1IMOVEND
INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND
FOR ALL ENTRIES IN IT_FINAL
WHERE LIFNR = IT_FINAL-LIFNR.
<b>loop at it_final.
read table IT_LFM1 with key LIFNR = IT_FINAL-LIFNR binary search.
it_final2-field = it_lfm1-field.
read table IT_LFBW ....
it_final2-field = ....
append it_final2.
endloop.
</b>
Regards.
RP
‎2007 Jul 13 12:33 PM
loop at it_final.
read table IT_LFM1 with key vendor no = it_final-vendor no.
if sy-subrc = 0.
it_final-fld1 = it_lfm1-fld1.
...
...
modify it_final.
endif.
like this remaining two tables.
endloop.
Reward Points If Helpful
‎2007 Jul 13 12:36 PM
Hi,
try to loop table it_final and read all the others tables after append into the new table.
SELECT * FROM LFA1
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
WHERE KTOKK IN S_VGROUP.
<b>if not it_final[] is initial.</b>
SELECT * FROM LFM1
INTO CORRESPONDING FIELDS OF TABLE IT_LFM1
FOR ALL ENTRIES IN IT_FINAL
WHERE LIFNR = IT_FINAL-LIFNR.
SELECT * FROM LFBW
INTO CORRESPONDING FIELDS OF TABLE IT_LFBW
FOR ALL ENTRIES IN IT_FINAL
WHERE BUKRS IN S_VGROUP
AND LIFNR = IT_FINAL-LIFNR.
SELECT * FROM J_1IMOVEND
INTO CORRESPONDING FIELDS OF TABLE IT_J_1IMOVEND
FOR ALL ENTRIES IN IT_FINAL
WHERE LIFNR = IT_FINAL-LIFNR.
<b>loop at it_final.
read table IT_LFM1 with key LIFNR = IT_FINAL-LIFNR binary search.
it_final2-field = it_lfm1-field.
read table IT_LFBW ....
it_final2-field = ....
append it_final2.
endloop.
</b>
Regards.
RP
‎2007 Jul 13 1:36 PM
hi all,
thank for the reply.........
but i want all the fields not some fields...into final table.......there 55 fields in LFM1
i want all that fields in IT_FINAL....
similarly form other two tables.......
regards,
Imran
‎2007 Jul 13 1:53 PM
You can do it for all the fields i did not get your problem
loop at it_final.
read table IT_LFM1 with key vendor no = it_final-vendor no.
if sy-subrc = 0.
it_final-fld1 = it_lfm1-fld1.
it_final-fld2 = it_lfm1-fld2.
it_final-fld3 = it_lfm1-fld3.
like this for all the fields...
modify it_final.
endif.
like this remaining two tables.
endloop.
‎2007 Jul 13 2:23 PM
Hi again, you need to do it each field, like the expert said below, because the structure of the tables arent the same.
Regards.
RP