Skip to Content
avatar image
Former Member

Sorting fields for a group

Hi All,

I am facing a issue while sorting records from source.I have a structure like this -

<node>

<aa>13</aa>

<bb>200</bb>

</node>

<node>

<aa>16</aa>

<bb>200</bb>

</node>

<node>

<aa>14</aa>

<bb>100</bb>

</node>

<node>

<aa>12</aa>

<bb>100</bb>

</node>

My target Structure should be -

<node>

<aa>14</aa>

<bb>100</bb>

</node>

<node>

<aa>12</aa>

<bb>100</bb>

</node>

<node>

<aa>13</aa>

<bb>200</bb>

</node>

<node>

<aa>16</aa>

<bb>200</bb>

</node>

I have to check the last occurence of each different <bb>.Now for this last occurrence, check value of <aa>.Lower the value of <aa>, whole group for that <bb> should comes first in sequence for target structure.

Please provide inputs how to achieve this.

Thanks,

Marz

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 25, 2009 at 07:56 AM

    marz,

    did u try implementing the ABAP mapping program

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 22, 2009 at 07:16 AM

    try making use of sort and sortbykey functions to help you.

    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 22, 2009 at 11:10 AM
    mapping for node : node
    
    mape source node -> target node
    
    mapping for node aa :
    
    context of aa and bb should be set to the top node i.e msg type.
    bb--------|
              |-------sort by key---------|
    aa--------|                           |                                                                                
    |---format by example--sort-- splitbyvalue each val---aa 
                                          |                                                 
    bb--sort---split by val(val chnge)----|
    
    
    
    maping for node bb:
    
    context of bb should be set to the top node i.e msg type.
    
    bb---sort---split by value each val ---bb.

    this one is working for me and should surely work for you as well.

    Giving points is another way to say thanks

    Edited by: Tarang Shah on Mar 22, 2009 12:10 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Tarang,

      Thanks for inputs.I have just tried the mapping suggested by you.

      But it doesn't produce the required target structure as posted by me..

      Thanks,

      Marz