In this sample we will use the Query XQL action in Nintex Workflow to retrieve SAP user details. We will execute the SAP function module BAPI_USER_GET_DETAIL shown below and process several SAP result tables as XQL variables in the workflow.

The parameter USERNAME must be set to run the function module. We would like to process the result tables PARAMETER, PROFILES and RETURN in our workflow.

ecs-nintex-usergetdetail-sap

We will use the following XQL-statement.

XQL Statement
EXECUTE FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTS USERNAME = 'Elzein'
TABLES RETURN INTO @RETVAL, PROFILES INTO @SAPProfiles, PARAMETER INTO @SAPParameter;

At first let us run it in the XtractQL Explorer and check the result.

ecs-nintex-usergetdetail-xqlexplorer

Now we will create a custom SharePoint list as shown below.

ecs-nintex-usergetdetail-splist0

We will create a Nintex workflow and use the following actions.

ecs-nintex-usergetdetail-wf

Let us define the following workflow variables to save the SAP result.

ecs-nintex-usergetdetail-wfvariables

In the Query XQL Action let us set the field Application Name to an existing ECS Application Name.

In the field XQL Query we insert our XQL Statement. We use the Insert Reference button to set the value of the USERNAME parameter.

To assign an XQL output Variable (e.g. @SAPProfiles) to a workflow variable (e.g. VarProfiles), set the variable field to @SAPProfiles and click on Add. In the list select the workflow variable VarProfiles.

ecs-nintex-usergetdetail-xql-action

Configure the Update Item action to update the list fields using the workflow variables.

ecs-nintex-usergetdetail-updateitem

Now let’s create a new item in our list and set the field SAP User name.

ecs-nintex-usergetdetail-splist1

When the workflow runs, the list fields will be updated with the SAP data.

ecs-nintex-usergetdetail-splist2

SAP Errors will be processed in this case too and will be saved to the field SAP result. Check the result below for an invalid SAP user.

ecs-nintex-usergetdetail-splist3