Skip to Content
0

Sorting in Mapping

Nov 28, 2017 at 11:09 AM

35

avatar image

Hi SDNites,

I have a mapping scenario in which values has to be summed up after sorting the records. Can you please guide how can this be done i.e. can it be achieved using message mapping without UDF or do I need to use UDF mandatorily?

Input,

VBELN POSNR MATNR QTY

123 10 MAT1 2

234 10 MAT1 4

123 20 MAT2 5

123 30 MAT1 3

123 10 MAT1 8

234 10 MAT1 3

234 20 MAT2 4

Output,

VBELN POSNR MATNR QTY

123 10 MAT1 10 (Value summed up)

123 20 MAT2 5

123 30 MAT1 3 (Same material but not summed as different position)

234 10 MAT1 7

234 20 MAT2 4

I have to produce the right vbeln, posnr, matnr against the summed up quantity. Can you please advise how can this be achieved.

Regards,

Abhi

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Ariel M. Bravo Ayala Nov 28, 2017 at 11:16 AM
0

Hello Abhishek,

For this kind of duties, one approach that has worked with me is using XSLT transformations. There is an specific command to sort the data and you could even summarise using xslt. It is clean and straight forward.

Have a look into the sort and sum commands

https://www.w3schools.com/xml/xsl_sort.asp

Regards,

Ariel

Share
10 |10000 characters needed characters left characters exceeded
Juan Vasquez Nov 28, 2017 at 10:12 PM
0

Hi Abhishek,

You can use message mapping

Sort Key element

element ----> removeContexts-- -> sort-- -> splitByValue[value change]

Other elements depend form key element

element_no_PK ---> removeContexts -----> sortByKey

Regards

Juan


Share
10 |10000 characters needed characters left characters exceeded