Go back into the workflow designer and add the following standard workflow actions, right below the Call SAP Function action:
Query XML – use this action to parse the XML return message from the SAP BAPI call
Log in history list – use this action to write the XML return message to the workflow history of the Purchasing Requests list
Update item – use this action to update the Purchase Requisition column of the Purchasing Requests list with the purchase requisition number from SAP.
Modify the configuration of the Call SAP Function action.
Create a new workflow variable with name BAPIReturn and with type Multiple lines of text to capture the return message from the SAP function call.
Create two more workflow variables:
Variable LogMessage with type Single line of text
Variable PurchaseRequisition type Single line of text
In the Call SAP Function action, select the table RETURN for XML output and map the output to variable BAPIReturn, as shown below.
Finally, add the output parameter NUMBER and map it to the workflow variable PurchaseRequisition.
Save the configuration for the action Call SAP Function.
Configure the Query XML action.
Select XML as the source for the action and insert the reference to the workflow variable Return.
As output, specify the XPath expression /TABLES/TABLE/RETURN/MESSAGE. This will output only the message portion of the SAP BAPI return structure.
Select Text as return results and store the results in the LogMessage variable.
Save the configuration of the Query XML action.
Configure the Log in history list action.
Insert a reference to the LogMessage variable in the workflow. This will write the contents of the LogMessage variable to the workflow history of the list item.
Save the configuration of the Log in history list action.
Configure the Update item action.
Select Current item for update, and Purchase Requisition as the field to update.
Set the Purchase Requisition field to the value of the workflow variable PurchaseRequisition.
Save the configuration of the Update item action.
Save and Publish the workflow.