Skip to Content

Sorting in Mapping

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 28, 2017 at 11:16 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 28, 2017 at 10:12 PM

    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

    Add comment
    10|10000 characters needed characters exceeded