Skip to content

Create SAP Notification Flow Development

We will now develop a Form Action Flow to create a notification in SAP when Notification Form is completed.

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 Notification row
  2. A list of Flows will be displayed. Now click on the Create button and choose the Form Action flow
    • Title - Enter Create SAP Notification
    • Description - Enter description as Create a notification on SAP or similar
    • Select the On Complete 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.

To create a notification in SAP is a three step process.

  1. Begin a stateful call sequence for calls to the specified destination
  2. Set the input data and call the BAPI BAPI_ALM_NOTIF_CREATE
  3. If successful pass the NOTIF_NO returned by the call to the BAP BAPI_ALM_NOTIF_SAVE
  4. Commit the data with a call to BAPI_TRANSACTION_COMMIT
  5. End the stateful call sequence for calls to the specified destination

This will create a notification on the SAP backend system.

Now let us draw a flow chart of the different steps we need to perform to create the notification:

flowchart TD
    A([Start]) -->|Form Complete Action| B[Start a stateful session]
    B --> C[Call BAPI_ALM_NOTIF_CREATE]
    C --> D{Error}
    D --> |Yes| M([ReturnError])
    D --> |No| E[Extract NOTIF_NO]
    E --> F[Call BAPI_ALM_NOTIF_SAVE]
    F --> G{Error}
    G --> |Yes| M
    G --> |No| H[Call BAPI_COMMIT_TRANSACTION]
    H --> I{Error}
    I --> |Yes| M
    I --> |No| J[End stateful session]
    J --> K[Extract NOTIF_NO]
    K --> L([Return Success])
	
  1. In the Flow Builder, the Add Node dialog should already be open. If not, click on the Form Action 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 Start Session and remember to connect the Form Action 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. 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-ecc
      • 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-ecc system in the Server dropdown
  5. Set the RFC Operation to Begin Session and Save the node.
  6. Select the Start Session node and click on + and select SAP to add another node.
  7. Change the title to BAPI Create Notif and remember to connect the Start Session node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
  8. Select the sap-ecc system and set the RFC Operation to Execute
  9. In function you can type in BAPI_ALM_NOTIF_CREATE 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
  10. 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.
  11. From the RFC Input select NOTIFHEADER and NOTIF_TYPE. From RFC Output select NOTIFHEADER_EXPORT and RETURN and click on Save
  12. Now in the list shown click on NOTIF_TYPE and in the dropdown select Form Field and choose Notification Type and Save. Visually a colored button is now shown to indicate that mapping is complete.
  13. Now click on NOTIFHEADER and map the following fields:
    1. Equipment —> Form Field - Equipment ID
    2. FUNCT_LOC —> Form Field - Functional Location ID
    3. SHORT_TEXT —> Form Field - Shorttext
    4. PRIORITY —> Custom Input - 2 or as per your system
    5. Any other fields as required in your system (you can also set static values or add form fields and select)
  14. Click on Save.
  15. We need to know what the data output format is before we can proceed. Connect the BAPI Create Notif node to success, save and publish it.
  16. Run the flow (correcting any errors if required). From the Trace dialog, copy the output of the BAPI Create Notif 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.
  17. Now select the BAPI Create Notif node and click on + and select JSON Parser to add the JSON parser node.
  18. The JSON Parser node is now opened and you can configure it.
    1. Change the title to Extract Notif No and remember to connect the BAPI Create Notif 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 BAPI Create Notif 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 16 above.
    6. We now need to extract the NOTIF_NO and we will use the below expression:
      $.NOTIFHEADER_EXPORT.NOTIF_NO
    7. Paste the expression from the step above into the Mapping Expression window on the right. The extracted data is now displayed at the bottom. Confirm that what is displayed is correct.
    8. Now Click on Save and close the builder,
    9. Now Click on the :fontawesome-solid-floppy-disk: icon and save the node
  19. Select the Extract Notif No node and click on + and select SAP to add another node.
  20. Change the title to BAPI Save Notif and remember to connect the Extract Notif No node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
  21. Select the sap-ecc system and set the RFC Operation to Execute
  22. In function you can type in BAPI_ALM_NOTIF_SAVE 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
  23. Now click on the :fontawesome-solid-wrench: icon in the Function Parameters box and open the SAP Table / Structure mapper.
  24. From the RFC Input select NUMBER. From RFC Output select NOTIFHEADER and RETURN and click on Save
  25. Now in the list shown click on NUMBER and in the dropdown select Extract Notif No Result or ${extractnotifno_result} and click on Save
  26. We are almost there, just a couple of steps to go. Now Select the BAPI Save Notif node and click on + and select SAP to add another node.
  27. Change the title to BAPI Commit and remember to connect the BAPI Save Notif node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
  28. Select the sap-ecc system and set the RFC Operation to Execute
  29. In function you can type in BAPI_COMMIT_TRANSACTION
  30. Now click on the :fontawesome-solid-wrench: icon in the Function Parameters box and open the SAP Table / Structure mapper.
  31. From the RFC Input select WAIT. From RFC Output select RETURN and click on Save
  32. Now in the list shown click on WAIT and in the dropdown select Custom Input and set the value to X and click on Save
  33. Now Select the BAPI Commit node and click on + and select SAP to add another node.
  34. Change the title to End Session and remember to connect the BAPI Commit node Success connector to this node (else the expression builder will not display all the possible fields and nodes)
  35. Select the sap-ecc system and set the RFC Operation to End Session and Save
  36. Finally connect the BAPI Commit node to Success
  37. 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 check the output of the last node and search for NOTIF_NO in the output. If successful, you can see the newly created notification number here. Copy it.
  6. Open and Login to SAP GUI. Enter transaction IW23 and enter the notification number. You should be able to view the details now.

Now login to the Turbo Forms App on web or mobile as the same user and click on the + button to create a new Notification to create by choosing the Notification form. Fill in data and click on Complete. This will ensure that the form is finalized and the On Complete flow we developed above will be executed. Check in SAP for the newly created notification.

Modify the flow to return the created Notification number as a result of the flow.

Check the solution for this assignment: Assignment Solution

  1. Developing a flow to create a notification in SAP
  2. Starting a stateful session and executing a series of calls as part of the stateful session by passing in intermediate results
  3. Creating Form (test) data
  4. Running the flow and testing it