SAP Create Requisition Usage in Flow Designer

Forrest  Falk
Tera Guru

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.

ForrestFalk_0-1741985299598.png

 

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.

ForrestFalk_1-1741985299599.png

 

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.

ForrestFalk_2-1741985299604.png

 

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.

ForrestFalk_3-1741985299611.png

 

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.

ForrestFalk_4-1741985299612.png

 

 

ForrestFalk_5-1741985299617.png

 

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.

ForrestFalk_6-1741985299618.png

 

Within the line item itself on line 113 we then call the getSplitAccountings function to build out the split accounting for the line item.

ForrestFalk_7-1741985299625.png

 

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.

ForrestFalk_8-1741985299627.png

 

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.

ForrestFalk_9-1741985299636.png

 

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.

0 REPLIES 0