Application Development 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: 

vbap and vbpe

Former Member
0 Kudos

Hi can anybody have any idea how i can implement this

suppose i have same order which has different item category let's say x1 and x2.

x1 can can be follow by several x2 item caterory i need to

1. Match the Unit of measure for the x2(xvbap-pstyv) and its respective

x1(xvbap-pstyv)

-


a) if they are same then Compare the confirmed qty(XVBEP-LMENG) field and

-


if x2 (xvbap-pstyv) is greater than Z011(xvbap-pstyv) then

-


replace the x2’s (xvbap-pstyv) confirmed qty by x1 in XVBEP .

how do i compare the unit pf measure i am thinking maybe i need to loop in xvbap then in xvbep then how do i link the item category by it's posnr may be is it correct?

4 REPLIES 4

naimesh_patel
Active Contributor
0 Kudos

Yes, you can do like:

Loop at xvbap with PSTVY = 'X1'.

  read table xvbep with posnr = xvbap-posnr.
*... do your processing
endloop.

Regards,

Naimesh Patel

Former Member
0 Kudos

need to to 2 loop can't do a read since in table xvbep there can be many entry with same posnr

can i do a read in xvbep??

what i an unsure is how do i Match the Unit of measure for the x2(xvbap-pstyv) and its respective x1(xvbap-pstyv)

what i plan to do is

loop at xvbap where pstyv eq 'x1'

// keep the posnr in a variable var_posnr

--loop at xvbep

--//but how to match the unit of measure(xvbap-mein) of x2 with x1

Grateful for any suggesstion which might give me a hint

0 Kudos

This is bit tricky....

1. Copy your XVBAP to XVBAP1.

2. Try to implement this code....

Loop at xvbap1 where pstyv = 'X2'.
  loop at xvbap where pstyv = 'X1' 
                    and  MEINS = XVBAP1-MEINS.
* SUM XVBAP''s LMENG for the <b>XVBAP1-POSNR</b>.
   loop at xvbep where posnr = xvbap1-posnr.
     l_x2_sum =  l_x2_sum + xvbep-lmeng.
   endloop.
* SUM XVBAP''s LMENG for the <b>XVBAP-POSNR.</b>
   loop at xvbep where posnr = xvbap1-posnr.
     l_x2_sum =  l_x2_sum + xvbep-lmeng.
   endloop.
*  now compare as per your requirement....
  endloop.
endloop.

Regards,

Naimesh Patel

Former Member
0 Kudos

problem solve thx a lot