Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Generating an XML Document from an internal table in ABAP

Good day to all of you;

With ABAP, in the R/3 system, I'm trying to figure out a way to accomplish the following:

1) SELECT a set of Purchase Order data into an internal table.

2) Generate an XML document, containing the above data, using a specific schema.

I've been playing around with function module SAP_CONVERT_TO_XML_FORMAT which has the following interface:

CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'

EXPORTING

  • I_FIELD_SEPERATOR = ''

  • I_LINE_HEADER = ''

I_FILENAME = v_fname

  • I_APPL_KEEP = ''

  • I_XML_DOC_NAME = v_docname

IMPORTING

PE_BIN_FILESIZE = v_byte

TABLES

I_TAB_SAP_DATA = i_SapData

CHANGING

I_TAB_CONVERTED_DATA = i_XMLData

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2.

I'm uncertain as to whether or not the Export parameter, I_XML_DOC_NAME refers to some schema or definition and therefore have been excluding it. In doing so, the generated XML document seems to use the field name/type information from my itab for the tags.

If this function module requires an XML Document Name, how do I create one and where do I store it in R/3? If this is not the recommended solution, is anyone familiar with a way to load an XML schema, retrieve some data then have SAP generate an XML document using the schema?

Many thanks for any help available.

T

Tags:
Not what you were looking for? View more on this topic or Ask a question