cancel
Showing results for 
Search instead for 
Did you mean: 

To Add Quantity in mapping in case if Line items have same Material and same sales order

Former Member
0 Kudos

Hi all

We have an existing interface file to Idoc (DESDAV).

At present though multiple line items has same Material and same Sales Order quantity is received in each segment.

New requirement is to add Quantity.

Example:

Input:

Order1      Material1     2(Quantity)

Order1      Material1     5(Quantity)

Order4      Material3     1

Order5      Material3     10

Output:

Order1     Material1     7(Quantity)

Order4      Material3     1

Order5      Material3     10

Idoc:

E1EDL24

     KDMAT (Material)

     LFIMG  (Quantity)

     E1EDL41

          BSTNR (sales order)

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi Anitha!

In case of data groupping by some key with aggregation you can map message to itself in first step with following transformation:

In second step you can map result message with same structure and groupped data to IDoc.

Regards, Evgeniy.

Former Member
0 Kudos

Hi All

Thanks for your response.

I tried all the ways as suggested by you people.

I can able to Sum the quantities with same material and same Order in line item and suppress item incase of same material and same Order.

Closing the Thread.

Answers (4)

Answers (4)

sugata_bagchi2
Active Contributor
0 Kudos

Hi Anitha,

For order you can use this but for the material and qty you can use the UDF-

assumed your structure is like below -

apu_das2
Active Contributor
0 Kudos

Hi Anitha,

Exactly same what Ryan did with a slight modification and prominent order and material split -

Thanks,

Apu

PriyankaAnagani
Active Contributor
0 Kudos

Refer this, it has the similar requirement.

http://scn.sap.com/thread/3935663

former_member186851
Active Contributor
0 Kudos

Hello Anith,

Try the below logic and UDF.

Select Context as root node.

Former Member
0 Kudos

Thank you Raghuram I will try this.

But our requirement is to add Quantity for those line items which has same Material and same Order.

If any one differs we should not add.

former_member186851
Active Contributor
0 Kudos

Hello Anitha,

Try enhancing it one more level of adding condtion for material as wel if its not working let us know.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Anitha,

I was able to accomplish the adding using the following graphical mapping and input/output structure with one small UDF.  Here are the screenshots of the structure, the mapping and then the code for the UDF.

addValues UDF Code -


int num = 0;

for(int i = 0; i < var1.length; i++) {

  num += Integer.parseInt(var1[i]);

}

result.addValue(num);

Regards,

Ryan Crosby