The OutSystems SAP Extensibility API is a .NET and Java API that enables you to customize your connection and calls to SAP remote functions through an extension. See more about how to develop an OutSystems extension.
To be able to use this API, you need to have these files in your extension:
Optional: to access elements defined in namespaces, without having to write the whole namespace, you can include the following namespaces into your extension classes: OutSystems.RuntimePublic.SAP and SAP.Middleware.Connector.
Setup the extension:
Implement the .NET code:
Use the extension:
The available classes in the SAP Extensibility API are:
The object with information about the connection established when calling an SAP Remote Function Call. With the methods available in this class you can check and modify the connection parameters of the SAP connection being used to call a remote function call, e.g. you can change the authentication method to use SAP Logon Ticket instead of the method chosen in the development environment.
To handle the connection configurations, create an extension module, and use its methods in the 'OnBeforeConnection' callback action of the SAP connection.
Method |
Description |
static SAPConnection GetCurrent() |
Returns the object with the configurations used to establish the connection to call an SAP remote function, when invoked inside the 'OnBeforeConnection' callback action of the SAP connection. Otherwise, returns null. |
SAP.Middleware.Connector.RfcConfigParameters GetRfcConfigParameters() |
Returns the SAP connector SAP.Middleware.Connector.RfcConfigParameters object, with the configurations used in the connection established to call an SAP remote function. |
void SetRfcConfigParameters(SAP.Middleware.Connector.RfcConfigParameters rfcConfigParameters) |
Sets the SAP connector object SAP.Middleware.Connector.RfcConfigParameters object, with configurations used in the connection established to call an SAP remote function. |
This follow example shows how you can use the SAPConnection class to change the configuration of your connection to the SAP in order to call the remote functions, with the logon ticket instead of a username and password.
The object with information about the connection's context when calling an SAP Remote Function Call. With the methods available in this class you can adjust and control the flow of an SAP Remote Function Call, e.g. you can adjust a connection to call multiple sap remote functions in the same context instead of only one.
To handle the connection's context, create an extension module, and use its methods in the 'OnBeforeCall' and 'OnAfterCall' callback actions of the SAP connection.
Method |
Description |
static void BeginContext() |
Begins a stateful call sequence allowing the user to orchestrate two or more remote function calls in the same context. |
static void Commit() |
Commits the changes made so far in the stateful call sequence by calling the remote function 'BAPI_TRANSACTION_COMMIT'. |
static void EndContext() |
Ends a stateful call sequence. Must be placed after a beginContext() method. |
static void Rollback() |
Rolls back any changes made so far in the stateful call sequence by calling the remote function 'BAPI_TRANSACTION_ROLLBACK'. |
This example shows how you can have a stateful connection with SAP using the SAPContext class. It defines the begin and end of the context, as the commit and rollback of the changes made so far.
The object with information about the request of an SAP remote function call. With the methods available in this class you can adjust the parameters sent and received from the SAP Remote Function Calls, e.g. customize the received parameters values returned by SAP to show them differently to the end user.
To handle the remote function parameters, create an extension module, and use its methods in the 'OnBeforeCall' and 'OnAfterCall' callback actions of the SAP connection.
Method |
Description |
static SAPRequest GetCurrent() |
Returns the object with information about the current SAP remote function call, when invoked inside the 'OnBeforeCall', or 'OnAfterCall' callback actions of the SAP connection. Otherwise, returns null. |
SAP.Middleware.Connector.IRfcFunction GetIRfcFunction() |
Returns the SAP connector SAP.Middleware.Connector.IRfcFunction object, with the metadata and the parameters value for the current SAPRequest. |
This example shows how you can adjust the input parameters values when calling an SAP remote function. For that we will get the remote function metadata of the 'Bapi_Customer_Getlist', and ensure that the customer id we are sending to SAP has 9 digits as the SAP internal value for this parameter. If not, we will add trailing zeros to the parameter value till it has the 9 digits.
To be able to use this API, you need to have these files in your extension:
Optional: to access elements defined in namespaces, without having to write the whole namespace, you can include the following packages into your extension classes: outsystems.runtimepublic.sap and com.sap.conn.
Setup the extension:
Implement the Java code:
Use the extension:
The available classes in the SAP Extensibility API are:
The object with information about the connection established when calling an SAP Remote Function Call. With the methods available in this class you can check and modify the connection parameters of the SAP connection being used to call a remote function call, e.g. you can change the authentication method to use SAP Logon Ticket instead of the method chosen in the development environment.
To handle the connection configurations, create an extension module, and use its methods in the 'OnBeforeConnection' callback action of the SAP connection.
Method |
Description |
static SAPConnection getCurrent() |
Returns the object with the configurations used to establish the connection to call an SAP remote function, when invoked inside the 'OnBeforeConnection' callback action of the SAP connection. Otherwise, returns null. |
java.util.Properties getDestinationProperties() |
Returns the Java java.util.Properties object, with the configurations used in the connection established to call an SAP remote function. |
void setDestinationProperties(java.util.Properties destinationProperties) |
Sets the Java java.util.Properties object, with the configurations used in the connection established to call an SAP remote function. |
This follow example shows how you can use the SAPConnection class to change the configuration of your connection to the SAP in order to call the remote functions, with the logon ticket instead of a username and password.
The object with information about the connection's context when calling an SAP Remote Function Call. With the methods available in this class you can adjust and control the flow of an SAP Remote Function Call, e.g. you can adjust a connection to call multiple sap remote functions in the same context instead of only one.
To handle the connection's context, create an extension module, and use its methods in the 'OnBeforeCall' and 'OnAfterCall' callback actions of the SAP connection.
Method |
Description |
static void beginContext() |
Begins a stateful call sequence allowing the user to orchestrate two or more remote function calls in the same context. |
static void commit() |
Commits the changes made so far in the stateful call sequence by calling the remote function 'BAPI_TRANSACTION_COMMIT'. |
static void endContext() |
Ends a stateful call sequence. Must be placed after a beginContext() method. |
static void rollback() |
Rolls back any changes made so far in the stateful call sequence by calling the remote function 'BAPI_TRANSACTION_ROLLBACK'. |
This example shows how you can have a stateful connection with SAP using the SAPContext class. It defines the begin and end of the context, as the commit and rollback of the changes made so far.
The object with information about the request of an SAP remote function call. With the methods available in this class you can adjust the parameters sent and received from the SAP Remote Function Calls, e.g. customize the received parameters values returned by SAP to show them differently to the end user.
To handle the remote function parameters, create an extension module, and use its methods in the 'OnBeforeCall' and 'OnAfterCall' callback actions of the SAP connection.
Method |
Description |
static SAPRequest getCurrent() |
Returns the object with information about the current SAP remote function call, when invoked inside the 'OnBeforeCall', or 'OnAfterCall' callback actions of the SAP connection. Otherwise, returns null. |
com.sap.conn.jco.JCoFunction getJCoFunction() |
Returns the object with the metadata and the parameters value for the current SAPRequest, when invoked inside the 'OnBeforeCall', or 'OnAfterCall' callback actions of the SAP connection. Otherwise, returns null. |
This example shows how you can adjust the input parameters values when calling an SAP remote function. For that we will get the remote function metadata of the 'Bapi_Customer_Getlist', and ensure that the customer id we are sending to SAP has 9 digits as the SAP internal value for this parameter. If not, we will add trailing zeros to the parameter value till it has the 9 digits.
See Also