10-03-2008 10:11 AM
Hi,
I have a requirement to print average of netwr (net value) for similar matnr (materials) for a particular range of vbeln (Slaes order).
The problem i am having is how will i take the condition 'Similar Materials' and then get the average.
How should i go about this requirement?
Regards,
Darpana.
10-03-2008 10:18 AM
Hi,
suppose u have data in the internal table itab.
data: begin of itab occurs 0,
matnr type matnr,
netwr type netwr_g,
end of itab.
data: n type i,
sort itab by matnr.
loop at itab.
n = n + 1.
at end of matnr.
avg = sum / n.
*move this avg to another internal table.
n = 0.
endat.
endloop.
revrt back if any issues,
Regards,
Naveen
10-03-2008 10:17 AM
Hello
You will have to do average of all VBAP-NETWR for a given material in VBAP-MATNR... (Same material across different sales orders)
Thanks
Amol Lohade
10-03-2008 10:18 AM
Hi,
suppose u have data in the internal table itab.
data: begin of itab occurs 0,
matnr type matnr,
netwr type netwr_g,
end of itab.
data: n type i,
sort itab by matnr.
loop at itab.
n = n + 1.
at end of matnr.
avg = sum / n.
*move this avg to another internal table.
n = 0.
endat.
endloop.
revrt back if any issues,
Regards,
Naveen
10-03-2008 10:39 AM
Each sales order has different materials.
How will i separate each of the similar materials and then find average of net value from these similar materials?
10-03-2008 10:42 AM
hi,
provide me the test data how it looks in the internal table. Then i can answer ur question, as i didnt understand.
revrt back
regards,
Naveen
10-03-2008 10:44 AM
Collect material and net value from VBAP into an internal table. Then loop over said table and calculate the average net value by dividing the collected net value by the number of occurences of the material.
Basically, almost like the example above.
10-03-2008 12:41 PM
Hi
To get information according to similar materials, you must be maintaining some type of grouping like using field Material Type. You have to sort your internal table as per the material type and then if you are displaying the data in ALV then use SORTINFO to add sorting information according to the material type and add subtotal information for the NETWR field in Field catalog.
Regards
Vijai
10-03-2008 10:23 AM
Get the value into a particular internal table when the range of vbeln.get the matnr alone into a itaernal table ok.delete the adjacent duplicates form the internal table havibg matnr only.Then loop the internal table having matnr and then under that give another loop looping the table we have all the details.In the second loop check the matnr if matnr is same you can append to another new internal table and adding netwr.