on 08-26-2016 4:08 PM
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
Hi Rohan!
Another option is to use MTB one more time with XSL transformation to remove "Recordset" node after conversion.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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:
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.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.