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

Query :Internal tables

Former Member
0 Likes
748

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
731

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.

8 REPLIES 8
Read only

Former Member
0 Likes
731

hi,

write the select statement using for all entries and join the two tables then u can fetch the posnr and adrnr..

Read only

Former Member
0 Likes
731

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

Read only

former_member214288
Participant
0 Likes
731

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

Read only

Former Member
0 Likes
731

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

Read only

Azeemquadri
Contributor
0 Likes
731

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.

Read only

Former Member
0 Likes
732

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.

Read only

0 Likes
731

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

Read only

Former Member
0 Likes
731

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