Built-in Services

SAP Client Services

pub.sap.client:connect

Establishes a connection to an SAP system.

Input Parameter

serverName Alias of the SAP system to which the connection is established. The name must match a configured RFC connection alias at Adapter for SAP.
$client Optional. Client for the session. If no client is specified, the default client is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

result "Ok" if connection was established successfully.

Example

Use the pub.sap.client:connect service when you want to establish a connection to a target SAP system. This might be useful for creating a session pool. In the most common scenarios, it is not necessary to invoke this service explicitly, as it is invoked implicitly (for example, when a pub.sap.client:invoke or pub.sap.client:invokeTransaction is issued).

pub.sap.client:lockSession

Locks an RFC connection to your Integration Server session so that you will always exclusively use this RFC connection for subsequent calls.

x

Input Parameter

serverName Alias of the SAP system to which the connection is established. The name must match a configured RFC connection alias at Adapter for SAP.
$client Optional. Client for the session. If no client is specified, the default client is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

None

Example

Note: This service locks a session to trigger a commit work command inside the SAP system. This causes a database commit. This service only works with SAP systems version 4.0A and higher because BAPIs do not write data directly to the database but use the posting engine inside the SAP system and the start of the processing of posted data.

The data will not be written to the database until the client triggers a commit work command. In order to call a BAPI that writes data, you must perform the following steps on Integration Server:

  1. Call the pub.sap.client:lockSession service in order to get an exclusive connection to the SAP system.
  2. Perform the BAPI calls.
  3. Call the pub.sap.bapi:commit or pub.sap.bapi:rollback service
  4. Call the pub.sap.client:releaseSession service in order to release the exclusive connection to the SAP system and clean up used resources on Integration Server.

pub.sap.client:releaseSession

Releases a locked session o n an SAP system.

Input Parameter

serverName SAP system alias on which the locked session is located. The name must match a configured RFC connection alias at Adapter for SAP. .
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

None

Example1

The service will release a session after a commit work or rollback work command has been triggered inside the SAP system.

Note: This service only works with SAP systems version 4.0A and higher because BAPIs do not write data directly to the database but use the posting engine inside the SAP system.

In order to call a BAPI that writes data, you must perform the following steps on Integration Server:

  1. Call the pub.sap.client:lockSession service in order to get a exclusive connection to the SAP system.
  2. Perform the BAPI calls.
  3. Call the pub.sap.bapi:commit or pub.sap.bapi:rollback service.
  4. Call the pub.sap.client:releaseSession service in order to release the exclusive connection to the SAP system and clean up used resources on Integration Server.

Example2

You also need this service if you want to lock and change a certain database object. To do this, please proceed as follows:

  1. Call the pub.client:lockSession service in order to get an exclusive connection to an SAP system.
  2. Lock an object by calling a BAPI_ *_ENQUEUE.
  3. Make your changes by invoking other BAPIs.
  4. Release the object by calling a BAPI_*_DEQUEUE.
  5. Call the pub.client:releaseSession service.

pub.sap.client:invoke

Invokes an RFC function module in synchronous mode on a given SAP system.

Input Parameter

serverName SAP system alias on which the function module will be invoked. The name must match a configured RFC connection alias at Adapter for SAP.
$rfcnamep Name of the function module to be invoked.
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

This service returns the outputs (exports and tables) returned by the function module.

$rfctime Time (ms) spent within the RFC library to complete the invocation.
$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether the pipeline represents a request (true) or a response (false) of a function module.

Example

This service is used when you are directly calling an RFC on an SAP system without creating an RFC adapter service. (When an RFC adapter service is used, this service is invoked implicitly.)

pub.sap.client:invokeTransaction

Invokes an tRFC function module on a given SAP system.

Input Parameter

serverName SAP system alias on which the function module will be invoked. The name must match a configured RFC connection alias at Adapter for SAP.
$rfcnamep Name of the function module to be invoked.
$tid Transaction this invoke is assigned to.
$queueName Optional. Name of the SAP system inbound queue. Specify a value in case of a qRFC scenario
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$rfctime Time (ms) spent within the RFC library to complete the invocation.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether pipeline represents a request or response of a function module. Possible values are:
  • true for request.
  • false for response.

Example

This service is used in outbound flows and can handle both synchronous and transactional RFC calls. Therefore, it can be seen as a generic wrapper for pub.sap.client:invoke, pub.sap.client:invokeTransaction and pub.sap.client:confirmTID.

pub.sap.client:createTID

Call this service if you want to obtain a transaction ID (TID; which is a GUID) that conforms to the format of SAP TIDs.

The obtained TID can be used as an input value for pub.sap.client:invokeTransaction, pub.sap.client:sendIDoc, and pub.sap.client:confirmTID.

For more information about using the fast, offline method of creating Transaction ID, see watt.sap.fastTIDCreation.

Important: If no TID exists in the pipeline, then the pub.sap.transport.ALE:OutboundProcess service performs the function of both the pub.sap.client:createTID and pub.sap.client:invokeTransaction services. For IDocs, it is recommended that you use either the pub.sap.transport.ALE:OutboundProcess service or the call sequence of pub.sap.client:createTID and pub.sap.client:sendIDoc.

Input Parameter

serverName Alias of the SAP system that sends the TID. This name must match a configured RFC connection alias at Adapter for SAP.
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

$tid Contains the TID.

Example

This service is used in tRFC client scenarios, which require a transactional ID (TID) uniquely identifying the transaction. See also pub.sap.client:confirmTID.

pub.sap.client:confirmTID

Confirms the transaction specified by the TID on the specified SAP system.

This service must be called after a transactional invoke in order to complete a transaction on the target system.

Input Parameter

serverName Alias of the SAP system that sends the TID. This name must match a configured RFC connection alias at Adapter for SAP.
$tid Transaction ID to be confirmed.
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

None.

Example

This service is used in tRFC client scenarios in order to confirm a transaction which is executed completely.

  1. Invoke clientCreateTID. This service creates an SAP-conformant TID. It is necessary to have one, otherwise you cannot invoke the function module with clientInvokeTransaction. If you have already obtained a TID, you must use that one in order to guarantee that the transaction is executed only once.
  2. Invoke clientInvokeTransaction. This service invokes the given function module as a tRFC on the SAP system specified by serverName. The TID is passed as a parameter on this call.
  3. Invoke clientConfirmTID. Confirms that the transaction is completed. Pass the same serverName and $tid value on this call.

pub.sap.client:getAttributes

Connects to the given SAP system and returns information specific to one RFC client connection session:

Input Parameter

serverName Alias of the SAP system that sends the TID. This name must match a configured RFC connection alias at Adapter for SAP.
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

