Adapter for SAP 10.1 | webMethods Adapter for SAP Documentation | webMethods Adapter for SAP Installation and User’s Guide Documentation | Built-in Services | IDoc-XML Services | pub.sap.idoc:decode
 
pub.sap.idoc:decode
Service that converts an XML string in a format specified by the SAP IDoc-XML Specification into an IDoc that is of the type com.sap.conn.idoc.IDocDocumentList and necessary for an RFC call (using pub.sap.client:sendIDoc).
Input Parameters
bytes
- OR -
Byte array. Contains the data to be decoded as IDocXML.
node
- OR -
XML Node object that represents the IDocXML data (you will get a node, e.g. when putting an XML file via FTP with extension .xml). The service checks in that order if an input document is available: xmlData, bytes, node.
xmlData
String. The IDoc in XML. The XML format is consistent with the SAP IDoc-XML specification.
Return Values
$encoding
Specifies the encoding from the input document's XML header, e.g. iso-8859-1.
iDocList
Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentListcom.sap.conn.idoc.IDocDocumentList.
Example
This service is the first service called when you want to send an IDoc-XML document to an SAP system. The following is a sequence of service calls that take an IDoc in XML format, convert it to a com.sap.conn.idoc.IDocDocumentListcom.sap.conn.idoc.IDocDocumentList object, then fire it into the SAP system:
1. Invoke this service (pub.sap.idoc:decode). This takes the input xmlData (the XML String) and creates an com.sap.conn.idoc.IDocDocumentList object that is in RFC-ready form. (This means that it matches the RFC call used to send an IDoc into the SAP system, and that the pipeline is almost in the required format).
2. Invoke pub.sap.client:createTID. Use this service to request a transaction id from an SAP system that can be used for sending the IDoc to the SAP system.
Note:
Store this transaction ID, so that you can resend the IDoc in case of errors with the same ID.
3. Invoke pub.sap.client:sendIDoc.