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: 

Need help on logic on getting the total number of ordered quantity of a sales document.

walkerist
Participant
0 Kudos

I'm seeking for help that the value of l_total_qty will be cleared and populated accordingly every after loop.

If the delivery document 1 selected: the l_total qty is 1(check RFMNG)

when the delivery document 2 is selected, I want the l_total_qty to be cleared and its value is equal to 5 then it will loop again and the l_total_qty should be 10.00 after that, it will go into loop again, selecting the delivery document 1007981881. The l_total _qty should be cleared again and its value should come from RFMNG which is 1.000.

DATA(l_total_qty) = 0.
LOOP AT it_vbfa ASSIGNING FIELD-SYMBOL(<fs_vbfa>).
DATA(l_order_qty) = VALUE #( it_vbap[ vbeln = <fs_vbfa>-vbelv
posnr = <fs_vbfa>-posnv
]-reqqty_bu ).
l_total_qty = l_total_qty + l_order_qty.
******Some logic here using the l_total_qty.
ENDLOOP.

Content of it_vbfa:

VBELV POSNV VBELN POSNN RFMNG

1007981879 000010 3008888328 000010 1.000

1007981880 000010 3008888329 000010 5.000

1007981880 000011 3008888329 000020 5.000

1007981881 000010 3008888330 000010 1.000

0 REPLIES 0