XML_OPEN

Use the XML_OPEN script function to open an XML document for processing purposes. You can open only one XML document at a time. The source of the XML document can be Structured Documentation, the report of a SAP job, or an XML string.

Note: Use XML_CLOSE to close the XML document after processing. For more information, see :XML_CLOSE.

This page includes the following:

Syntax

The basic syntax of this script function contains the following elements:

XML_OPEN (DOCU, [Object Name], @Documentation)

XML_OPEN (REPORT, [RunID], Report)

XML_OPEN (STRING, String)

Parameters

Parameter Description Format Allowed Values
Source The source of the XML document. AE name, script literal, or script variable
  • DOCU: Structured documentation is used as the source.
  • REPORT: The report of an SAP job is used as the source.
  • STRING: XML in the form of a string is used as the source.
Object Name (Optional if you use the Documentation page of your own object) Name of the object. Script literal or script variable n.a.
@Documentation Name of the Documentation page with a preceding at sign (@). For details on how to create structured and unstructured pages, see Documentation Page.. Script literal or script variable n.a.
RunID (Optional if you use the report of your own object) Run number (RunID) of the task whose report you want to open. Script literal or script variable n.a.
Report Type of XML report. n.a. n.a.
String

A string that contains the XML.

Note: An incorrect XML string either leads to a runtime error or returns a return code that you can read with the SYS_LAST_ERR_NR script function. For details, see SYS_LAST_ERR_NR.

Script variable or script literal n.a.

More Information for SAP Reports

Return Code

This script function returns a handle, a reference to the XML document. It refers to the root element.

Examples

The following example opens the @Details page, a Structured Documentation page of the MM.DAY Job object for further processing:

:SET &XMLDOCU# = XML_OPEN(DOCU, "MM.DAY""@Details")

The following example opens an XML document with a string:

:SET &REF# = XML_OPEN('STRING','<xmlstring>')

:SET &REF# = SYS_LAST_ERR_NR()

:IF &RET > 0

  :SET &TXT# = SYS_LAST_ERR_INS()

! implement error handling here

:ENDIF

See also: