Application Development and Automation 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: 
Read only

Adding values in query for like materials.

Former Member
0 Likes
513

Greetings Gurus,

I am very new to ABAB. I recently made a query attached to an infoset, that lists the amount received from a purchase order and compares the amount that was ordered (overdelivery allowed). With this I added a custom field and and in the Extras/Code tab I added (for "Record Processing")

IF MSEG-BPMNG > EKPO-MENGE.

ZCUSTOMF = 'OVERDELIVERED'.

ELSE.

CLEAR CUSTOMFIELD.

ENDIF.

This compares the amount received vs the amount ordered and gives a new field value if overdelivery occured. However it occurred that there may be multiple batches of the same material when received. When this happens the query displays multiple lines (same material document number) with each amount and does not add the value of the different batches of the same material. Is there any additional code that could be added that 'When the same material document number and same material' appear more than once to add the quantity received together and view it on one line? Any kind of help (especially with ABAP explanations) at all is greatly appreciated.

Thank You

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
449

Hi,

You have to Loop at the itab which you are processing in the same code tab with looping at itab at the material document you are processing at that moment. then sum up the Qty and Amount at the end of the loop and then check the amounts and then update the custom field for that PO or material document.

As this code will be repeated for all the items of the document every time when you loop for that specific document just check whether the custom field is empty or not . Process the loop if empty only. As if i t is not empty then it is understood that thsi item has been processed earlier.

Regards, Shakeel.

1 REPLY 1
Read only

Former Member
0 Likes
450

Hi,

You have to Loop at the itab which you are processing in the same code tab with looping at itab at the material document you are processing at that moment. then sum up the Qty and Amount at the end of the loop and then check the amounts and then update the custom field for that PO or material document.

As this code will be repeated for all the items of the document every time when you loop for that specific document just check whether the custom field is empty or not . Process the loop if empty only. As if i t is not empty then it is understood that thsi item has been processed earlier.

Regards, Shakeel.