Q

Writing utility to convert IDoc file to XML

I am writing a utility to convert IDoc file to XML format. I have some basic questions about IDOC.The IDOC file, which I am going to convert, is normal text file, which consist of three sections (control, data and status). Now in each section how I will recognize which fields are exists and what is the length of each field, I mean how to recognize what is start and end position of each field by just looking to normal text file.

I am writing a utility to convert IDoc file to XML format. I have some basic questions about IDOC.The IDOC file, which I am going to convert, is normal text file, which consist of three sections (control, data and status). Now in each section how I will recognize which fields are exists and what is the length of each field, I mean how to recognize what is start and end position of each field by just looking to normal text file.
Maybe the following will give you an idea:
(The recommended XML format can be looked up in the SAP Interface Repository ifr.sap.com.)
append '= < IDOC= > ' to xml.
... header info
...
loop at int_edidd.

concatenate '= < SEGMENT name="' int_edidd-segnam '"= > ' into xml.
append xml.

CALL FUNCTION 'DDIF_TABL_GET'
  EXPORTING
    NAME                = int_edidd-segnam
 TABLES
   DD03P_TAB           = DD03P_TAB.

ofs = 0.
loop at seginfo.
     len = DD03P_TAB-intlen.
     assign int_edidd+ofs(len) to = < fld= > .
     concatenate '= < FIELD name="' DD03P_TAB-fieldname '"= > ' into xml.
     append xml.
     append = < fld> to xml.
     append '= < /FIELD= > ' to xml.
     ofs = ofs + len.
endloop.

append '= < /SEGMENT= > ' to xml.
endloop.
append '= < /IDOC= > ' to xml.
This was last published in January 2004

Dig Deeper on SAP interface technologies

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close