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: 

ALV - Summing the Quantity field problem.

deepa22_
Explorer
0 Kudos

I have got an requirement to create an contract related sales order report in ALV.

In which i want to sum the quantity order(KWMENG- from SO) for each line item of contract and subtract it from

target quantity(ZMENG - contract). i am facing problem in summing the quantity order. I have given do sum in field catalog.

if each sales order has single delivery there is no issues in summing the quantity, but if each sales order has multiple delivery, then the quantity is displaying as many as delivery. for example. if contract (20000004) has 4 line items , and 4th line item has the target quantity is 70 and but sales order's quantity as per deliveries, 3072000014- 40th line item-2 times the quantity is printed 20.00 but only one 20.00 should be calculated,3072000013, has single delivery so no prbm,3072000012 has three deliveries so 20.00 is three times it should be calculated only one times, so summing is issue here ...

balanced quantity = target quantity - (sum of quantity orders)

BQ = 70 -(20+30+20) = 0.. This should be the case.

but BQ = 70 - ( 20+20+30+20+20+20) . This is happening..

Please refer my screenshot.contract-sales-report.png

How i can overcome it.. please help, its urgent..Thanks in advance.

8 REPLIES 8

former_member1716
Active Contributor
0 Kudos

deepa22_,

Instead of trying out this logic through field catalog, why don't you try to achieve the logic through program. Any specific reason?

Sandra_Rossi
Active Contributor

Screenshot provided by the OP:

deepa22_
Explorer
0 Kudos

Can you please tell me the logic how to use it? @satish

deepa22_
Explorer
0 Kudos

yes sandra, that is my report output.

Sandra_Rossi
Active Contributor
0 Kudos

Deepa Priya I think that Satish Kumar Balasubramanian just tells you to do the sum in ABAP custom code (total = total + quantity) instead of telling ALV to do the sum by itself.

DoanManhQuynh
Active Contributor
0 Kudos

Maybe i dont have SD background so i dont get why you want to sum like that. if you have 1 SO with multiple deliveries, isnt it true that total quantity of each delivery must be equal to target quantity of SO? you may solve it by sum using abap code instead of ALV standard function (i think ALV cant do it), but still might be the logic you use to determine quantity of delivery is not correct.

deepa22_
Explorer
0 Kudos

can any one please help me in this logic,

please refer my screenshot attached.

remaining target qty = target qty - quantity ==> for so line item 10 - 1st line,

for the next line, if the so line item is same then it should do, remaining target qty = remaining target qty - quantity, for the next it is repeating.. How i could achieve this in coding..please help.

cso.png

maulik
Contributor
0 Kudos

Try changing the sort and group from Contract - SO - QTY to SO - Contracy - QTY.