In the following section we show you how to use the Call SAP Function Custom Action for storing table results in a workflow variable and to display the generated XML output in a SharePoint list.
A example we use the function module BAPI_EMPLOYEE_GETDATA. This function module reads personell master data and returns the results in different output tables. As input parameters the function module contains a set of scalar parameters from which DATE is to enter mandatory. Another selection criterion must be specified in order to read the employee data (e.g. Lastname, Firstname, Cost Center).
The aim of our scenario is to use the function module’s output table PERSONAL_DATA as XML output and to store the output in the workflow variable Output.
As input parameters the following values should be set:
- LASTNAME_M = Smith
- DATE = current date
In the end the XML output should be displayed in a SharePoint list.
First of all create a new SharePoint list (Custom List) that contains the column Output. Name this list Personal Data.
Ensure that you configure the column Output as Multiple lines of text because the XML output will contain more than one line. Additionally select Plain text as text type otherwise formatting errors could occur.
Call up the Workflow Settings in the List menu and open the menu point Create Workflow in Nintex Workflow to create a new Nintex Workflow.
Select the Call SAP Function Custom Action and add it to the workflow diagram via drag & drop. After adding the Custom Action open the configuration screen.
Specify the ERPConnect Service Application for your SAP system and enter function module BAPI_EMPLOYEE_GETDATA in the SAP Function section. Click (Re-)Load parameters to load the functions module’s parameters in the configuration screen.
Next to XML output table in the Tables section of the configuration screem output table PERSONAL_DATA is now selectable.
Select table PERSONAL_DATA and call up menu item Variables to define the workflow variable which is used for storing the XML output.
Click New in the Workflow Variables screen to create a new variable.
Name the variable Output. Because the XML output will contain more than one line of text choose Multiple lines of text as type and click Save to save the variable.
Afterwards you can select the just defined workflow variable in the XML output variable field. With this we ensure that the generated XML output will be stored in the workflow variable Output.
Now the input parameters must be defined. For parameter LASTNAME_M Smith shall be set as a fixed value. Open the input section and scroll down to input parameter LASTNAME_M. Here you can enter the value.
After that you can define the value for parameter DATE. The current date shall be set here. Scroll down to parameter DATE. Theoretically you could enter the current date manually in the SAP-compatible date format “yyyyMMdd”. To ensure that the current date is set automatically every time you start the workflow anew it is possible to format the field. To do this open the Insert Reference settings by clicking the sheet symbol on the right side of the row.
In the Common ribbon you can choose Current Date which contains the automatically generated date of the day. It is not sufficient however to enter Current Date here because it is formatted in the SharePoint-internal date format. To format the date in the correct SAP-compatible date format you have to use a Inline Function. Before selecting Current Date with a double-click open the ribbon Inline Functions.
Select the function FormatDate with a double click. The function has the following structure: fn-FormatDate(date, “date format”).
Thus in our example the function reads fn-FormatDate(Current Date, “yyyyMMdd”). For completing the function make a left-click between the brackets and add Current Date with a double-click in the Common ribbon. The date format “yyyyMMdd” has to be added manually.
Confirm your entries with OK. The function is then automatically transferred to the input field of parameter DATE.
It is not necessary to adjust anything in the other configuration sections Changings, Output and Advanced Options.
In this example we want to display the XML output in the Output column of our SharePoint list Personal Data. Therefore an additional Nintex Workflow Action has to be added to the workflow. Browse for the action Set field value on the left side of the workflow manager screen and add it to the workflow. With this action you can assign fields of a SharePoint list to workflow variables for example.
Open the configuation screen for the Set field value action. In the dropdown-list next to Set all the columns of the SharePoint list are shown. Select the Output column we have created at the beginning of the scenario.
In the Equals row you can now assign a value to the column. We want to assign the workflow variable Output as a value. Select Value in the list next to Equals and open the Insert Reference box on the right side.
Open the Workflow Variables ribbon and select the workflow variable Output with a double-click. Confirm your entries with OK.
Thus the workflow variable Output is assigned to column Output which means that the XML output is displayed in this column. Save the configuration of the action with the Save button.
After that save and publish the workflow.
Name the workflow Personal Data and return to the site with your SharePoint list Personal Data.
For this SharePoint list the workflow is to be executed. The easiest way to do this is to create a new item and open the Workflows button in the ITEMS menu. All the list workflows that are associated with this SharePoint list are shown here and can be started manually.
First of all create any item for your list. You have to fill in some text for the Title column. The output column should be supplied with data by the workflow. You don’t have to enter anything here.
Mark the line with the new created item and switch to the ITEMS menu. Open the menu point Workflows here.
Execute the workflow with the Start button.
The Output column should be filled with the XML output data as intended. Furthermore the data should be preselected by the criteria defined in the Custom Action (LASTNAME_M = Smith).
With this the workflow scenario is completed.