cancel
Showing results for 
Search instead for 
Did you mean: 

Any external XML file to Asc file conversion using SAP XI

Former Member
0 Kudos

Hi,

we are receiving a file from POS System with .trx extension which has XML data, see below exact content, Now i need to convert this to .ASC file with all < lineitem> data coming and after every lineitem tag in xml there must be new line inserted.

Sample File Coming:

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

<Transaction>

<Task>CCF</Task>

<ChainID>0001</ChainID>

<RetailStoreID>0001</RetailStoreID>

<MMDD>1124</MMDD>

<WorkstationID>01</WorkstationID>

<SequenceNumber>00002</SequenceNumber>

<FileNumber>1</FileNumber>

<LineItem>I 0000101005555005555081124194335000029000100112411111 00011000000100000099900 00099900 0000000 100000000000000000000000099900000000000</LineItem>

<LineItem>I2000010100555500555508112419433500002900020011241000999000009990000099900 000000000000000000000000000000000000000000000000000000000 00088800</LineItem>

<LineItem>I600001010055550055550811241943350000290003001124100000000 000999000009990000000100000000 0000000000000000000000000000</LineItem>

<LineItem>I7000010100555500555508112419433500002900040011241011100 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 </LineItem>

<LineItem>PF000010100555500555508112419434100002900050011241130101fefre 434353 fdfdfdfg 00000000</LineItem>

<LineItem>T 00001010055550055550811241943450000290006001124100099900 011100 000000000000 000000000000 000000000000 000000100000000 00000000 </LineItem>

<LineItem>T2000010100555500555508112419434500002900070011241000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 </LineItem>

<LineItem>TX000010100555500555508112419434500002900080011241010000000111000008880000</LineItem>

<LineItem>P 0000101005555005555081124194343000029000900112410100100000 00000000 00000100 0 00INR</LineItem>

<LineItem>M 000010100555500555508112419434500002900100011241400 00000000 00000000000 0001010000050</LineItem>

<LineItem>M 000010100555500555508112419434500002900110011241370 00000000 00000000000 0</LineItem>

<LastFile/>

</Transaction>

-


Note: Here LineItem can be 0-unbounded.

Output Desired:

I 0000101005555005555081124194335000029000100112411111 00011000000100000099900 00099900 0000000 100000000000000000000000099900000000000

( here new line after every lineitem value)

I2000010100555500555508112419433500002900020011241000999000009990000099900 000000000000000000000000000000000000000000000000000000000 00088800

Simlarly all data of line item coming.

Tried Using File(created structure at Source side as per file above) to File with Content conversion at Recevier Side, but for end to end implementation it fails as external xml structure does not have <ns0..> tag that comes when we form a message type at XI end.

Regards

Surbhi

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member192295
Active Contributor
0 Kudos

Hi,

Better to import POC target XMl structure into XI/PI through external definition and try it else in PI message type remove name spae and try it. It will work.

Former Member
0 Kudos

Hi ,

BUt here my files of .trx extension will be on FTP folder and then I need to pick them and convert and place back on FTP.

Also XML convertor cannot be used as Files are going to come dynamically,its not fixed. They will keep generating on FTP and we need to pick and convert them as our requirement.

ALso removing xml namespace of message type makes it work in Testing in message mapping but, this donot work in end to end implementation as XI message type add a line of <ns0.... of message type name> and this cannot be inserted in incoming file as they are coming from FTP. Please let me know how to proceed.

prateek
Active Contributor
0 Kudos

this donot work in end to end implementation as XI message type add a line of <ns0

If it works for test tab, it must work for end-to-end scenario too. What is the error you are facing?

Regards,

Prateek

Former Member
0 Kudos

Hi Prateek,

Uploading the exact file in Test tab fails with error:

Error Coming in File to File implemnetaiton: Cannot produce target element /ns0:RealTimeTlog. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd

Regards,

Surbhi

Former Member
0 Kudos

Hi Surabhi,

To convert XML file to ASCII you need XML Compiler. It will store defaultly in IE or Mozilla tools. May I know need of the compiler. Search in google for XML compiler. According to me it will store default in

Explorer tools or might be you will get in XML SPY or COOKTALK.

Thanks,

RamuV

prateek
Active Contributor
0 Kudos

but for end to end implementation it fails as external xml structure does not have <ns0..>

Open the message type. There you will see a field called "XML namespace". Empty the field. Save, activate and try again.

Regards,

Prateek

Former Member
0 Kudos

Hi,

I have tried emptying XML Namespace in message type, yet no success as in test tab we still have

Line<ns0:POS_Trx xmlns:ns0="http://sap.com/xi/TricklePolling"> this is not present in my input .trx file, Is there any way i can remove this and so it doesnot fail in end to end running when input file coming from ftp does not have this line which is XI specific in our message type.

see exact data below of sample test tab below :

In XI mesage mapping:

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

<ns0:POS_Trx xmlns:ns0="http://sap.com/xi/TricklePolling">

<Transaction>

<Task/>

<ChainId/>

<RetailStoreID/>

<MMDD/>

<WorkStationID/>

<SequenceNumber/>

<FileNumber/>

<LineItem>444</LineItem>

<LineItem>6666</LineItem>

<LineItem>77777</LineItem>

<LineItem>99999999999</LineItem>

</Transaction>

</ns0:POS_Trx>

< Data for my incoming file is posted above>

Kindly let me know how to solve this. Is there any other way, i can solve it.

prateek
Active Contributor
0 Kudos

Surbhi, please check the solutions before posting the problem further. The purpose of removing namespace from message type is to remove the namespace from the sender structure. Once you configure the scenario, just try with sending your file (without ns0) and let us know where it is failing and what is the error.

For testing, don't upload the file. Instead first test and check "Source" tab and you will find the required file.

Regards,

Prateek

Former Member
0 Kudos

Hi Prateek,

I have again tested it with sample file data ( end to end, with completed XI scenario by picking file from FTP ). XML namespace fromMessage type is removed

Error in sxmb_moni

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

- <!-- Request Message Mapping

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">

<SAP:Category>Application</SAP:Category>

<SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>

<SAP:P1>com/sap/xi/tf/_TRX_RealTimeTlog_MM_</SAP:P1>

<SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>

<SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>

<SAP:P4 />

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_TRX_RealTimeTlog_MM_: RuntimeException in Message-Mapping transformatio~</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

Kindly let me know how to proceed.

Thanks,

Surbhi