cancel
Showing results for 
Search instead for 
Did you mean: 

ignore RecordSet in the sFTP adapter Module bean

0 Kudos

Hi All,

Scenario: txt file to XML. SAP PI 7.11

Solution in place: Using FCC in FTP channel to convert the txt structure into XML

Problem: Now as all the FTP channels are to be replaced by sFTP channels.

I need to convert the txt to xml using the Message Transformation Bean. I am able to get the structure and all the foreign characters correctly, main problem is I am unable to remove the Recordset which comes in the source message.

existing structure

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Sales xmlns:ns0="http://namespace">

   <Header>

      <ABC/>

      <DEF>

   </Header>

   <Detail>

         <UVW>

          <XYZ>

   </Detail>

</Sales>

But the Present structure comes up as below, because of <Recordset> I am unable to use the existing mapping. Is there any way to attain this?

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Sales xmlns:ns0="http://namespace">

<Recordset>

   <Header>

      <ABC/>

      <DEF>

   </Header>

   <Detail>

         <UVW>

          <XYZ>

   </Detail>

</Recordset>

</Sales>


Modules used as follows

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi Rohan!

Another option is to use MTB one more time with XSL transformation to remove "Recordset" node after conversion.

Regards, Evgeniy.

0 Kudos

Hi Evgeniy,

Couldn't get this. How to put MTB again? It is not going to remove the <Recordset> right?
XSL is something I need to try before Message Mapping. but source tag has the xmlns, due to which it is difficult to read from the <Recorset> node.
Do you have any pointers to remove the <Recordset> not with xmlns

Regards,

Rohan

former_member190293
Active Contributor
0 Kudos

Hi Rohan!

I just mean that you can insert MTB in module sequence one more time with another prefix and use it for calling external XSL transformation:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2016/05/18/message-data-changetransformation...

So, your first MTB will convert flat structure into XML and the second one will apply transformation to first module's result.

And with XSLT you can modify XML structure according to your requirement.

Regards, Evgeniy.

0 Kudos

Hi Evgeniy,


Thanks for the approach, this looks good.

But I am really not able to construct the code to remove that <Recordset> node.

not that great with XSLT mappings.


Regards,

Rohan

former_member190293
Active Contributor
0 Kudos

Hi Rohan!

Input:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Sales xmlns:ns0="http://namespace">

    <Recordset>

        <Header>

            <ABC>1</ABC>

            <DEF>2</DEF>

        </Header>

        <Detail>

            <UVW/>

            <XYZ/>

        </Detail>

    </Recordset>

</ns0:Sales>

XSL:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    version="1.0">

     <xsl:output indent="yes"/>

     <xsl:template match="/*">

          <ns0:Sales xmlns:ns0="http://namespace">

               <xsl:copy-of select="//Recordset/*"/>

          </ns0:Sales>

     </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="utf-8"?>

<ns0:Sales xmlns:ns0="http://namespace">

     <Header>

          <ABC>1</ABC>

          <DEF>2</DEF>

     </Header>

     <Detail>

          <UVW/>

          <XYZ/>

     </Detail>

</ns0:Sales>

Regards, Evgeniy.

0 Kudos

Thanks a lot Evgeniy, This worked like a Charm..

former_member190293
Active Contributor
0 Kudos

Hi Rohan!

Glad if it helps.

Regards, Evgeniy.

Answers (2)

Answers (2)

apu_das2
Active Contributor
0 Kudos

I am not sure about 7.11 though ... Aren't you using SFTP PGP ADD on 1.0 ?

It should allow you to select FCC in Message protocol.

Thanks,
Apu

0 Kudos

Hi Apu,

FCC is not available in the sFTP adapter channel used at present.

Regards,

Rohan

manoj_khavatkopp
Active Contributor
0 Kudos

MTB dosen't has option to remove RecordSet you need to have custom module or handle in mapping.

Or update to latest patch of SFTP and handle in FCC SFTP Adapter - 1 Recordsets per message | SCN