SAP Personnel Master Data Flow Development
We will now develop a Scheduled Flow to reload Personnel data every week on Monday from SAP.
Prerequisite - SAP ECC or later system access
Section titled “Prerequisite - SAP ECC or later system access”- SAP System access - While this example is developed on a ECC-6 system you can build the equivalent on a similar system
- SAP GUI Login Access to identify the required data and to verify Notification creation
- SAP User Id and Password with access to the BAPI Explorer
- SAP User Id and Password to execute the BAPIs (can be the same as above with the right access)
We are now good to go on to the developing the flow and create a notification when completed.
Flow Development
Section titled “Flow Development”- In the Forms list, click on the
Flowsicon on thePersonnelrow - A list of Flows will be displayed. Now click on the
Createbutton and choose theScheduled Flowoption- Title - Enter Reload Personnel
- Description - Enter description as Reloads personnel data from SAP weekly or similar
- Choose
Typeas Week and then select only Monday as the option - Click on
Saveto create the flow
- You will now be navigated to the Flow Builder
Understanding the steps
Section titled “Understanding the steps”There are two steps to accomplish before we develop the flow. First is what are the functions in SAP that we need to use and second the order of steps. We will use the BAPI_EMPLOYEE_GETLIST BAPI to fetch the list of personnel. We will also use a filter condition to restrict the number of rows we read.
Now let us draw a flow chart of the different steps we need to perform to create the notification:
flowchart TD
A([Start]) -->|Scheduled Flow| B[Call BAPI_EMPLOYEE_GETLIST]
B --> C{Error}
C --> |Yes| G([ReturnError])
C --> |No| D[Extract Personnel]
D --> E[Save Master Data]
E --> F([Return Success])
Developing the Flow
Section titled “Developing the Flow”- In the Flow Builder, the
Add Nodedialog should already be open. If not, click on theScheduled Flowstart node and then click on the :fontawesome-solid-circle-plus: icon that is displayed below the node - Search for the
SAPnode by typing in sap and clicking on it - The
SAPnode is now opened and you can configure it.- Change the title to
Read Personneland remember to connect theScheduled Flowstart nodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - Since we want to work with an SAP system we need to first create it. If you are going to reuse the
sap-eccsystem added to Create Notification you can select that in the dropdown. Or if you want to add a new system, click on the :fontawesome-solid-plus: icon next to the SAP Server dropdown. - The
Add Systemdialog is displayed. Enter the following data:- Description: SAP ECC (or anything else you desire)
- Identifier: This is a unique identifier for the system, enter sap-emp
- Type: Choose Custom or Group Server based on your setup. We will be choosing Custom Application Server
- Server: Enter the host name or IP Address
- System Name: Enter the 3 letter SAP system name
- System Number: Enter the System Number (typically 00)
- Client: Enter the Client to logon to (typically 100)
- Logon Language: Enter the login language (typically EN)
- BAPI User and Password: Enter the user name and password with access to the BAPI explorer so we can browse for functions, structures etc
- User and Password: Enter the user name and password to execute the SAP functions, can be same as above
- Save the system
- Change the title to
- Now choose the newly added
sap-empsystem in the Server dropdown - Set the
RFC Operationto Execute - In function you can type in BAPI_EMPLOYEE_GETLIST or alternatively click on the :fontawesome-solid-wrench: icon to open the BAPI Browser, enter a search criteria and select the function from the list
- Leave the
Mappingas Default and click on the :fontawesome-solid-wrench: icon in the Function Parameters box and open theSAP Table / Structure mapper. - From the RFC Input select LST_NAME_SEARK as we are going to be searching on Last Name. From RFC Output select EMPLOYEE_LIST and click on Save
- Now in the list shown click on
LST_NAME_SEARKand in the dropdown selectCustomand enter ADAMS and Save. Visually a colored button is now shown to indicate that mapping is complete. - Click on Save.
- We need to know what the data output format is before we can proceed. Connect the
Read Personnelnode to success, save and publish it. - Run the flow (correcting any errors if required). From the
Tracedialog, copy the output of theRead Personnelnode which is displayed in JSON format. We will use this next. This “trick” of running intermediate flows is to ensure we test the development until then and more importantly get access to intermediate results for further processing. - Now select the
Read Personnelnode and click on+and selectJSON Parserto add the JSON parser node. - The
JSON Parsernode is now opened and you can configure it.- Change the title to
Prepare Personnel Dataand remember to connect theRead PersonnelnodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - Since we want to work with the previous step results, click on the
Previous Stepsection - For
Map Field NameselectRead Personnel Result - Under
Expressionclick on the :fontawesome-solid-wrench: icon to open the Expression Builder - Now paste the data we copied in step 13 above, this will be similar to the data below:
{"EMPLOYEE_LIST": [{"ARC_DOC_ID": "","ARCHIV_ID": "","USRID": "","ZIMNR": "233","GEBNR": "A3801","TEL02": "1008","TEL01": "522","JOB_TEXT": "Business Partner","JOB_ID": "50016172","ORG_TEXT": "CRM Organisational Unit","ORG_ID": "50000050","ENAME": "Mr. George Adams","PERNR": "00010453"}]}
- We now need to extract the Personnel Number, Name, Phone, Designation and Organization fields. We also need to format the data into the format expected by the
Update Rowsnode. The data format expected here is:{"data": [{"equipmentId": "computer","submit": true,"inventory": 10}]} - Copy and paste the below expression into the
Mapping Expressionwindow on the right. The extracted data is now displayed at the bottom. Confirm that what is displayed is correct.{"data": EMPLOYEE_LIST.( {"personnelNumber": PERNR,"name": ENAME,"phone": TEL01,"designation": JOB_TEXT,"organization": ORG_TEXT})} - Now Click on
Saveand close the builder, - Now Click on the :fontawesome-solid-floppy-disk: icon and save the node
- Change the title to
- Select the
Prepare Personnel Datanode and click on+and search for master data and select theUpdate Rowsnode- Change the title to
Save Personneland remember to connect thePrepare Personnel DatanodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - The
Master Data Nameshould be pre-selected to Personnel - Under
Master Data To Saveclick on the :fontawesome-solid-wrench: icon to open the Expression Builder - Choose Result under the
Prepare Personnel Datain the list - Now Click on
Saveand close the builder, - Now Click on the :fontawesome-solid-floppy-disk: icon and save the node
- Change the title to
- Now click on Publish button to save and compile the flow. If the compilation is successful it will also be published and we can run it to test.
Testing the Flow
Section titled “Testing the Flow”- Now that we have published the flow we are ready to test it. The Flow Builder has an integrated Run and Debug tool to help us troubleshoot the flow in case of errors.
- Now click on the Run Flow button. The Run dialog is now displayed. An error that there is no Form (test) data is displayed. You can enter Form (test) data now by clicking on the
Form Databutton. Enter the values for the different fields based on your system setup making sure that they are correct. - Run the flow by clicking on the
Runbutton. The flow should run successfully. - If there are errors it could be due to some mistakes in entering test data, configuring the system or copy/pasting the expression or similar. Check each step carefully with the documentation above.
- Now return to the Forms List. On the row displaying
Personnelclick on theDataicon - The data imported from SAP should now be displayed
Note that the Turbo Apps app will run the flow on the schedule and reload master data every Monday.
Topics Covered
Section titled “Topics Covered”- Developing a scheduled flow to reload master data
- Executing a BAPI on SAP and fetching filtered personnel data
- Saving the information from SAP into the Personnel master data
- Running the flow and testing it