Skip to content

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”
  1. SAP System access - While this example is developed on a ECC-6 system you can build the equivalent on a similar system
  2. SAP GUI Login Access to identify the required data and to verify Notification creation
  3. SAP User Id and Password with access to the BAPI Explorer
  4. 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.

  1. In the Forms list, click on the Flows icon on the Personnel row
  2. A list of Flows will be displayed. Now click on the Create button and choose the Scheduled Flow option
    • Title - Enter Reload Personnel
    • Description - Enter description as Reloads personnel data from SAP weekly or similar
    • Choose Type as Week and then select only Monday as the option
    • Click on Save to create the flow
  3. You will now be navigated to the Flow Builder

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])
	
  1. In the Flow Builder, the Add Node dialog should already be open. If not, click on the Scheduled Flow start node and then click on the :fontawesome-solid-circle-plus: icon that is displayed below the node
  2. Search for the SAP node by typing in sap and clicking on it
  3. The SAP node is now opened and you can configure it.
    1. Change the title to Read Personnel and remember to connect the Scheduled Flow start node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
    2. Since we want to work with an SAP system we need to first create it. If you are going to reuse the sap-ecc system 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.
    3. The Add System dialog 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
  4. Now choose the newly added sap-emp system in the Server dropdown
  5. Set the RFC Operation to Execute
  6. 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
  7. Leave the Mapping as Default and click on the :fontawesome-solid-wrench: icon in the Function Parameters box and open the SAP Table / Structure mapper.
  8. 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
  9. Now in the list shown click on LST_NAME_SEARK and in the dropdown select Custom and enter ADAMS and Save. Visually a colored button is now shown to indicate that mapping is complete.
  10. Click on Save.
  11. We need to know what the data output format is before we can proceed. Connect the Read Personnel node to success, save and publish it.
  12. Run the flow (correcting any errors if required). From the Trace dialog, copy the output of the Read Personnel node 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.
  13. Now select the Read Personnel node and click on + and select JSON Parser to add the JSON parser node.
  14. The JSON Parser node is now opened and you can configure it.
    1. Change the title to Prepare Personnel Data and remember to connect the Read Personnel node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
    2. Since we want to work with the previous step results, click on the Previous Step section
    3. For Map Field Name select Read Personnel Result
    4. Under Expression click on the :fontawesome-solid-wrench: icon to open the Expression Builder
    5. 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"
      }
      ]
      }
    6. 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 Rows node. The data format expected here is:
      {
      "data": [
      {
      "equipmentId": "computer",
      "submit": true,
      "inventory": 10
      }
      ]
      }
    7. Copy and paste the below expression into the Mapping Expression window 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
      })
      }
    8. Now Click on Save and close the builder,
    9. Now Click on the :fontawesome-solid-floppy-disk: icon and save the node
  15. Select the Prepare Personnel Data node and click on + and search for master data and select the Update Rows node
    1. Change the title to Save Personnel and remember to connect the Prepare Personnel Data node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
    2. The Master Data Name should be pre-selected to Personnel
    3. Under Master Data To Save click on the :fontawesome-solid-wrench: icon to open the Expression Builder
    4. Choose Result under the Prepare Personnel Data in the list
    5. Now Click on Save and close the builder,
    6. Now Click on the :fontawesome-solid-floppy-disk: icon and save the node
  16. 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.
  1. 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.
  2. 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 Data button. Enter the values for the different fields based on your system setup making sure that they are correct.
  3. Run the flow by clicking on the Run button. The flow should run successfully.
  4. 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.
  5. Now return to the Forms List. On the row displaying Personnel click on the Data icon
  6. 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.

  1. Developing a scheduled flow to reload master data
  2. Executing a BAPI on SAP and fetching filtered personnel data
  3. Saving the information from SAP into the Personnel master data
  4. Running the flow and testing it