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.

This Content Component encountered an error
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 first published in January 2004

Dig deeper on SAP interface technologies

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

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.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close