I have a requirement recently to trigger the creation of the corresponding S/4HANA outbound delivery document in SAP Cloud for Customer.
The basic idea is to replicate Sales order created in SAP C4C into S/4HANA, trigger the production and delivery process. Once the production is finished in S/4HANA, it is required to trigger the outbound delivery creation in C4C Sales Order UI.
(1) The easiest part is to implement the outbound delivery creation in S/4HANA using function module BAPI_OUTB_DELIVERY_CREATE_SLS.The idea is first to read Sales Order line item detail via function module BAPISDORDER_GETDETAILEDLIST, then BAPI_OUTB_DELIVERY_CREATE_SLS did the job.
Replace your actual Sales Order ID with the hard coded value in line 21.Create a new SICF service node and wrap the above ABAP code into the method HANDLE_REQUEST of the service node’s handler class.
For more detail about ABAP SICF handler class, please refer to my blogs:
ABAP ICF handler and Java Servlet
Export WebClient UI table to PDF
(2) Create a new action triggerOutboundDelivery in Business Object CustomerQuote which is the data model of Sales Order TI page in C4C.It’s time now to consume the S/4HANA SICF service created in previous step as a restful service in this custom BO action implementation.
Some necessary model must be created as prerequisite before we start to implement service consumption in ABSL code.
Create a new External Web Service Integration named “JerryExternal”:Now we can start to program in Sales order’s action triggerOutboundDelivery using ABSL.
The restful service consumption is fired by ABSL utility method WebServiceUtilities.ExecuteRESTService. We can figure out its signature via code auto completion: