Problem solve Get help with specific problems with your technologies, process and projects.

Learn how to copy IDoc data into a CSV data

Learn how to copy IDoc data into a CSV data with this description and sample code from Axel Angeli.

In SE80 I created an ABAP class. My piece of OO ABAP code has loaded in an inbound IDoc (eg. HRMD_A06)into the parser (DOM). Now, I want to loop through the parser document sequentially to locate specific data (eg. Segments E1P1000 and E1P1001) and load this data (eg. append) into defined/declared internal tables for further processing (I want to then render out a result in a CSV file).

Can you provide me with a sample of OO ABAP code for looping through a parser document and storing the infotype...

field data into internal tables? I'd also like code for the rendering of data into a CSV file.

I think there is a mix and match of terminology. When you speak of a parser, do you have an XML document? An IDoc is simple flat table that is delivered to you as internal table. The internal table has the structure EDIDD (like: DATA: INT_EDIDD type table of EDIDD). The following code copies IDoc data into a CSV data:
data: int_edidd type table of edidd with header line.
Data: csvtab type table of string.
Field-symbols: &ltsdata> type any.
Field-symbols: &ltfld> type any.
Data: comps type I, typ type C.
Data: sep type c.
Data: str type string.

Loop at int_edidd.
  Assign int_edidd-sdata to &ltsdata> casting type (int_edidd-segnam).
  Sep = space.
  Describe field &ltsdata> type typ components comps.
Do comps times.
 Assign component sy-index of structure &ltsdata> to &ltfld>.
 Concatenate str &ltfld> into str.
Append str to csvtab.

This was last published in November 2005

Dig Deeper on SAP interface technologies

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.