Ask the Expert

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.

    Requires Free Membership to View

Maybe the following will give you an idea:
(The recommended XML format can be looked up in the SAP Interface Repository
append '= < IDOC= > ' to xml.
... header info
loop at int_edidd.

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

    NAME                = int_edidd-segnam
   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.

append '= < /SEGMENT= > ' to xml.
append '= < /IDOC= > ' to xml.

This was first published in January 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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: