Skip to Content

Proxy to File scenario- sorting records.

Hi Experts,

I have a proxt to file scenario where i need to sort the records coming from Proxy with a key field and then map it to the fil structure.

Source and target structure :

<Records>

          <Name>

          <PhoneNo>

          <Doj>

          <Gender>

</Records>

Sample input :

<Records>

          <Name>ABC</Name>

          <PhoneNo>1234<PhoneNO>

          <Doj>2014-01-02</Doj>

          <Gender>F</Gender>

</Records>

<Records>

          <Name>XYZ</Name>

          <PhoneNo>9876<PhoneNO>

          <Doj>2013-12-01</Doj>

          <Gender>M</Gender>

</Records>

<Records>

          <Name>QWE</Name>

          <PhoneNo>8765<PhoneNO>

          <Doj>2015-04-07</Doj>

          <Gender></Gender>

</Records>

I have to sort according to field Doj.

output should be as :

<Records>

          <Name>XYZ</Name>

          <PhoneNo>9876<PhoneNO>

          <Doj>2013-12-01</Doj>

          <Gender>M</Gender>

</Records>

<Records>

          <Name>ABC</Name>

          <PhoneNo>1234<PhoneNO>

          <Doj>2014-01-02</Doj>

          <Gender>F</Gender>

</Records>

<Records>

          <Name>QWE</Name>

          <PhoneNo>8765<PhoneNO>

          <Doj>2015-04-07</Doj>

          <Gender></Gender>

</Records>

if i should apply sort by key function do i need to apply for all the fields ??

can you please tell exactly which and where Message mapping functions  have to be used ?

Thanks,

Manoj

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Dec 22, 2014 at 04:47 PM

    >>>if i should apply sort by key function do i need to apply for all the fields ??


    yes. You might have to apply sort by key for all the fields.


    However it should be very simple if you go with xslt (in case you have lot of fields to apply the sort)


    You can refer to sample function in the below document

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd37d?overridelayout=t…


    >>>can you please tell exactly which and where Message mapping functions  have to be used ?


    Please search scn.

    Standard Functions in PI 7.0 - Process Integration - SCN Wiki

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 12:32 AM

    Manoj,

    Sorting XML using Graphical mapping (agree with Hareesh) or XSLT 1.0 is difficult. It becomes more difficult with deep nested XML.

    1) Sorting is simple in XSLT 2.0. Blog. OR

    2) Use Java mapping with DOM.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 07:09 AM

    Hi Manoj,

    My few cents..

    You mention this is Proxy to File scenario....I suggest you to check with ABAPer and ask them to send the data in required Sorted format as its much simpler/easier to Sort in ABAP code rather than applying node functions/sort / XSLT in PI...and also u might need to handle Context in PI which will add to complexity.

    Regards,

    Azhar

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 08:14 AM

    Hi Manoj,

    You can do the mapping like this...

    For DOj Field you can do below  mapping... I am considering field4 as DOJ

    For remaining all the fields you can do like this... here also field4 has doj   and consider field5 has name like that

    Let me know if you face an issue.

    Thanks,

    Sreenivas

    Add comment
    10|10000 characters needed characters exceeded