SAP Create Requisition Usage in Flow Designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2025 01:49 PM
SAP Create Requisition
SAP Ariba Spoke V 1.8.0
I recently had to set up an integration with the SAP Ariba Spoke for a client. I wanted to share the general architecture of creating a Purchase Request in ServiceNow and sending it to Ariba as I could not find it in the doc’s site
Here is the overall flow:
The idea is that you request an item for purchase from your hardware catalog within ServiceNow. Here I requested an iPad.
A Request and Requested Item(s) are generated based on what you purchased. Before it is sourced you may have approvals based on amounts or levels.
Once approved, a sourcing task on the request will be generated. For each requested item, you can choose whether to create transfer orders to move stock from one stock room to another or purchase orders to purchase more from a vendor.
Once sourced, you can use the SAP Ariba Spoke’s “Create Requisition” action to create a Purchase Requisition in Ariba. This is the step I wanted to deep dive into. There is a “Create Requisition sample subflow” that you can open in flow designer.
You will see that there is a “Generate Payload” action. If we open this action we will see it wants a PR number or OSID as an input.
For the Output, we will get a Schema and Action Status. If we then open the step with “Create Requisition” action, we will see that we are taking in the Schema from the Generate Payload step. This Schema will include all of the Purchase Requisition fields that we can send to SAP Ariba from ServiceNow.
Now let’s see what that Generate Payload action is doing.
Here we can see that we are taking the the PR Number and OSID inputs provided to the Generate Payload action and calling the getPayload() function in the RequisitionPayload script include.
If we open the RequisitionPayload script include and find the getPayload() function. We see in lines 4-10 that it is looking up a record in the “sn_sap_ariba_spoke_purchase_requisition_header” table.
On Line 14 we start to build our requisition object for the payload to send to SAP.
You can see all of the fields from the header record being filled into the requisition object.
On line 25, we call the getLineItems function located on line 56. That will look up all of the line items related to the requisition or header record. Again, we start building the lineItem payload to return back.
Within the line item itself on line 113 we then call the getSplitAccountings function to build out the split accounting for the line item.
The function is located on line 166 which will look up all the split accounting records, build the payload and return it to the getLineItems function. Which then the getLineItems returns back to the getPayload function. Finally, the getPayload function is returned back to our Generate Payload Action which then outputs the schema that we can use in our Create Requisition Action in the flow.
Once the requisition record is created in SAP and the record number is returned you will want to update your Purchase Requisition Header record in ServiceNow.
Here in step 7 you can see that we are updating the Purchase Requisition Header (sn_sap_ariba_spoke_purchase_requisition_header) record’s Unique Name field with the Requisition record from SAP. This will allow us to keep track of what record in ServiceNow created what record in SAP.
That is essentially it, we have completed creating a new requisition in SAP from ServiceNow. You can of course sync the Purchase Orders back into ServiceNow after they have been created in SAP to keep track of the items, shipping, receiving and more. I may dive deeper into those topics in a future post.
- 624 Views