destination String. Destination of the connection.
ownHost Hostname (or IP) of the machine Integration Server is running on.
partnerHost Hostname (or IP) of the machine the SAP system is running on.
systemNumber System number of the SAP system.
systemID Unique three-letter-ID of SAP system (in local network).
client Client the session is connected to.
user SAP user that has connected with this session.
language Logon language.
SOLanguage ISO name for logon language.
ownCodepage SAP codepage this connection is using.
partnerCodepage SAP codepage the SAP system is running on.
ownRelease Version of the loaded RFC library used by Adapter for SAP.
partnerRelease Release of the SAP system.
kernelRelease Kernel release of the SAP system.
partnerType RFC type of the partner; SAP ECC(3), R/2(2) or external RFC server(E).
trace Flag indicating whether trace is turned on (true) or off (false) for this connection.
ownType RFC type of Adapter for SAP; is always be E.
rfcRole Role of Adapter for SAP in this call; is always be: C (for client).
CPICConversationID CPIC ID of the connection (low level protocol information).
encoding IANA-encoding that is equivalent to the SAP codepage used, for example: ISO-8859-1.
charset Charset that is equivalent to the SAP codepage used, for example: ISO8859_1 (used in Java constructors).
bytesPerChar Number of maximum bytes used per char in the codepage.

pub.sap.client:getFunctionInterface

Looks up the function interface definition of an RFC function module in the given SAP system.

Input Parameter

$rfcname Function module for which the interface definition is looked up.
serverName Alias of the SAP system on which the RFC function module is defined. The name must match a configured RFC connection alias at Adapter for SAP.

Return Values

Document list named params that contains all parameter-related information:

paramClass Class of parameter; I (importing), E (exporting), T (table), X (exception).
parameter Name of the parameter in the function interface.
tabName Name of the table in the SAP system the parameter is referring to.
type Type of the parameter (for example: CHAR, STRUCTURE, TABLE, ...)
length Internal length in bytes of the parameter.
decimals Only relevant for decimal types; number of decimals used.
optional Flag indicating whether parameter is optional.

pub.sap.client:getStructureDefinition

Looks up the structure definition of an SAP structure in the given SAP system.

Input Parameter

structName Structure name for which the definition is looked up.
serverName Alias of the SAP system on which the RFC function module is defined. The name must match a configured RFC connection alias at Adapter for SAP.

Return Values

Document list named params that contains all parameter-related information:

tabLength Length of the structure when used in a table. This might differ from the sum of all field lengths, as the number types have to be aligned to memory segments.
fields
Key Description
fieldName Name of the field.
tabName Optional. Name of the table/structure in the SAP system the field is referring to.
position Position within structure.
offset Offset in bytes to this field.
length Internal length in bytes.
decimals Only relevant for decimal types; number of decimals used.
type Type of the field (for example: CHAR, STRUCTURE, TABLE, ...).

pub.sap.client:getThroughput

Returns the performance throughput value of the connection since the adapter startup or the last reset to zero

Input Parameter

serverName Alias for the SAP system from which you want to recieve the RFC connection specific attributes. The name must match a configured RFC connection alias at Adapter for SAP. Optional. Set to true to reset the performance throughput values to zero
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

numberOfCalls Number of calls executed by the connection.
numberOfBytesSent Number of bytes sent by the connection.
umberOfBytesRecieved Number of bytes received by the connection.
marshallingTime Time spent by the connection to convert pipeline data into RFC data (in ms).
unmarshallingTime Time spent by the connection to convert RFC data into pipeline data (in ms).
timeForPreparation Time spent by the connection for preparation and repository lookups (in ms).
timeForMiddlewareCalls Time spent by the connection during RFC network calls(in ms).
timeForAdapterServiceCalls Time spent by the connection for processing inbound or outbound requests in Integration Server services.
totalTime Total time spent by the connection for processing inbound and outbound services.

pub.sap.client:sendIDoc

Sends an IDoc list to a given SAP system. The IDocs in the list must be of the same IDoc type.

Input Parameter

serverName Alias for the SAP system from which you want to recieve the RFC connection specific attributes. The name must match a configured RFC connection alias at Adapter for SAP. Optional. Set to true to reset the performance throughput values to zero
iDocList Contains the IDoc(s) as object of the com.sap.conn.idoc.IDocDocumentList type.
$tid The ID of the transaction under which the service is executed
$queueName Optional. Name of the SAP system IDoc inbound queue. Specify a value in case of an ALE queuing scenario.
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$rfctime Time (ms) spent within the RFC library to complete the invocation.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether pipeline represents a request or response of a function module. Possible values are:
  • true for request.
  • false for response.

pub.sap.client:sendIDocLists

Sends a heterogenous list of IDoc lists to a given SAP system. All the IDoc elements in an IDoc list must be of the same IDoc type, but the IDoc lists can contain different types. All IDocs can be processed in a single transaction.

Note: Install IBM webMethods Adapter for SAP Fix 1 and later to use this service.

Input Parameter

serverName Alias for the SAP system from which you want to receive the RFC connection specific attributes. The name must match a configured RFC connection alias at Adapter for SAP. Optional. Set to true to reset the performance throughput values to zero
iDocList Contains the IDoc(s) as object of the com.sap.conn.idoc.IDocDocumentList type.
$tid ID of the transaction under which the service is executed.
$queueName Optional. Name of the SAP system IDoc inbound queue. Specify a value in case of an ALE queuing scenario.
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$rfctime Time (ms) spent within the RFC library to complete the invocation.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether pipeline represents a request (true) or a response (false) of a function module.

pub.sap.client:ping

Checks the response time of an SAP system.

Input Parameter

serverName Alias for the SAP system from which you want to receive the RFC connection specific attributes. The name must match a configured RFC connection alias at Adapter for SAP. Optional. Set to true to reset the performance throughput values to zero
$client Optional. Client for the session. If no client is specified, the client specified in the SAP system alias settings is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

responseTime Response time of the SAP system.

XRFC Services

pub.sap.rfc:decode

Converts an RFC-XML (XRFC) string into the pipeline so that is in a format that can be passed to an SAP system.

Input Parameter

