# SAP Action Builder

The SAP Action Builder and the generated workflow actions allow for generic and flexible interaction with SAP BAPI based Remote Function Calls. The SAP Action Builder provides for browsing of SAP RFCs and the configuration of new SAP Workflow actions which will invoke the selected RFC. Actions defined from the SAP Action Builder will be available from the Workflow Designer action palette under the “SAP” Category.

The SAP Action Builder uses defined SAP scenarios, managed from the Workflow Designer, Manage, Connector Configuration, SAP.Config.xml. Any defined scenarios will be available by name from the builder.

To access the SAP Action Builder, navigate to the URL directly as below

http(s)://[APPSERVERNAME]/spe/ActionBuilder/SAPActionBuilder

Or, access from Workflow Designer, Manage, Action Management, SAP from the “Open SAP Action Builder” link

From the SAP Action Generator screen, select “Create New Action”, select a scenario, then select “Load Functions”. As there can be tens of thousands or more BAPIs, a filter must be provided to find the desired API. From the filter input provided, specify 3 or more characters from the BAPI to be used. For example, “BAPI_EMPLOYEE_GET” to find and select “BAPI_EMPLOYEE_GETDATA”

Once the filter shows the Function, select it to see details.

Once a Function is selected, available parameters are shown as Imports and Exports.

Expand the tree to view and select which properties will be made available to the Workflow Action.

To limit inputs to use for the workflow action, deselect properties which will be hidden, and leave checked properties which will be used.

“Imports” and “Exports” may be hidden or shown by checking the entire property on the BAPI Navigator tree, or by drilling into rich properties and selecting more specific options.

For example, selecting the below from “Imports” will limit to these properties in the workflow action

Selecting the above will make the below action properties available.

Similarly, Exports can be selected as well to be made available to the action. In this example, the BAPI Navigator tree was used to select options.

The above selections will result in these outputs in the generated action.

# Transaction Commit Mode

Defined SAP actions support these options for how the commit of the transaction will be processed. The setting is managed from the Action Commit Mode select list. The options are below.

Transaction Commit will use the native SAPNCO transaction commit

BAPI_TRANSACTION_COMMIT - instead of the SAPNCO transaction commit, an additional call is made to BAPI_TRANSACTION_COMMIT in the transaction. This is equivalent to adding this call to the sequence in SE37 within SAP.

No Commit - This is equivalent to invoking BAPI directly from SAP debugging, screen "SE37"

# Saving the defined action

Once the action definition is complete, it can be saved by selecting “Save Action To Workflow Designer”. Optionally the action definition can be exported by selecting “Download Action XML”.

When done, “Close BAPI Function” on the left will leave the current action definition and return to the Function browser.

# Modifying Existing Actions

Actions which have been saved to the Designer can be reloaded in the future by selecting “Open Existing Action” and selecting an action from the list of actions.

The action will be loaded as defined and may be modified and saved again, or saved as a new action by providing a new “Action Name”.

# Using SAP Actions

Once actions are defined, they can be used just as any regular action from the Workflow Designer.

Defined actions will provide a “Scenario” property as well as the selected Imports and Exports as properties. As output variables can contain tables, those properties provide a convenience feature to define object variables with a proper structure to hold the SAP response. To use this feature, select the property from the action property panel. In the below example, “PERSONAL_DATA” was selected. The Output Variable screen shown allows you to enter an existing object variable by name, or enter a new object variable name and select, “Create Variable” which will generate the proper structured object variable.

# Configuring SAP connection scenarios

Managing SAP connection scenarios is done from the Workflow Designer, Manage, Connector Configuration, SAP

The SAP scenario management screen allows for defining any number of SAP connections which can be accessed directly by the PMG application server, or by the PMG relay framework through an available remote agent.

The PMG application communicates with SAP ECC/HANA and related modules using the SAP provided NCO3 libraries, a .Net library which works with SAP over its native protocol. Communication with SAP is based on the SAP GUI Client protocol and requires the same environment access and configuration. the PMG application is given one or more target SAP environments by defining SAP "Scenarios" which contain the connection details.

To define a new scenario, click "New" and provide a name for the scenario. Each scenario will define the connection details for a given SAP instance. There are a base set of SAP connection attributes provided, and then additional attributes are added as needed using the "Add Attribute" button. Once a scenario is defined, you can test the configuration using the "Test Login" button. Additionally, SAP is fully supported by the PMG Relay Framework by specifying the remote agent name as the Remote Scenario. Authentication is supported with SAP User ID/Password, or by SAP certificate authentication. The User identity requires access to invoke the required SAP RFCs as well as perform the required activities within the SAP application. Note: In the development instance, when SAP Action Development is in use, the identity must also have rights to query available RFCs and their structures. The BAPI query permission is not required in production usage.

The scenarios support the following:

Connection Type - appserver or msgserver

appserver requires the following additional settings

  • SAPSystemName
  • Client
  • SystemNumber
  • AppServerHost

msgserver requires the following additional settings

  • SAPSystemName
  • Client
  • SystemNumber
  • MsgServerHost
  • LogonGroup

SAP System Name - the system name of the SAP instance

Client - The client number to use for the connection

SystemNumber - The SAP System Number to use

AppServerHost - For connection type appserver, indicates the app server hostname to use

MsgServerHost - For connection type msgserver, indicates the message server hostname to use

LogonGroup - For connection type msgserver, the logon group to use

SAP connectivity supports two options for authentication, either username and password, or certificate. To use username and password, add these attributes.

Username - the username to use for the SAP connection. This user must have sufficient rights to access RFCs and perform the required SAP transactions

Password - the password for the username

To configure certificate based authentication, configure SAP and define the client certificate and register the certificate with an SAP user per SAP's instructions for SNC and certificate usage.

The required SAP files must be present on each PMG application instance to support SAP SNC and SAP certificates. To configure an SAP scenario for certificate authentication, provide the following as needed.

CertLocation - the file path of the client certificate generated as per the SNC setup, e.g. C:\SAP\SRC.CER

SncMode - the mode for the connection, e.g. 1

SncPartnerName - the SNC Partner Name to use, e.g. p:CN=ExamplePartnerName,C=GB,O=,OU=

SncMyName - the SNC "my name" to use, e.g. p:CN=Example,OU=,O=,L=,C=GB

SncQOP - the SNC QoP setting, e.g. 8

Trace - the SNC trace setting, e.g. 2

SncLibraryPath - the file path of the SAP provided sapcrypto.dll, e.g. C:\SAP\sapcrypto.dll

SAP enviroments may also be accessed through a PMG remote agent via the PMG Relay Framework. To use a remote agent, configure the "Remote Scenario" property for the SAP connection scenario. This is the name of the agent scenario defined in the "Execute As/PowerShell" scenario.

An example scenario to connect to an SAP appserver instance is below.

SAP example scenario

# Windows Services Configuration

The application server instances must have configured the Windows services file as required by the SAP GUI client.

SAP instances require an entry with the C:\Windows\System32\drivers\etc\services file

An entry contains the SAP service name, port, and protocol, e.g.

Additionally, any SAPNCO prerequisites must also be installed, such as the MSVC++ redistributables.

sapmsP01	3600/tcp

# Testing SAP connections

SAP connections may be verified with any of the following methods.

  • Using a test workflow with a read activity, like SAP Ping, or SAP Find User

  • Using the PMG provided tester application, which is a simple C# .Net application which uses the SAPNCO3 library. Source code is available for this for troubleshooting connectivity issues. Contact PMG Support to get a copy of the tester application and source code

  • Using the SAP GUI client from the application server

  • Using NIPING provided by SAP: https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=360974069