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”- 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 the Notification row - A list of Flows will be displayed. Now click on the
Createbutton and choose theForm Actionflow- Title - Enter Create SAP Notification
- Description - Enter description as Create a notification on SAP or similar
- Select the
On Completeoption - 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.
SAP BAPI(s) to use
Section titled “SAP BAPI(s) to use”To create a notification in SAP is a three step process.
- Begin a stateful call sequence for calls to the specified destination
- Set the input data and call the BAPI
BAPI_ALM_NOTIF_CREATE - If successful pass the NOTIF_NO returned by the call to the BAP
BAPI_ALM_NOTIF_SAVE - Commit the data with a call to
BAPI_TRANSACTION_COMMIT - 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])
Developing the Flow
Section titled “Developing the Flow”- In the Flow Builder, the
Add Nodedialog should already be open. If not, click on theForm Action 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
Start Sessionand remember to connect theForm Action 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. 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-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
- Change the title to
- Now choose the newly added
sap-eccsystem in the Server dropdown - Set the
RFC Operationto Begin Session and Save the node. - Select the
Start Sessionnode and click on+and selectSAPto add another node. - Change the title to
BAPI Create Notifand remember to connect theStart SessionnodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - Select the
sap-eccsystem and set theRFC Operationto Execute - 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
- 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 NOTIFHEADER and NOTIF_TYPE. From RFC Output select NOTIFHEADER_EXPORT and RETURN and click on Save
- Now in the list shown click on
NOTIF_TYPEand in the dropdown selectForm Fieldand choose Notification Type and Save. Visually a colored button is now shown to indicate that mapping is complete. - Now click on
NOTIFHEADERand map the following fields:- Equipment —> Form Field - Equipment ID
- FUNCT_LOC —> Form Field - Functional Location ID
- SHORT_TEXT —> Form Field - Shorttext
- PRIORITY —> Custom Input - 2 or as per your system
- Any other fields as required in your system (you can also set static values or add form fields and select)
- Click on Save.
- We need to know what the data output format is before we can proceed. Connect the
BAPI Create Notifnode to success, save and publish it. - Run the flow (correcting any errors if required). From the
Tracedialog, copy the output of theBAPI Create Notifnode 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
BAPI Create Notifnode 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
Extract Notif Noand remember to connect theBAPI Create NotifnodeSuccessconnector 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 NameselectBAPI Create Notif Result - Under
Expressionclick on the :fontawesome-solid-wrench: icon to open the Expression Builder - Now paste the data we copied in step 16 above.
- We now need to extract the NOTIF_NO and we will use the below expression:
$.NOTIFHEADER_EXPORT.NOTIF_NO
- Paste the expression from the step above into the
Mapping Expressionwindow on the right. The extracted data is now displayed at the bottom. Confirm that what is displayed is correct. - 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
Extract Notif Nonode and click on+and selectSAPto add another node. - Change the title to
BAPI Save Notifand remember to connect theExtract Notif NonodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - Select the
sap-eccsystem and set theRFC Operationto Execute - 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
- Now click on the :fontawesome-solid-wrench: icon in the Function Parameters box and open the
SAP Table / Structure mapper. - From the RFC Input select NUMBER. From RFC Output select NOTIFHEADER and RETURN and click on Save
- Now in the list shown click on
NUMBERand in the dropdown select Extract Notif No Result or ${extractnotifno_result} and click on Save - We are almost there, just a couple of steps to go. Now Select the
BAPI Save Notifnode and click on+and selectSAPto add another node. - Change the title to
BAPI Commitand remember to connect theBAPI Save NotifnodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - Select the
sap-eccsystem and set theRFC Operationto Execute - In function you can type in BAPI_COMMIT_TRANSACTION
- Now click on the :fontawesome-solid-wrench: icon in the Function Parameters box and open the
SAP Table / Structure mapper. - From the RFC Input select WAIT. From RFC Output select RETURN and click on Save
- Now in the list shown click on
WAITand in the dropdown selectCustom Inputand set the value to X and click on Save - Now Select the
BAPI Commitnode and click on+and selectSAPto add another node. - Change the title to
End Sessionand remember to connect theBAPI CommitnodeSuccessconnector to this node (else the expression builder will not display all the possible fields and nodes) - Select the
sap-eccsystem and set theRFC Operationto End Session and Save - Finally connect the
BAPI Commitnode toSuccess - 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 check the output of the last node and search for
NOTIF_NOin the output. If successful, you can see the newly created notification number here. Copy it. - Open and Login to SAP GUI. Enter transaction IW23 and enter the notification number. You should be able to view the details now.
Login to Turbo Forms App
Section titled “Login to Turbo Forms App”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.
Assignments
Section titled “Assignments”Modify the flow to return the created Notification number as a result of the flow.
Check the solution for this assignment: Assignment Solution
Topics Covered
Section titled “Topics Covered”- Developing a flow to create a notification in SAP
- Starting a stateful session and executing a series of calls as part of the stateful session by passing in intermediate results
- Creating Form (test) data
- Running the flow and testing it