RFC Calls
This section outlines the details of the mapping parameter used to invoke SAP function modules through RFC calls. It describes how to map the Import and Export parameters of an SAP function module to content repository properties and how to handle errors or success cases.
To use RFC calls to invoke any SAP function module, make sure to have the SAP NetWeaver RFC SDK installed and mapped into the running container.
It is only possible to call SAP function modules that are marked as Remote Enabled
in their definition.
Parameter Overview
The main parameter to specify the RFC mapping.
Parameter | Mandatory | Type | Description |
---|---|---|---|
type | Yes | string | The connection type to be used for invoking SAP. Since this chapter describes RFC calls, use the value rfc . |
sapFunctions | Yes | Object | The object containing the property assignments such as SAP function module name and its import parameter, export parameter and mapping to the content repository properties. Refer below to section Parameter sapFunctions. |
success | Yes | Object | Handle the success case of the SAP return. Refer below to section Parameter success. |
failure | Yes | Object | Handle the error case of the SAP return. Refer below to section Parameter failure. |
Parameter sapFunctions
This parameter, a subset of the mapping parameter, includes the assignments of all properties from the repository that must be mapped to the import parameters of the SAP function module. It also manages the return mapping, which involves determining which properties from the result should be mapped to specific properties of the document in the repository.
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | string | The name of the remote-enabled SAP function module that should be invoked. The sapFunctions parameter allows you to invoke multiple SAP function modules. |
importParams | Yes | Content Property | Handles the mapping of all import parameters of the SAP function module. Refer below to section Parameter importParams . |
exportParams | Yes | Content Property | Handles the mapping of all import parameters of the SAP function module. Refer below to section Parameter exportParams . |
Parameter importParams
This parameter defines the mapping between repository properties and import parameter of the SAP Function Module using a list of Content Properties. In case of importParams, the source
is a property from the repository and the target
is a name of an import parameter of the SAP function module.
The example below is split by repository, as each repository requires its own syntax to access its properties.
- Hyland Nuxeo
- Microsoft SharePoint Online
Invoke the SAP function module ARCHIV_GET_CONNECTIONS
and set the import parameter ARCHIV_ID
to the value of the Nuxeo property archiveId
, and ARC_DOC_ID
to the value of docId
from the current document. Assumption: both Nuxeo properties are part of the fct_sap
facet.
If you need to store a value in a property belonging to a facet not yet applied to the current document, enter the facet name followed by a colon and the property name. This action adds the facet and stores the value.For example, archiveId
is a property on the fct_sap
facet that is not yet available on the document. In this case, the correct syntax for the source
is fct_sap:archiveId
, as shown below.
mapping:
type: rfc
sapFunctions:
- name: ARCHIV_GET_CONNECTIONS
importParams:
- target: ARCHIV_ID
source: fct_sap:archiveId
- target: ARC_DOC_ID
source: fct_sap:docId
Invoke the SAP function module ARCHIV_GET_CONNECTIONS
and set the import parameter ARCHIV_ID
to the value of the property SAPArchiveID
, and ARC_DOC_ID
to the value of SAPDocumentID
from the current document.
mapping:
type: rfc
sapFunctions:
- name: ARCHIV_GET_CONNECTIONS
importParams:
- target: ARCHIV_ID
source: SAPArchiveID
- target: ARC_DOC_ID
source: SAPDocumentID
Parameter exportParams
This parameter defines the mapping between repository properties and export parameters of the SAP Function Module using a list of Content Properties. In case of exportParams, the source
is a name of an export parameter from the SAP function module return and the target
is a property in the repository.
If the export parameter of the SAP function module is a table or structure, access the required property within it using JSON syntax.
The example below retrieves the result from the SAP function module ARCHIV_GET_CONNECTIONS
and sets the values OBJECT_ID
and SAP_OBJECT
to the content repository. Since SAP returns the required values within a table called CONNECTIONS
, it must be accessed by JSON syntax as followed: CONNECTIONS.0.OBJECT_ID
.
- Hyland Nuxeo
- Microsoft SharePoint Online
Be sure to always specify the facet name to which the desired property belongs.
Syntax must be facetName:propertyName
for target
.
mapping:
type: rfc
sapFunctions:
- name: ARCHIV_GET_CONNECTIONS
importParams:
...
exportParams:
- source: CONNECTIONS.0.OBJECT_ID
target: fct_sapInfo:sapObjectId
- source: CONNECTIONS.0.SAP_OBJECT
target: fct_sapInfo:sapObject
Be sure to always specify the name of the SharePoint content type to which the desired property belongs.
The syntax must be ContentTypeName:propertyName
for target
.
mapping:
type: rfc
sapFunctions:
- name: ARCHIV_GET_CONNECTIONS
importParams:
...
exportParams:
- source: CONNECTIONS.0.OBJECT_ID
target: 'SAP Replicate:SAPObjectID'
- source: CONNECTIONS.0.SAP_OBJECT
target: 'SAP Replicate:SAPObject'
Content Property
Specification of the available content properties used for importParams, exportParams, success and failure above.
Parameter | Mandatory | Type | Default | Description |
---|---|---|---|---|
source | Yes | String | For exportParams it must be a list property in the YAML syntax (requires a hyphen as prefix). For importParams, depending on the constant or script setting below, the value can either be a hardcoded or parsed/formatted by Javascript. | |
target | Yes | String | Same explanation as above - but reversed: For importParams it must be a list property in the YAML syntax (requires a hyphen as prefix) and for exportParams the constant or script has effect. | |
constant | No | Boolean | false | Set true to return a constant value in source (for importParams, success or failure) or target (for exportParams, success or failure). Set false to return a value based on the return of the SAP function module. |
script | No | String | Modify the value using JavaScript functionality before sending or after retrieving it, for instance, by parsing (for exportParams) or formatting (for importParams) the value. Refer to section Using script parameter below. | |
metricLabel | No | String | Available only for exportParams! Set the label that can be evaluated by Prometheus. It must contain only lowercase letters and cannot contain whitespaces. Refer to the Metrics chapter in the installation section. |
Using script parameter
Use the script parameter to modify the value using JavaScript functionality. This is beneficial when the value requires parsing and formatting to meet a specific format. Handling Date objects and Boolean values are examples of situations where this parameter can be effectively utilized.
The following properties will be passed to the script, allowing them to be accessed within it.
Do not override the properties below!
Parameter | Description |
---|---|
logger | The logger instance. Can be used to log various activities within the script. |
props | The properties of the current document being processed by the function module. |
now | The current time. |
nowUtc | The current time in UTC. |
Parse | Function to parse the value to a date object. Example: Parse("2006-01-02T15:04:05Z07:00", value) . Refer to Reference Template section. |
Format | Function to format the value to match the target format. Example: Format("20060102", value) . Refer to Reference Template section. |
content | The content of the currently processed property in the configuration includes target , content , and, if present, script and constant . |
value | The value from the target parameter when used in the context of importParams, or from the source parameter in the context of exportParams. |
Example 1: Mapping a Date to SAP.
In SAP ABAP, the type for date fields is DATS, which is designed for calendar dates in the format YYYYMMDD
. This means that the value from the storage system must often be parsed and formatted before it's possible to pass it to SAP.
- Hyland Nuxeo
- Microsoft SharePoint Online
Nuxeo example which maps the dc:created
value to the AR_DATE
import parameter via the script parameter using Parse() and Format() from the table above.
...
sapFunctions:
- name: ARCHIV_CONNECTION_INSERT
importParams:
- target: AR_DATE
source: dc:created
script: |
var d = Parse("2006-01-02T15:04:05Z07:00", value);
Format("20060102", d);
...
Microsoft SharePoint Online example to map a date to SAP. TBD
Example 2: Mapping to send a Boolean value to SAP.
In SAP ABAP, the concept of a Boolean
data type does not exist. Instead, ABAP uses integer types or character types to represent boolean values. Typically, a single character type CHAR(1)
is used, with 'X'
representing true and a space ' '
representing false.
- Hyland Nuxeo
- Microsoft SharePoint Online
Nuxeo example to pass a Boolean value as a string, where true
= X
and false
= empty, to the import parameter LATE
of structure DOCUMENT_ENTRY
:
...
sapFunctions:
- name: ARCHIV_PROCESS_RFCINPUT
importParams:
- target: DOCUMENT_ENTRY.LATE
source: sapStartWorkflow:sapLateArchiving
script: 'value === true ? "X" : ""'
...
Microsoft SharePoint Online example to pass a Boolean value as a string. TBD
Handling Results in Success or Error Cases
To handle the result of the SAP function module call, the success
and failure
parameters are available. For example, in the case of success, it can be used to establish an exclusion criterion that prevents subsequent task runs from reprocessing the same document. In the case of error, it can store a detailed error message from SAP (if provided).
Always use two properties in the content model of the connected storage system to handle results for both success and failure cases. Use one of the properties to store a status value, such as Success or Connected to SAP and the other property to store any additional detailed message.
Parameter success
This property can be utilized to manage the return of the SAP function module call in case it was successful.
For instance, it can be employed to establish an exclusion criterion that prevents subsequent task runs from reprocessing the same document.
The generic example below sets the value of the existing property cmProp_TaskStatus
in the content model to Success and the value of property cmProp_TaskMessage
to No Error. Because both values are fixed, you must add constant: true
(refer the section above on Content Property).
success:
- source: 'Success'
constant: true
target: 'cmProp_TaskStatus'
- source: 'No Error'
constant: true
target: 'cmProp_TaskMessage'
Parameter failure
Similar to the success parameter mentioned above, but it is used to handle any errors returned by the SAP function module.
The example below sets the value of the existing property cmProp_TaskStatus
in the content model to Error and the value of property cmProp_TaskMessage
to the error message provided by the return of the SAP NWRFC SDK.
failure:
- source: 'Error'
constant: true
target: 'cmProp_TaskStatus'
- source: ErrorInfo.Message // See 'RfcError Specification' -> 'Reference Path' below.
constant: false
target: 'cmProp_TaskMessage'
RfcError Specification
In case of any error, the SAP NWRFC SDK returns a structure with properteries defined as followed.
You can access each of the properties by specifying the Reference Path in property source
.
Parameter | Reference Path | Description |
---|---|---|
Message | ErrorInfo.Message | This is the general error message describing what went wrong. |
Code | ErrorInfo.Code | A unique identifier for the error type, often numeric or alphanumeric, e.g. ECONN001 . |
Key | ErrorInfo.Key | A key that uniquely identifies the error, typically used for grouping similar types of errors. |
AbapMsgClass | ErrorInfo.AbapMsgClass | Identifies the class of the message in ABAP which groups messages that share a context, e.g. 00 (General Messages) |
AbapMsgType | ErrorInfo.AbapMsgType | Specifies the type of ABAP message, indicating its nature, e.g., error, warning, success, e.g. E (Error), A or X . |
AbapMsgNumber | ErrorInfo.AbapMsgNumber | The specific number of the ABAP message within its class, identifying the exact message, e.g. 001 , 344 . |
AbapMsgV1 | ErrorInfo.AbapMsgV1 | The first variable part of the ABAP message that can be inserted dynamically into the message text to provide specific details, corresponds to SY-MSGV1 . |
AbapMsgV2 | ErrorInfo.AbapMsgV2 | The second variable part of the ABAP message, used similarly to AbapMsgV1 for dynamic content insertion. Corresponds to SY-MSGV2 . |
AbapMsgV3 | ErrorInfo.AbapMsgV3 | The third variable component of the ABAP message, further detailing the message as needed. Corresponds to SY-MSGV3 . |
AbapMsgV4 | ErrorInfo.AbapMsgV4 | The fourth and typically final variable component of the ABAP message, completing the dynamic information required to understand the context or specifics of the issue. Corresponds to SY-MSGV4 . |