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 logic for dividing the qunatity and appending it into internal table

Former Member
0 Kudos
97

Hi Guys,

I have a internal table with all transfer order details.

For example I have 3 Items in one delivery,each item contains 3 ordered quantities with some weight and volume.

Let's say 1st Item has 3 ordered quantities with total weight 150lbs and volume 75cft.

Now I need to calculate how much each ordered quantity has how much weight and volume.

After calculating I need to append each quantity, weight and volume to another Internal table.

My final internal table should look like

VBELN Qty Wt Vl

1144 1 50 25

1144 2 50 25

1144 3 50 25

Thanks,

Prasad.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
59

use the following code

loop at itab.
 collect itab into itab2. " itab2 just like itab1
endloop.

3 REPLIES 3

Former Member
0 Kudos
60

use the following code

loop at itab.
 collect itab into itab2. " itab2 just like itab1
endloop.

Former Member
0 Kudos
59

Hi,

You can do this with Control break commands.

sort itab by vbeln.

field-symbols: <fs_tab> like itab.

take three variable for qty, weight and volume

Loop at itab assigning <fs_tab>.

qty = qty + <fs_tab>-qty.

wt = wt + <fs_tab>-wt.

vl = vl + <fs_tab>-vl.

at end of vbeln.

wa = <fs_tab>.

wa-qty = qyt.

wa-wt = wt.

wa-vl = vl.

append wa to itab2.

endat.

Endloop.

Now you itab2 will have unique document number with total sum of quantity weight volume.

Regards,

Venkatesh

Former Member
0 Kudos
59

Thanks to all of you guys.

I am writing my own logic using do and enddo...