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

Regarding Query

Former Member
0 Likes
694

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

1 ACCEPTED SOLUTION
Read only

rodrigo_paisante3
Active Contributor
0 Likes
667

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

5 REPLIES 5
Read only

Former Member
0 Likes
667

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

Read only

rodrigo_paisante3
Active Contributor
0 Likes
668

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

Read only

0 Likes
667

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

Read only

0 Likes
667

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.

Read only

0 Likes
667

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