‎2007 Jun 06 7:08 AM
Hi Experts,
I have to internal tables viz l_vbap(fields matnr ,posnr,pstyv) and l_vbpa(posnr,parvw,adrnr).
i want to posnr from l_vbap and adrnr from l_vbpa to pull into other internal table.
can u please give me suggestion ..
its very urgent...Please help me,.,.....maximum points will be rewarded.
Thanks
Pavee.
‎2007 Jun 06 7:16 AM
hi,
if u want ot move to another internal table use.
sort i_vbap by posnr.
sort i_vbpa by posnr.
looop at i_vbap.
read table i_vbpa with key posnr = i_vbap-posnr binary search.
if sy-subrc = 0.
itab3-posnr = i_vbap-posnr.
itab3-adrnr = i_vbpa-adrnr.
endif.
endloop.
‎2007 Jun 06 7:12 AM
hi,
write the select statement using for all entries and join the two tables then u can fetch the posnr and adrnr..
‎2007 Jun 06 7:14 AM
Hi,
declare the final internal table i_final. Here Move the fields from
i_vbap and from i_vbpa using move-correponding or directly field.
for ex- i_final-posnr = i_vbap-posnr.
***do reward if usefull
Regards,
vijay
‎2007 Jun 06 7:14 AM
Hi,
Here yo u go...
Say new internal table is l_newitab.
Loop at l_vbap.
LOOP at l_vbpa where posnr = l_vbap-posnr.
CLEAR l_newitab.
l_newitab-posnr = l_vbap-posnr.
l_newitab-adrnr = l_vbpa-adrnr.
APPEND l_newitab.
ENDLOOP.
ENDLOOP.Reward points if helpful.
Regards,
Ram
null
‎2007 Jun 06 7:14 AM
Hi
Declare another internal table ITAB
Your internal tables will also have a common field VBELN in both VBAP and VBPA and sort them by VBELN and POSNR fields(please add that field into the both internal tables)
l_vbap(fields vbeln,matnr ,posnr,pstyv) and l_vbpa(vbeln, posnr,parvw,adrnr).
loop at i_vbap.
itab-vbeln = i_vbap-vbeln.
itab-posnr = i_vbap-posnr.
read table i_vbpa with key vbeln = i_vbap-vbeln.
if sy-subrc = 0.
itab-adrnr = i_vbpa-adrnr.
endif.
append itab.
clear itab.
endloop.
Now ITAB will have VBELN POSNR and ADRNR fields
use this for further purpose.
Reward points if useful
Regards
Anji
‎2007 Jun 06 7:15 AM
You can use inner join to get values from vbap and vbpa using a common key.
Or loop at i_vbap and then inside the loop read ur i_vbpa table with a common key.
and transfer whatever values u want into another itab.
‎2007 Jun 06 7:16 AM
hi,
if u want ot move to another internal table use.
sort i_vbap by posnr.
sort i_vbpa by posnr.
looop at i_vbap.
read table i_vbpa with key posnr = i_vbap-posnr binary search.
if sy-subrc = 0.
itab3-posnr = i_vbap-posnr.
itab3-adrnr = i_vbpa-adrnr.
endif.
endloop.
‎2007 Jun 06 7:52 AM
Hi sudha,
thank u very much for answer.
it working fine.....
i am closing the thread .
Thank u very much for ur all immediate answers.
regards
pavee
‎2007 Jun 06 7:18 AM
HI,
Always try to avoid writing nested loops, as u know it will affect the database performance drasticallyand use the combination of loop and read to fetch the data's.
regards
Sathish