Skip to Content
author's profile photo Former Member
Former Member

URGENT : Program to convert flat file to XML file.

Hello,

Good Morning. I want an urgent program to convert a flat file seperated by '/' to an XML file format and store that in the the application server. If any one has done such a developement, could you please send me the code.

The flat file format is as below :

72/070414/114147/11973//100-//EA/00000000///04198//RRT0/RC23///////353825001511172/72/070414/123620/11973//1000//EA/00000000///04198//RRT0/RC23///////354762008125236/72/070414/125411/13814//1000//EA/00000000///04198//INV/ID06///////90000000002697/72/070414/140820/11973//1000//EA/00000000///04198//RRT0/RC23///////353057002479718/72/070414/145438/13814//1000//EA/00000000///04198//INV/ID06///////90000000002739/72/070414/145438/11973//1000-//EA/00000000///04198//INV/ID06///////353057002479718/72/070414/150008/13814//1000

It needs to be filtered by removing the '/' and also grouped based on two fields namely store number and transaction number. The sample XML output required is as below :

<?xml version="1.0" encoding="ISO-8859-1"?>

http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../MT_POLL07.xsd">

<MessageHeader>

<File>

<Name>C:/kai/perl/storemaster_home/stores/09100/inbound/POLL07.DOS</Name>

<CreatedDate>Wed Feb 7 13:09:15 2007</CreatedDate>

<TotalRecordNo>19</TotalRecordNo>

</File>

</MessageHeader>

<Transaction>

<TransactionHeader>

<TRANSACTION>20070414001559</TRANSACTION>

<STORE_NO>09100</STORE_NO>

<BOFTTP>72</BOFTTP>

</TransactionHeader>

<Item>

<BOFTDT>070414</BOFTDT>

<BOFTTM>114147</BOFTTM>

<BOFSKU>11973</BOFSKU>

<BOFUPC></BOFUPC>

<BOFQTY>100</BOFQTY>

<BOFQTN>-</BOFQTN>

<BOFCST>0</BOFCST>

<BOFCSN>+</BOFCSN>

<BOFUM>EA</BOFUM>

<BOFHRF>00000000</BOFHRF>

<BOFSRF></BOFSRF>

<BOFVND></BOFVND>

<BOFLOC>04198</BOFLOC>

<BOFEQT></BOFEQT>

<BOFEQN>+</BOFEQN>

<BOFRTP>RRT0</BOFRTP>

<BOFREA>RC23</BOFREA>

<BOFCID></BOFCID>

<BOFAUT></BOFAUT>

<BOFCUR></BOFCUR>

<BOFPTP></BOFPTP>

<BOFUPT></BOFUPT>

<BOFUMR></BOFUMR>

<BOFSRN>353825001511172</BOFSRN>

<GMNUMBER>1</GMNUMBER>

</Item>

<Item>

<BOFTDT>070414</BOFTDT>

<BOFTTM>123620</BOFTTM>

<BOFSKU>11973</BOFSKU>

<BOFUPC></BOFUPC>

<BOFQTY>1000</BOFQTY>

<BOFQTN>+</BOFQTN>

<BOFCST>0</BOFCST>

<BOFCSN>+</BOFCSN>

<BOFUM>EA</BOFUM>

<BOFHRF>00000000</BOFHRF>

<BOFSRF></BOFSRF>

<BOFVND></BOFVND>

<BOFLOC>04198</BOFLOC>

<BOFEQT></BOFEQT>

<BOFEQN>+</BOFEQN>

<BOFRTP>RRT0</BOFRTP>

<BOFREA>RC23</BOFREA>

<BOFCID></BOFCID>

<BOFAUT></BOFAUT>

<BOFCUR></BOFCUR>

<BOFPTP></BOFPTP>

<BOFUPT></BOFUPT>

<BOFUMR></BOFUMR>

<BOFSRN>354762008125236</BOFSRN>

<GMNUMBER>2</GMNUMBER>

</Item>

</Transaction>

</MT_POLL07>

Please send me the code : It is urgent. Thanks in advace. Points to be rewarded.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 05:08 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 28, 2008 at 05:14 AM

    Deba,

    What code do u want? Grouping the data by store number and transaction number is the second part. First use the content conversion and see whether you

    r getting the data into XI. If not first solve the content conversion logic, then go for mapping.

    Please refer http://help.sap.com/saphelp_nw70/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

    raj.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 05:14 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 05:17 PM

    Hi,

    You can use the 'content conversion ' function of File Adapter when you create the Sender Communication Channel, you can refrence some documents about this.

    Also u can develope ur own programs to convert the flat file into XML.

    U can use DOM by JAVA programming or JDOM to realize it .

    First to read the flat file into a String as a stream,

    and then split the String with '/' and create correspondingly NODEs as the XML formats

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 06:52 AM

    Hello Xiang,

    Thanks for your answer. I do know that we need to use the Java or ABAP DOM parser to implement the same. Could you please give me the code about how to go about it. If you can help with this. Please let me know. Thanks in avance.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:04 AM

    Hello experts,

    I forgot to mention that, this thing of converting the flat file to XML should be done using ABAP coding. The file is placed in the application server. It is picked from the application server and the '/' removed and filtered. There are 19 records in total. 72 is the starting record. The next occurance of /72 is the new record and would be placed in an internal table in a new line.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.