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.
Note: Use XML_CLOSE to close the XML document after processing. For more information, see :XML_CLOSE.
This page includes the following:
Syntax and Parameters
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 )
-
XML_OPEN
Opens an XML document for processing
-
Source
The source of the XML document
Format: AE name, script literal or script variable
Allowed values:-
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
-
Structured Documentation as the Source
-
Object Name
(Optional if you use the Documentation page of your own object) Name of the object.
Format: script literal or script variable -
@Documentation
Name of the Documentation page with a preceding at sign (@). For details on how to create structured and unstructured pages, see Documentation Page.
Format: script literal or script variable
Report of an SAP job as Source
-
RunID
(Optional if you use the report of your own object) Run number (RunID) of the task whose report you want to open.
Format: script literal or script variable -
Report
Type of XML reportMore information:
- Understanding the Reports
- Special Reports for SAP Jobs
- Reports of SAP jobs are stored as XML documents. For XI_GET_CHANNEL, they contain a list of selected communication channels. For more information, see XI_GET_CHANNEL.
XML in the Form of a String as the Source
-
String
A string that contains the XML
Format: script variable or script literal
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.
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: