CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
christian-hissl
Associate
Associate

First Things FirstBring Custom Fields into SAP Order Management Foundation

Using the predefined customFields JSON object, which exists on the header and items of an order in SAP Order Management foundation, you can extend orders with custom fields. Flow actions in the Manage Flows app of SAP order Management foundation have access to these objects. For more information about orders, see the Orders API on the SAP Business Accelerator Hub.

screen1.png

 customFields is an untyped JSON object in the order API.

How to Get from SAP Order to SAP S/4HANA

In the big picture of this integration scenario, you begin with the customFields JSON object, which is provided out of the box by SAP Order Management foundation:

 

},
  "customFields": {
    "z_demo_cartId": "ext_090671"
   }
}

 

You create the JSON object as part of an order, and it’s stored in SAP Order Management foundation. Then, it’s transferred by orchestration to SAP S/4HANA through SAP Cloud Integration. You implement a post-exit in the standard integration flow (iFlow) to map the custom field to the SOAP message SalesOrderBulkRequest_In inbound to SAP S/4HANA The details like Cloud Connector are ignored when they do not affect the extension.

christianhissl_0-1712790660786.png

Step-by-Step Implementation of the Post-Exit

To replicate your new custom field to SAP S/4HANA, SAP Cloud Integration provides the post-exit iFlow concept. You can think of it as a sub-process that is called by the standard iFlow. In this post-exit, you can implement your custom logic with the full capabilities of SAP Cloud Integrationfrom a simple message mapping to sophisticated groovy scripts. The key advantage is your standard iFlow will stay as SAP’s standard. This means you will continue to receive regular updates and their commercial advantages all while being able to implement your required custom logic.

To enable the iFlow processing with a custom post-exit, you need to follow a few steps, which are described in detail in the following sections:

  1. Activate the post-exit in the configuration of your standard iFlow.
  2. Create your custom post-exit iFlow.
  3. Implement your custom logic and deploy the iFlow.

Activate the Post-Exit in the Configuration of Your Standard iFlow

The first step is to navigate to the configuration of the standard iFlow by choosing christianhissl_1-1712790701180.png (Actions) and selecting Configure. After that, enter “true” for the case-sensitive property CustomExtensionEnabled.

christianhissl_2-1712790760666.png

Then in the Receiver tab, you define the address of your post-exit. This address can be any string starting with a forward slash (“/”), but we recommended you keep the prefilled standard address. For the Receiver field, select CustomerPostExit. The Adapter Type field should be automatically set to ProcessDirect.

christianhissl_3-1712790796468.png

With this configuration, every order replication to SAP S/4HANA will call your new post-exit iFlow after the standard mapping of the standard iFlow. Likely, you’ve already guessed the next step: We now need to create the post-exit iFlow.

Create Your Custom Post-Exit iFlow

In your SAP Order Management Foundation Integration with SAP S/4HANA integration package, navigate to Edit à Add à Integration Flow. You can give your iFlow any name, but for transparency when monitoring your iFlow, we recommended you include the text “Post Exit” alongside the name of the standard iFlow. Please also note that you can create this post-exit iFlow in any integration packagesome people prefer to create an extra package for custom iFlows of a given scenario, such as with this integration between SAP Order Management foundation and SAP S/4HANA.

The last step of this section is to create a sender using the adapter type “ProcessDirect”. Enter the address you maintained in the configuration of the standard iFlow, for example, “/S4onpremise/order/post-exit”. The sender enables the standard iFlow to call your new post-exit as a sub-process.

christianhissl_4-1712790836946.png

Implement Your Custom Logic and Deploy the iFlow

With this basic setup being completed, you can now implement customer-specific logic in the post-exit. SAP Cloud Integration gives you flexibility to implement certain requirements. On a high level, this simple example of adding a new custom field to an existing payload has an integration process consisting of an action to get custom fields, a filter for the original payload, and a mapping for custom fields.

christianhissl_5-1712790871613.png

In the action to get custom fields, you save the value of your custom field in a property. For that, we use a Content Modifier. In the Exchange Property tab, select XPath for the Source Type field. You can think of XPath as a query language for XML files. The query consists of “//” followed by the name of your custom field, for example, “//z_demo_cartId”.

christianhissl_6-1712790902418.png

After getting your custom field, you use a Filter step to make the complex input payload more manageable. Only the “SalesOrderBulkRequest” part of your payload is relevant and needs the new custom field. You filter out everything else by again using the XPath expression. In the Processing tab, you enter “//ns4:SalesOrderBulkRequest” in the XPath Expression field.

christianhissl_7-1712790933083.png

After filtering the payload, the final step is to map the custom field value to a new field on your sales order. In your case, we map it to the SalesOrderItemText field. For that, we use a message mapping. This makes it easy to add additional custom fields in the future simply with a drag and drop in the UI. We fetch our custom field value by using the standard mapping expression getProperty as shown below:

christianhissl_8-1712790962866.png

All that is left now is to choose Deploy and that’s it: You successfully enhanced the standard Replicate Order from SAP Order Management Foundation to SAP S4HANA iFlow with your new custom field!

Summary

In this blog post, we demonstrated how you can leverage the standard capabilities of SAP Order Management foundation to create an end-to-end extensibility flow. Your custom fields are first integrated into orders of SAP Order Management foundation and then replicated into sales orders of SAP S/4HANA.

A Limitation in Our Example

The focus of our example has been to use an iFlow to map the custom fields in SAP Order Management foundation to a standard element of the sales order SOAP message of SAP S/4HANA. For the details on how you can extend the SAP S/4HANA Sales Order (A2A) API, see Extensibility: Sales Order (A2A) on SAP Help Portal. The iFlow post-exit will remain the same: an SAP S/4HANA standard or custom attribute.

What's next

Take this opportunity to explore the SAP Order Management foundation product page, and to follow the tag “SAP Order Management foundation” to not miss out on more content to come