Overwrite function not working in DSO.
I have a DSO1 with Key field as MATNR and Inspection lot no. , as per the requirement I have calculated Average lot quantity per Material using a routine. The Avg. lot quantity is populating in every material as shown in the below image. The only field which makes the record unique is Inspection lot number (PRUEFLOS), Average Does not depend on year also.
Now I am populating this data in DSO2 with key field as MATNR as i want single MATNR corresponding to an single Average lot Quantity.But my output is coming as shown below:
What is happening is Avg. lot Qty is getting summed up in the result.
Please tell me what i should do so that the Avg lot Qty doesnt add up in the DSO and just shows me one correct value as shown in DSO1.
Karthik Vasudevan replied
I have created the same scenario in my sandbox system and it works as Jyothi has mentioned. Though you have material and the other field in your first DSO, when you look up the data based on material, it will sum up all the line items for that material.
There is no much way except writing a routine as you did earlier in the first DSO.
Rather than calculating average which you have already done in the first DSO, you could just delete the adjacent duplicates based on material.
Deleting adjacent duplicates is simple and no much code required for it. Try the below code in your start routine
SORT SOURCE_PACKAGE BY MATNR.
DELETE ADJACENT DUPLICATES FROM SOURCE_PACKAGE COMPARING MATNR.
Try this and let us know if it worked.