xmlData String. An RFC-XML message.
bytes Optional. Byte array that contains the data to be decoded as XRFC.
node Optional. XML object that represents the XRFC data (you will get a node 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.

Return Values

$encoding Optional. Specifies the encoding used in the input document's XML header, (for example: iso-8859-1) if $encoding has not been included in the pipeline before.

Example

This service can be used when an RFC-XML document is posted to Integration Server in a variable.

pub.sap.rfc:encode

Converts an RFC call stored in the pipeline to an XML string in a format specified by the SAP RFC-XML (XRFC) specification.

Input Parameter

This service needs the RFC calls in Values representation as input.

serverName SAP system used as a repository. This name must match a configured RFC connection alias at Adapter for SAP.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1
$call Flag indicating whether pipeline represents a request or response of a function module. Possible values are:
  • true for request.
  • false for response.
$envelope Optional. XRFC, bXML, or SOAP. Specifies the type of document generated.

Return Values

xmlData String. Contains the RFC-XML representation of the RFC.
contentType The content type associated with the generated document (e.g. application/x-sap.rfc).

Example

Use this service to create RFC-XML corresponding to the pipeline and perhaps forward it to another server (for example, via HTTP). This is done in the XML transport's Outbound Process for function modules.

pub.sap.rfc:createTemplate

Creates an RFC-XML (XRFC) template for the specified function module.

Input Parameter

serverName SAP system used as a repository. This name must match a configured RFC connection alias at Adapter for SAP.
$rfcname Optional. Function module for which you want to create the template.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1
$call Flag indicating whether pipeline represents a request or response of a function module. Possible values are:
  • true for request.
  • false for response.
$envelope Optional. XRFC, bXML, or SOAP. Specifies the type of document generated.

Return Values

xmlData String. Contains the XML template that represents the RFC.

Example

Use this service to create templates for testing purposes.

IDoc Services

pub.sap.idoc:encodeSDATA

Converts every SDATA field from a Document object to a String object.

This service is usually called prior to sending an IDoc to an SAP system via pub.sap.client:invokeTransaction or by an RFC adapter service for function module "IDOC_INBOUND_ASYNCHRONOUS" or "INBOUND_IDOC_PROCESS".

Note: There is also a client service called pub.sap.client:sendIDoc that allows you to send the iDocList directly.

Input Parameter

serverName SAP system alias which is used as repository for structure information about the IDoc. The name must match a configured RFC connection alias at Adapter for SAP.
IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are Document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a Document object containing the keys and values from the segment table (the name of the segment table is specified by the SEGNAM field).

Note: This service handles both IDoc versions 2 and 3. The difference between the two is that, for IDocs version 2, the service looks for IDOC_CONTROL and IDOC_DATA in the pipeline. For IDocs version 3, it looks for IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40.
iDocList

- OR -

Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1.

Return Values

IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a 1000-byte field.

At this point, the IDoc in the pipeline is ready to be sent to an SAP system via either pub.sap.client:invokeTransaction or an adapter service for one of the function modules (IDOC_INBOUND_ASYNCHRONOUS" or "INBOUND_IDOC_PROCESS").

pub.sap.idoc:decodeSDATA

Converts the SDATA field from a String object to a Document object and immediately converts the whole list of IDocs to a com.sap.conn.idoc.IDocDocumentList object for further processing.

With Adapter for SAP 6.5 or higher, the service is only required if you receive an IDoc in the tables representation from a sending system. That is, you have created an RFC adapter notification for function module "IDOC_INBOUND_ASYNCHRONOUS" or "INBOUND_IDOC_PROCESS".

Input Parameter

serverName SAP system alias which is used as repository for structure information about the IDoc. The name must match a configured RFC connection alias at Adapter for SAP.
IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are Document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a Document object containing the keys and values from the segment table (the name of the segment table is specified by the SEGNAM field).

Note: This service handles both IDoc versions 2 and 3. The difference between the two is that, for IDocs version 2, the service looks for IDOC_CONTROL and IDOC_DATA in the pipeline. For IDocs version 3, it looks for IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1.

Return Values

iDocList Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.

pub.sap.idoc:encodeString

Converts every SDATA field from a Document object to a String object.

This service is usually called prior to sending an IDoc to an SAP system via clientInvokeTransaction or by an RFC adapter service for function module IDOC_INBOUND_ASYNCHRONOUS or INBOUND_IDOC_PROCESS.

Note: A client servicepub.sap.client:sendIDoc allows you to send the iDocList directly.

Input Parameter

serverName SAP system alias which is used as repository for structure information about the IDoc. The name must match a configured RFC connection alias at Adapter for SAP.
iDocRelease Optional. The SAP system release that the IDoc will be sent to.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1.

iDocList

- OR -

Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.
IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are Document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a Document object containing the keys and values from the segment table (the name of the segment table is specified by the SEGNAM field).

Note: This service handles both IDoc versions 2 and 3. The difference between the two is that, for IDocs version 2, the service looks for IDOC_CONTROL and IDOC_DATA in the pipeline. For IDocs version 3, it looks for IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40.

Return Values

iDocString String. The IDoc in the file port.

pub.sap.idoc:decodeString

Decodes an IDoc from a String equivalent, the format that is used by the file port of an SAP system.

Input Parameter

serverName SAP system alias which is used as repository for structure information about the IDoc. The name must match a configured RFC connection alias at Adapter for SAP.
iDocString String. The iDoc in the file port.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1.

Return Values

iDocList Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.

pub.sap.idoc:iDocToDocument

Generates a Document representation of an IDoc list to perform mappings in Flow language.

Input Parameter

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
conformsTo Name of the document structure of the IDoc. The document structure is used as a template to discriminate between documents and document lists. Without conformsTo, all tables in the hierarchical structure will be document lists.

Return Values

document IDoc in hierarchical structure.

pub.sap.idoc:documentToIDoc

Complementary service to pub.sap.idoc:iDocToDocument.

Input Parameter

document IDoc in hierarchical structure.

Return Values

iDocList Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.

pub.sap.idoc:iDocToTables

Generates the tables compatible with Adapter for SAP version 4.6 from an object compatible with Adapter for SAP version 10.1 or higher.

Do this before sending the IDoc to Adapter for SAP version 4.6 inbound transport.

Input Parameters

iDocList Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.

Return Values

IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are Document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a Document object containing the keys and values from the segment table (the name of the segment table is specified by the SEGNAM field).

Note: This service handles both IDoc versions 2 and 3. The difference between the two is that, for IDocs version 2, the service looks for IDOC_CONTROL and IDOC_DATA in the pipeline. For IDocs version 3, it looks for IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40.

pub.sap.idoc:tablesToIDoc

Complementary service to pub.sap.idoc:iDocToTables.

Input Parameters

IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are Document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a Document object containing the keys and values from the segment table (the name of the segment table is specified by the SEGNAM field).

Note: This service handles both IDoc versions 2 and 3. The difference between the two is that, for IDocs version 2, the service looks for IDOC_CONTROL and IDOC_DATA in the pipeline. For IDocs version 3, it looks for IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40.

Return Values

iDocList Contains the IDoc(s) as object of com.sap.conn.idoc.IDocDocumentList.

IDoc-XML Services

pub.sap.idoc:encode

Service that converts an IDoc list to an XML string in a format specified by the SAP IDoc-XML Specification.

Input Parameters

iDocList

- OR -

Contains the IDoc(s) as object of the type com.sap.conn.idoc.IDocDocumentList.
IDOC_CONTROL

IDOC_DATA

- OR -

IDOC_CONTROL_REC40

IDOC_DATA_REC40

Both keys are Document lists (Tables) containing the control and data tables for the IDoc.

The SDATA field is a Document object containing the keys and values from the segment table (the name of the segment table is specified by the SEGNAM field).

Note: This service handles both IDoc versions 2 and 3. The difference between the two is that, for IDocs version 2, the service looks for IDOC_CONTROL and IDOC_DATA in the pipeline. For IDocs version 3, it looks for IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1

Return Values

xmlData String. The IDoc in XML. The XML format is consistent with the SAP-XML specification.

Example

This service is most often used when you want to receive an IDoc from an SAP system and convert it to XML.

  • Invoke pub.sap.idoc:encode. This takes the pipeline containing the IDoc as input and converts it to an XML string. The XML string is accessible in the pipeline via the xmlData key.

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.

Monitoring Services

pub.sap.monitor.aleaud01:swapSenderReceiverLS

Switches Sender and Receiver (logical systems) for a list of given ALEAUD01 IDocs.

Input Parameters

iDocList List of ALEAUD01 IDocs to be switched.

Return Values

iDocList List of ALEAUD01 IDocs with switched RVCPRN and SNDPRN fields.

pub.sap.monitor.idoc:trace

Internal service used to trace the status of certain IDocs back to either the sending SAP system or to a further processing Adapter for SAP.

This service is directly called from SAP systems.

Input Parameters

SELECTION_DATE Date parameter passed to IDOC_DATE_TIME_GET on the sending SAP system.
SOURCE_SYSTEM The partner number of the sending SAP system.
T_IDOCINFO List of IDocs to be traced.

Return Values

T_IDOCINFO List of IDocs with updated trace information.

pub.sap.monitor.systat01:report

This service sends out SYSTAT01 IDocs to the sending SAP system for all IDocs that have been received in ‘Monitoring' mode.

Can be executed exactly once for the IDocs of a transaction.

Input Parameters

None.

Return Values

None.

bXML Services

pub.sap.bapi:decode

Decodes bXML documents and generates a corresponding pipeline.

Input Parameters

xmlData

- OR-

String. A document in bXML format.
bytes

- OR -

Byte array. Contains the data to be decoded as bXML.
node

XML Node object that represents the bXML data (for example, you get a node 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.

Return Values

$encoding Optional. Specifies the encoding found in the bXML document, e.g. iso-8859-1.

pub.sap.bapi:encode

Converts a BAPI call represented in a pipeline to an XML string in a format specified by the SAP bXML specification.

Input Parameters

objectName Name of the business object.
bapiName Name of the BAPI.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1.
$call Optional. Flag indicating whether pipeline represents a request or response of a function module. Possible values are:
  • true for request.
  • false for response.
$abapexception Optional. If this object is in the pipeline, an Exception document will be created.
$metabapi Optional. Contains metadata information about the BAPI, that is encoded.

Return Values

xmlData A document in bXML format as a string.

pub.sap.bapi:createTemplate

Generates a bXML document template for the definition of a BAPI in an SAP system.

Input Parameters

serverName SAP system alias for the SAP system that is used as a repository. The alias must match a configured RFC connection alias at Adapter for SAP.
objectName Name of the business object to encode.
bapiName Name of the BAPI.
$encoding Optional. Specifies the encoding used in the output document's XML header, e.g. iso-8859-1.
$call Optional. Flag indicating whether the pipeline is interpreted as a call or as a response. Possible Values are:
  • true for call.
  • false for response. Default.

Return Values

xmlData The bXML template for the BAPI as a string.

BAPI Services

pub.sap.bapi:commit

Commits a transaction with a single or multiple BAPI calls.

Note: You need to use pub.sap.client:lockSession/releaseSession to make sure to keep your connection in transaction scenarios as the transaction context is stored with the session in the SAP system.

Input Parameters

serverName Alias of the SAP system on which the transaction is committed. This name must match an RFC connection alias at Adapter for SAP.
$client Optional. Client for the session. If no client is specified, the default client is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.
wait Optional. Flag indicating if call will wait until data is really written to database.

Return Values

Return Return code in BAPI style keeping the success/failure of the commit.

pub.sap.bapi:rollback

Rolls back a transaction with a single or multiple BAPI calls.

Note: You need to use pub.sap.client:lockSession or pub.sap.client:releaseSession to keep your connection in transaction scenarios because the transaction context is stored with the session in the SAP system.

Input Parameters

serverName Alias of the SAP system on which the transaction is committed. This name must match an RFC connection alias at Adapter for SAP.
$client Optional. Client for the session. If no client is specified, the default client is used.
$user Optional. User name for the session. If no user is specified, the default user is used.
$pass Optional. Password for the session. If the password is not specified, then the user and password will be looked up in the SAP User store.
$language Optional. Language used during the session. If no language is specified, the default language is used.

Return Values

Return Return code in BAPI style keeping the success/failure of the commit.

Transaction Administration Services

pub.sap.transaction:createFunctionalPoolDriverAlias

Creates or updates the driver alias, pool alias and functional alias, and also sets the watt.sap.xtn.useSQL configuration parameter to true, which is pre-requisite to use MySQL for transaction store.

Input Parameters

driverProperties Driver specific properties.
  • driverVersion. Driver version used to connect to MySQL DB server. Possible values are 5 or 8.
poolProperties Connection pool properties.
  • hostname. Hostname of the MySQL DB server.
  • port. Port number to connect to MySQL DB server.
  • UserID. User ID to connect to MySQL DB server.
  • password. Password to connect to MySQL DB server.
updateIfExists Updates the driver alias, pool alias and functional alias, and resets watt.sap.xtn.useSQL configuration parameter to true, if already exists.

Return Values

success Message when the built-in service runs succesfully.
error Message when the built-in service fails.

pub.sap.transaction:copyTransactionsToDB

Copies the current transactions in the file transaction store into the MySQL database transaction store. When the MySQL database transaction store is enabled for the first time, the store is empty. The existing transactions in the file transaction store are now invisible and cannot be accessed anymore. Run the service to maintain and guarantee exactly once processing and enable reprocessing of failed transactions. The following existing transactions must be copied from the file to the MySQL store:

  • Transactions in the ROLLEDBACK (or CREATED) state must be copied from the file to the MySQL store.
  • Optional. Transactions in the COMMITTED state for the final CONFIRM events.
  • Transactions in the CONFIRMED state which have to be archived and accessed later on.
    Note: It is recommended to first delete or sweep all CONFIRMED transactions which are not required anymore, and then copy all remaining transactions.

The service checks for the following conditions:

  • The MySQL store must be enabled
  • All RFC listeners are disabled
  • All RFC connections are disabled
CAUTION:
Running the service without disabling the RFC listeners or RFC connections or continuing the transactional processing may result in an error or loss of the transaction state and payload changes or the changes may be incomplete or invalid.

Input Parameters

overwrite Overwrites the existing entries in the MySQL store with the transactions copied from the file store if the value is set to true. Default value is true.
sender Optional. Filter criteria: name of the sender of the transaction.
receiver Optional. Filter criteria: name of the receiver of the transaction.
msgType Optional. Filter criteria: name of the message type of the transaction.
state Optional. Filter criteria: state of the transaction.
startDate Optional. Filter criteria: Earliest creation date of the transaction. The format of this field is the same as the one defined under Settings > Logging > Log Timestamp Format.
endDate Optional. Filter criteria: Last creation date of the transaction. The format of this field is the same as the one defined under Settings > Logging > Log Timestamp Format.

Return Values

copiedTransactions Number of transactions successfully copied into MySQL store.
skippedTransactions Number of transactions not copied into MySQL store if the transaction already exists in the store. This condition is checked if the overwrite parameter is set to false.
failedTransactions Number of transactions failed to copy into MySQL store due to an error.
lastErrorMessage Optional. Detailed error description of the last error when copying the transaction.

pub.sap.transaction:list

Returns a list of transactions from the transaction store that match the filter criteria. Regular expressions are supported to allow flexible filter criteria matching. For more information of regular expressions, see IBM webMethods Service Development Help for your release.

Input Parameters

endDate Optional. Filter criteria: Last creation date of the transaction. The format of this field is the same as the one defined under Settings > Logging > Log Timestamp Format.
startDate Optional. Filter criteria: Earliest creation date of the transaction. The format of this field is the same as the one defined under Settings > Logging > Log Timestamp Format.
sender Optional. Filter criteria: name of the sender of the transaction.
receiver Optional. Filter criteria: name of the receiver of the transaction.
msgType Optional. Filter criteria: name of the message type of the transaction.
state Optional. Filter criteria: state of the transaction.
$tid Optional. Filter criteria: TID of the transaction.
$sortKey Optional. Specifies the sort key - valid:
  • noSort. Default.
  • $tid
  • sender
  • receiver
  • msgType
  • date
  • state
The resulting transaction list is sorted by the given attribute.
$dir Optional. Specifies the sort direction. Possible values:
  • descending. Triggers a descending sort order.
  • Any value other than descending. Triggers ascending sort order.

Return Values

transactions Optional. A Document List containing one document with detail information for each transaction. The following keys are always included:
  • $tid
  • sender
  • receiver
  • msgType
  • date. Date/time, when the state of this transactions was last changed, formatted in the usual "Log Timestamp Format"
  • state
$sortKey Optional. Specifies the sort key - valid:
  • noSort. Default.
  • $tid
  • sender
  • receiver
  • msgType
  • date
  • state
The resulting transaction list is sorted by the given attribute.
$dir Optional. Specifies the sort direction. Possible values:
  • descending. Triggers a descending sort order.
  • Any value other than descending. Triggers ascending sort order.

pub.sap.transaction:get

Returns detail information for a single transaction.

Input Parameters

$tid The TID of the transaction.

Return Values

sender Optional. Name of the sender of this transaction.
receiver Optional. Name of the receiver of this transaction.
msgType Optional. Name of the message type of this transaction.
state Optional. Current state of this transaction.
date Optional. Creation date of this transaction.
auditLog Optional. A Document List containing the date and message that tracks of all events that occurred during processing of this transaction.

pub.sap.transaction:storeSize

Returns the current size of the transaction store, which is the number of transaction entries in the store. The service provides the user with an efficient way to monitor the size of the store regularly to prevent it from growing out of bounds.

Input Parameters

None.

Return Values

entries Number of transaction entries in the transaction store.

pub.sap.transaction:getMessageBody

Returns the pipeline containing the actual message body.

Note: This service will only work if the storing of message bodies has not been disabled.

Input Parameters

$tid The TID of the transaction.

Return Values

None.

pub.sap.transaction:log

Adds a new audit log entry to the given transaction, and optionally changes the transaction status to the given new state.

Input Parameters

$tid The TID of the transaction.
msg Optional. Message string to be logged.
state Optional. String. Valid values are:
  • Created
  • Executed
  • Committed
  • Rolledback
  • Confirmed

Return Values

None.

pub.sap.transaction:setCacheParameter

This service sets new runtime parameters for the cache of the transaction store.

Input Parameters

writeCache Optional. State of the write cache. Possible values are:
  • On. Write cache of the transaction is switched on.
  • Any other value. Write cache of the transaction is switched off.
cacheTimeToLive Optional. This value sets the maximum time-to-live for a cache entry (value in seconds). Valid range: 0-500.
cachFlushPeriod Optional. This value sets the time period after which unmodified cache entries are flushed (value in seconds). Valid range: 0-100.

Return Values

None.

pub.sap.transaction:storeConfig

Returns the current configuration and cache parameter of the transaction store.

Input Parameters

None.

Return Values

storeType "FileTransactionStore at <directory>" for Local or Shared Transaction Store or "Remote Tx Store" for CTS.
writeCache State of the cache. Possible values are:
  • On
  • Off
cacheSize Number of entries currently held in the transaction cache.
cacheTimeToLive Current maximum time-to-live period for a cache entry (in seconds).
cacheFlushPeriod Current period after which unmodified cache entries are flushed (in seconds).

pub.sap.transaction:delete

Deletes one transaction from the transaction store.

Input Parameters

$tid The TID of the transaction.

Return values

None.

pub.sap.transaction:deleteAll

Deletes the entire transaction store. Exercise care if you choose to use this.

Input Parameters

None.

Return Values

deletedEntries Total number of deleted transactions that matched the filter criteria.

pub.sap.transaction:sweep

This service can be used to cleanup the transaction store that matches the given filter criteria.

For example, set it up in the Scheduler as follows:

  1. Create a Flow Service, which invokes pub.sap.transaction:sweep.
  2. In the Flow Service, define the inputs using Set Value.
  3. Create a scheduler job via Server > Scheduler that executes the Flow Service.

Input Parameters

elapsedTime Filter criteria: time in minutes since the transaction has been modified the last time.
maxTrxCount Optional. Maximum number of transactions to be deleted in one execution of the Service.
sender Optional. Filter criteria: name of the sender of the transaction.
receiver Optional. Filter criteria: name of the receiver of the transaction.
msgType Optional. Filter criteria: name of the message type of the transaction.
state Optional. Filter criteria: state of the transaction. Valid values are:
  • Created
  • Executed
  • Committed
  • Rolledback
  • Confirmed

For more information about cleaning the transaction store, see Automatic Cleanup of the Transaction Stores.

Return Values

deletedEntries Total number of deleted transactions that matched the filter criteria.

Transport Services

pub.sap.transport.ALE:InboundProcess

Receives an IDoc and forwards it to the routing listener.

Input Parameters

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList
$tid Optional. The TID of the transaction.
$action Optional. One of the following transaction codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

None.

pub.sap.transport.ALE:OutboundProcess

Sends an IDoc to an SAP system.

Important: If $action is set to 4, this service behaves the same as service pub.sap.client:confirmTID.

Input Parameters

serverName Optional. Alias of the SAP system to which the connection is established. The name must match a configured RFC connection alias at Adapter for SAP.

If serverName is set, it will override the value of transportParams/serverName.

transportParams A document with the following key/value pair:
serverName SAP system alias for the SAP system on which invoke the RFC. The alias must match a configured RFC connection alias at Adapter for SAP.
iDocList Optional. Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
$tid Optional. The TID of the transaction.
$action One of the following transaction codes:
  • 1 - Execute (default)
  • 4 - Confirm
Run the service in the following order:
  1. With $action set to 1 or empty to send the IDoc to the SAP system.
  2. For the same value of $tid and $action set to 4 to inform the SAP system that the transaction is complete.
$queueName Optional. Name of the SAP system IDoc inbound queue. Specify a value in case of an ALE queuing scenario.

Return Values

$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$rfctime Time (ms) spent within the RFC library to complete the invocation.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether pipeline represents a request (true) or a response (false) of a function module.

pub.sap.transport.ALE:getRoutingInfo_Default

Default service to retrieve routing information from a list of IDocs.

Note: This service can also handle IDOC_CONTROL and IDOC_DATA record lists (for IDocs version 3) or IDOC_CONTROL_REC_40 and IDOC_DATA_REC_40 record lists (for IDocs version 4) as IDoc input parameters instead of iDocList.

Input Parameters

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.

Return Values

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
sender Retrieved from sender partner number from the header of the first IDoc.
receiver Retrieved from receiver partner number from the header of the first IDoc.
msgType Retrieved from message type from the header of the first IDoc.

pub.sap.transport.IS:InboundProcess

Receives a message from a remote Integration Server and forwards it to the routing listener, which determines the routing notification to use to route the message based on the sender, receiver, and message type specified in the input parameters.

After determining the routing notification to use, it invokes the flow service that processes the matching routing notification. This can be called with an arbitrary message to pass it on to the routing listener.

Important: It is recommended that you use this service as the receiving point when you are connecting two Integration Servers.

Input Parameters

In addition to the parameters specified below, the input parameters must also include the message to be routed through Adapter for SAP. Use a key for the message that the outbound transport expects.

sender Sender of a message.
receiver Receiver of the message.
msgType Message type of the message.
$tid Optional. TID of the transaction.
$action Optional. One of the following transaction codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

Depends on transaction and invoked routing notification.

pub.sap.transport.IS:OutboundProcess

Invokes a service on a local or remote IBM webMethods Integration Server.

Input Parameters

transportParams A Document with the following key/value pairs.
Key Value
folderName Folder name for the service to invoke.
serviceName Name of the service to invoke.
serverAlias Optional. Alias of IBM webMethods Integration Server on which the service is to be invoked.

To invoke a service on a remote server:

  • Specify the alias for the remote server. The default value is local, which indicates the local server. Use local to invoke a service on the local server that is not password protected.
  • To invoke a password protected service on the local server, set up an alias for the local server, specifying a user name and password that has access to the password protected service. Then, specify that alias name.
valueScope Optional. The scope for the session. SESSION indicates the connection is to be saved in your own session. GLOBAL indicates the connection is to be saved in a shared area. Use SESSION when the work being performed requires state be maintained.
data Pass the message data to this record. If data is not set, the complete pipeline will be passed to the receiving service.
$tid Optional. Transaction ID. Specify a transaction ID if the document should be sent as a transaction.
$action Optional. One of the following transaction codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

The pipeline contains the result of the service that was invoked.

pub.sap. transport.RFC:InboundProcess

Receives an inbound RFC or an RFC-XML document that is to be routed through Adapter for SAP.

Input Parameters

This service requires the following input parameters:

sbcHeader Values object that represents the key/value pairs in the SBCHEADER table. For information about what to include in the array of records, refer to The SBCHEADER Table.
$rfcname Optional. The name of the function module.
$tid Optional. TID of the transaction.

If you want to process the RFC call asynchronously using tRFC, specify the transaction ID. If you would like to perform a synchronous RFC call, do not specify this parameter.

$action Optional. Transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

Depends on transaction and invoked routing notification.

pub.sap.transport.RFC:OutboundProcess

Invokes an RFC on an SAP system.

This service can handle both RFC and tRFC calls.

Input Parameters

This service requires the following input parameters:

serverName Optional. Alias of the SAP system to which the connection is established. The name must match a configured RFC connection alias at Adapter for SAP.

If serverName is set, it will override the value of transportParams/serverName.

transportParams A document with the following key/value pair.
Key Description
serverName SAP system alias for the SAP system on which invoke the RFC. The alias must match a configured RFC connection alias at Adapter for SAP.
$tid Optional. TID of the transaction.

If you want to process the RFC call asynchronously using tRFC, specify the transaction ID. If you would like to perform a synchronous RFC call, do not specify this parameter.

$action Optional. Transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm
$rfcname Optional. RFC that is called.
$queueName Optional. Name of the SAP system inbound queue. Specify a value in case of a qRFC scenario.

Return Values

$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$rfctime Time (ms) spent within the RFC library to complete the invocation.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether pipeline represents a request (true) or a response (false) of a function module.

pub.sap.transport.XML:InboundProcess

Can be called (e.g. using HTTP post) with arbitrary XML documents to pass them on to the routing listener.

Input Parameters

This service requires the following input parameters:

node XML Node object that can be generated by calling pub.xml:xmlStringToXMLNode and is automatically generated when posting an XML document via HTTP (using text/xml).
$tid Optional. TID of the transaction.
$action Optional. Transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

Depends on transaction and invoked routing notification.

pub.sap.transport.XML:OutboundProcess

Use this service to post an XML document to a specified URL.

This transport service includes pub.client:http that performs HTTP POST. The XML transport is basically used for posting XML documents to external Web servers. If you want to communicate with another IBM webMethods Integration Server, you can use pub.remote:invoke.

Input Parameters

This service requires the following input parameters:

transportParams A document with the following key/value pair.
Key Description
url The URL to which to post the document.
xmlType The XML dialect to use. Specify Values-XML if you want the XML in webMethods native XML format.
  • Specify SAP-XML if you want the XML in a format that is compliant with the SAP XML specification. For an IDoc, IDoc-XML is used; for an RFC, RFCXML (XRFC) is used. Note that the IDoc must be available as input to this service.
  • Arbitrary XML allows to post any XML document.
  • SOAP XRFCcan be selected as additional XML dialect. This equals to XRFC (RFC-XML) with a SOAP envelope (higher than SOAP 1.1).
useTextXml Optional. Flag that overwrites the content-type of bXML, XRFC and IDoc-XML to text/xml, if set to true.
useUTF8 Optional. Flag that allows to force the XML rendering engines to use UTF-8 as encoding for the resulting documents.
httpUser Optional. User name to supply for a user name/password authentication challenge.
httpPassword Optional. Password to supply along with httpUser for a user name/password authentication challenge.
useBAPI ON or OFF. If set to ON, the pipeline is encoded using bXML for Business Objects.
objectName Name of the business object, to which the call is mapped.
bapiName Name of the BAPI method, to which the call is mapped.
xmlData Optional. An XML document as string, only used if transportParams/xmlType is Arbitrary XML.
$encoding Optional. Encoding used by the XML request document.
$tid Optional. Transaction ID. Specify a transaction ID if the document should be sent as a transaction.
$action Optional. Transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

The return values depend on the document that is posted. The return value is a Values object representation of the answer to the posted document.

pub.sap.transport.BAPI:InboundProcess

When posting bXML documents representing a BAPI of a Business Object to this service, it will take care of passing the document to the routing listener.

Input Parameters

sbcHeader Document that contains the key/value pairs with routing information. Will be generated by the bXML parser.
objectName Optional. Name of the business object that is represented in the pipeline.
bapiName Optional. Name of the BAPI that is represented in the pipeline.
$action Optional. Transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm
$tid Optional. TID of the transaction.

Return Values

Depends on transaction and invoked routing notification.

pub.sap.transport.BAPI:OutboundProcess

Executes a BAPI in an SAP system. This transport service can handle both asynchronous and synchronous execution of a BAPI.

Input Parameters

serverName Optional. Alias of the SAP system to which the connection is established. The name must match a configured RFC connection alias at Adapter for SAP.

If serverName is set, it will override the value of transportParams/serverName.

transportParams A document with the following key/value pair.
Key Description
serverName SAP system alias on which to execute the BAPI. The alias must match a configured RFC connection alias at Adapter for SAP.
mode Allows to restrict the way how the BAPI can be invoked:
Value Meaning
no restrictions Will be executed as the client requested.
synchronous only Only synchronous call is allowed, if client passes a $tid (indicating an asynchronous call) an exception is thrown.
asynchronous only Only asynchronous call is allowed, if client does not pass a $tid (indicating a synchronous call) an exception is thrown.
$tid Optional. TID of the transaction.
$action Optional. Transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm
$queueName Optional. Name of the SAP system inbound queue. Specify a value in case of a qRFC scenario.
objectName Optional. Name of the business object.
bapiName Optional. Name of the BAPI method.

Return Values

A pipeline that represents the response or an exception of the executed BAPI.

$metabapi Optional. Document created if the BAPI was executed. Contains the BAPI metdata (for example, the internal name, the external name, and the RFC name). It also contains information about whether it is static (yes/no), dialog (yes/no), or factory BAPI (yes/no).
$abapexception Optional. Document created if the execution of the BAPI caused one or more ABAP exceptions with severity of 3 or higher. The document contains the name, the severity, and the message attributes of the general BAPI failure. It also contains the document attributes that contain the complete collection of all exceptions that have occurred during execution of the BAPI, with a detailed description and the message attributes for each exception.
$runtime Total invocation time (ms), including processing time within Adapter for SAP.
$rfctime Time (ms) spent within the RFC library to complete the invocation.
$encoding MIME-compliant character set corresponding to the session's SAP code page.
$call Flag indicating whether pipeline represents a request (true) or a response (false) of a function module.

Specifications

pub.sap.listener:listenerAuthorizationCheck

To provide application specific authorization handling with SNC enabled RFC servers (listeners), the user might provide a service that implements this specification.

This service will be called by the RFC server (listener) to check for authorization.

This service has to return "Granted" in the "access" field if the request is accepted. If no service is specified access will be granted. If an exception happens during execution of this service or a different string than "Granted" will be returned the access will be denied.

Input Parameters

functionName Function that has been called by a remote client.
partnerName Partner (system) name where the request comes from.
key Authorization key as binary data depending on the mode.
mode Mode of the authorization: ("SNC" = Secure Network compliant authorization, "Basic" = Basic authorization). Currently, mode will always be Secure Network compliant authorization ("SNC").

Return Values

access Returns "granted" if the request is accepted.

pub.sap.transport.ALE:aleRoutingInfo_Default

To allow content based routing for all IDocs, the user might provide a service that implements this specification.

This service will be called prior to selecting the right routing notification by the routing listener.

Input Parameters

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.

Return Values

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
sender Contains the sender value as determined by this ALE default routing info service.
receiver Contains the receiver value as determined by this ALE default routing info service.
msgType Contains the message type value as determined by this ALE default routing info service.

pub.sap.transport.ALE:aleRoutingInfo

To allow message type specific content based routing, the user might provide a service that implements this specification.

This service will be called prior to selecting the right routing notification by the routing listener but after the default ALE routing info service was called.

Input Parameters

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
sender Contains the sender value as determined by this ALE default routing info service.
receiver Contains the receiver value as determined by this ALE default routing info service.
msgType Contains the message type value as determined by this ALE default routing info service.

Return Values

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
sender Contains the sender value as determined by this ALE default routing info service.
receiver Contains the receiver value as determined by this ALE default routing info service.
msgType Contains the message type value as determined by this ALE default routing info service.

pub.sap.transport.ALE:aleMappingInfo_Default

To allow mapping for all IDocs, the user might provide a service that implements this specification.

This service will be called prior to sending an IDoc to an SAP system using the pub.sap.transport.ALE:OutboundProcess service.

Input Parameters

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.

Return Values

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
msgType Contains the message type value as determined by this ALE default routing info service.

pub.sap.transport.ALE:aleMappingInfo

To allow message type specific mapping for IDocs, the user might provide a service that implements this specification.

This service will be called prior to sending an IDoc to an SAP system using the pub.sap.transport.ALE:OutboundProcess service but after the default ALE mapping info service was called.

Input Parameters

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.
msgType Contains the message type value as determined by this ALE default routing info service.

Return Values

iDocList Contains the IDoc(s) as an object of the type com.sap.conn.idoc.IDocDocumentList.

pub.sap.transport.XML:xmlRoutingInfo

To allow routing for incoming XML documents, the user must provide a service that implements this specification.

This service will be called prior to selecting the right routing notification by the routing listener.

Input Parameters

node

- OR -

XML Node object that can be generated by calling pub.xml:xmlStringToXMLNode and is automatically generated when posting an XML document via HTTP (using text/xml).
document XML in hierarchical structure.

Return Values

document XML in hierarchical structure.
sender Contains the sender value as determined by this XML routing info service.
receiver Contains the receiver value as determined by this XML routing info service.
msgType Contains the message type value as determined by this XML routing info service.
$tid TID of the transaction as determined by this XML routing info service.
$action Optional. The transaction state as determined by this XML routing info service. One of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm

Sample Services

sample.sap:handleIDocXMLPost

Submit an IDoc-XML message to ALE InboundProcess on Adapter for SAP.

Input Parameters

xmlData String. The XML message of the IDoc document to be sent. Required.
$action Optional. The transaction state. Specify one of the following codes:
  • 1 - Execute (default)
  • 4 - Confirm

Return Values

None.

sample.sap:handleRfcXMLPost

Submit an RFC-XML or bXML message to an SAP system to invoke the associated RFC function.

Input Parameters

serverName String. The alias for the SAP system on which to execute the RFC. The alias must match a configured RFC connection alias at Adapter for SAP.
xmlData String. The XML message of the RFC-XML document.
$envelope Optional. bXML or RFC-XML, document type used for the post.

Return Values

xmlData XML message representing the response of the function module.
Note: This service is designed only for executing function modules that do not require an explicit commit.

sample.sap:handlebXMLPost

Submits a bXML message to an SAP system to invoke the associated BAPI.

Input Parameters

serverName The alias for the SAP system on which to execute the RFC. The alias must match a configured RFC connection alias at Adapter for SAP.
xmlData String. The XML message of the RFC-XML document.
mode Allows you to choose the way how the BAPI will be invoked:
Value Meaning
sync synchronous execution
async asynchronous execution
routing apply routing matching routing info in the document

Return Values

xmlData XML document representing the response of the BAPI.
Note: This service is designed only for executing BAPIs that do not require an explicit commit.

sample.sap.Helpers:writeSAPXMLFile

This service will convert RFCs or IDocs coming from an SAP system to SAP-XML (IDoc-XML or RFC-XML) and write the result to an output file in the WmSAP/pub directory.

To call it, create a routing notification, and assign it this service.

Input Parameters

None.

Return Values

None.

sample.sap.Helpers:returnABAPException

This service returns a JCO AbapException exception that is used by the service implemented at Integration Server. By adding an invoke statement to the sample service you can easily return an ABAP exception from Flow. The sample also demonstrates how to return an ABAP exception from within a Java service.

Input Parameters

key The key for the exception that is specified in the function interface.
message Optional. Additional descriptive error message.

Return Values

None.

sample.sap.Helpers:invokeBapiReturningBXml

This internal service is invoked by handleBXmlPost.

Input Parameters

serverName Alias for the SAP system on which to execute the BAPI. The alias must match a configured RFC connection alias at Adapter for SAP.
mode Allows you to choose the way how the BAPI will be invoked. Possible values are:
  • sync -synchronous execution
  • async - asynchronous execution
  • routing - apply routing matching routing info in the document

Return Values

xmlData XML message representing the response of the BAPI.

sample.sap.Helpers:invokeAndReturnXml

This internal service is invoked by handleRfcXmlPost.

Input Parameters

serverName The SAP connection alias for the SAP server on which to execute the function module. The alias must match a configured SAP connection on Adapter for SAP.
$rfcName Name of the function module to be invoked.
$tid Optional. Specify TID for transactional invoke.
$envelope Optional. Set to "bXML" to encode the results of the function module call in bXML format.

Return Values

xmlData XML message representing the response of the function module

sample.sap.Helpers:encodeRPCResponse

Sample service used to encode a Document (<key/value> pairs) as RPC-XML message.

Input Parameters

document Document containing key/value pairs.

Return Values

xmlData RPC-XML string representing the input document.

sample.sap.idoc.Mappings:orders

Example service for content-based routing of ORDERS IDocs.

The service determines routing information (sender, receiver, msgType) for the given IDoc of type ORDERS.

For the description of input parameters and return values, please see service specification pub.sap.transport.ALE:aleRoutingInfo.

sample.sap.idoc.Mappings:ordrsp

Example service for mapping ORDRSP IDocs. The service does some mapping of fields for the given ORDRSP IDoc.

For the description of input parameters and return values, please see service specification pub.sap.transport.ALE:aleMappingInfo.

SAP Listener Services

pub.sap.listener:getAttributes

Returns information specific to one RFC server connection session:

Input Parameters

None.

Return Values

Document named rfcAttributes containing specific information about one RFC connection session:

destination String. Destination of the connection.
ownHost Hostname (or IP) of the machine Integration Server is running on.
partnerHost Hostname (or IP) of the machine the SAP system is running on.
systemNumber System number of the SAP system.
systemID Unique three-letter-ID of SAP system (in local network).
client Client the session is connected to.
user SAP user that has connected with this session.
language Logon language.
SOLanguage ISO name for logon language.
ownCodepage SAP codepage this connection is using.
partnerCodepage SAP codepage the SAP system is running on.
ownRelease Version of the loaded RFC library used by Adapter for SAP.
partnerRelease Release of the SAP system.
kernelRelease Kernel release of the SAP system.
partnerType RFC type of the partner; SAP ECC(3), R/2(2) or external RFC server(E).
trace Flag indicating whether trace is turned on (true) or off (false) for this connection.
ownType RFC type of Adapter for SAP; is always be E.
rfcRole Role of Adapter for SAP in this call; is always be: C (for client).
CPICConversationID CPIC ID of the connection (low level protocol information).
encoding IANA-encoding that is equivalent to the SAP codepage used, for example: ISO-8859-1.
charset Charset that is equivalent to the SAP codepage used, for example: ISO8859_1 (used in Java constructors).
bytesPerChar Number of maximum bytes used per char in the codepage.

SAP Utility Services

pub.sap.util:createTID

Call this service if you want to obtain a transaction ID (TID; which is a GUID) that conforms to the format of SAP TIDs even when not connected to a SAP system. The Transaction ID is based on a randomly created UUID Version 4.

The obtained TID can be used as an input value for pub.sap.client:invokeTransaction, pub.sap.client:sendIDoc, and pub.sap.client:confirmTID.

Input Parameters

None.

Return Values

$tid Contains the TID.

Example

This service is used in tRFC client scenarios, which require a transactional ID (TID) uniquely identifying the transaction. See also pub.sap.client:confirmTID.

pub.sap.util:getListenerRuntimeStatus

Returns the current runtime state and configuration of an enabled RFC listener instance.

Input Parameters

alias String. Required. Node name of the RFC listener instance for which you want to obtain the runtime state.

Return Values

runtimeState String. Describes the current runtime state of the selected RFC listener. Possible values are:
  • Started
  • Stopping
  • Stopped
  • Alive
  • Alive, but ping failed
  • Dead
  • HA Broken
pingMessage String. Result of the ping test from the SAP Gateway to the RFC listener instance.
pingLatency String. Ping latency in milliseconds, if the ping test was successful.
activeThreads String. Number of listener threads currently available, if the RFC listener instance is enabled.
busyThreads String. Number of listener threads currently busy, if the RFC listener instance is enabled.
maxBusyThreads String. Maximum number of listener threads which are concurrently busy, if the RFC listener instance is enabled.
$error String. Error message:
  • If the RFC listener instance for the given alias input does not exist.
  • If the RFC listener instance is disabled.
  • If an error has occurred.
$warning String. Additional information in the case of error, along with hints to fix it.

IBM webMethods Adapter for SAP IDoc Java API

See packages_directory\WmSAP\pub\doc\api\index.html.