cancel
Showing results for 
Search instead for 
Did you mean: 

Need To sort the data using Message mapping

Former Member
0 Kudos

Hi All,

How can i sort the below structure using message mapping.

I have a structure similar to the one given below:

<Recordset>

   <Item1>

     <Forcast1>

     <Forcast2>

     <Forcast3>

     <Forcast4>

    <Item1>

    <Item2>

     <Forcast1>

     <Forcast2>

     <Forcast3>

     <Forcast4>

    <Item2>

    <Item3>

     <Forcast1>

     <Forcast2>

     <Forcast3>

     <Forcast4>

    <Item3>

    <Item4>

     <Forcast1>

     <Forcast2>

     <Forcast3>

     <Forcast4>

    <Item4>

    <Item5>

     <Forcast1>

     <Forcast2>

     <Forcast3>

     <Forcast4>

    <Item5>

</Recordset>

I need to sort these Items on basis of Forcast2 values using Message Mapping. For ex Forcast2 have these values(10,6,12,1,6) respectively. Then output should be:

<Recordset>

<Item4></Item4>

<Item2></Item2>

<Item5></Item5>

<Item1></Item1>

<Item3></Item3>

<Recordset>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Try this:

Forcast2** -> sort (in ascending order) -> Item (target node)

Forcast2** -> sort (in ascending order) -> SplitByValue(EachValue)-> Forcast2

For rest of the fields:

Forcast2** ->

              --------> SortByKey (ascending) --SplitByValue(EachValue)-> Forcast1

Forcast1**

and so on....

** -> Change field's context and set it to Recordset level

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

As per my understanding of the answer:

1. Change the context of Forecast2 to Recordset. Sort this F2 and map to Item in Target.

2. Change the context of Forecast2 to Recordset. Sort this F2 use SplitByValue and map to F2.

3. Change the context of Forecast2 and the mapping field to Recordset. Use SortByKey function as F2 as Argument1 then SpiltByValue. Map to the field.

Former Member
0 Kudos

Hello,

1) Yes

2) Yes

3) Change context of Forecast2 and the mapping field (for instance Forecast1) to Recordset then use SortByKey function (Forecast2 as Argument1 and other field (in this case Forecast1) as argument 2) then use SpiltByValue and eventually map output to the target field (Forecast1).

Thanks

Amit Srivastava

Answers (3)

Answers (3)

gagandeep_batra
Active Contributor
0 Kudos

Hi Hemant

Plz check below:

Regards

Gagan

monikandan_p
Active Participant
0 Kudos

Hi Hemant,   

Kindly follow the attached mapping instead of mark field you can give Forecast2.

Best Regards,

Monikandan.

Former Member
0 Kudos

Hi,

You can use nodeFunction sortByKey. Check this http://scn.sap.com/thread/1767252

Thanks,

Aman