Order Simulation in hybris

Sales Order Simulation is one a key module which is used when we need to integrate with S4HANA for fetching real time price, stock, or to perform a credit check. It also allow to create orders, fetch order history, order details in real time by calling S4HANA API.

We have often seen that many b2b Application has a complex pricing, Stock Management which varies as per the customer, quantity of products and there are other multiple factor. These complexities can not be managed using hybris. So Hybris provides a provision to connect with S4HANA real time to get the pricing, stocks, credit checks.

Order Simulation modules also allow us to create an Order in S4HANA. And they can be retrieved as a real time call when customer try to access the my account section of order history and order details.

The Action which can be performed using Order Simulation are mentioned below:

  1. Synchronous Pricing
  2. Availability Check
  3. Credit Check
  4. Order Creation
  5. Order History
  6. Order Details
  7. Billing Invoice

In order to use Sale Order simulation module in you project you need to include below extensions in your localextension.xml:

saps4omservice

This extension contains the service classes that connect to the SAP S/4HANA backend and fetch the stock and price details. It also contains the services which handle synchronous order creation and history, and verify the user’s credit limit.

Caching of prices and stock availability can also be managed using this extensions.

This extension depends on below extension of running functionalities

  • outboundservices
  • sapmodel
  • b2bapprovalprocess

This extension override below service to intract with backend

  • calculationService
  • stockService
  • externalTaxesService
  • priceService
  • futureStockService
  • commerceStockService

Different service like “sapS4OMAvailabilityService”, “defaultS4OMSapFutureStockService”, “sapS4SalesOrderSimulationService” calls “sapS4OMOutboundService“. This class is a common service class which calls APIs provided by the SAP S/4HANA system. It uses the CSRF token from session for authentication. It makes call to below endpoints

ScenariosMethodAPI Endpoints
get latest price, stock availability, and credit limit detailsPOSTAPI_SALES_ORDER_SIMULATION_SRV/A_SalesOrderSimulation
Synchronous Order CreationPOSTAPI_SALES_ORDER_SRV/A_SalesOrder
Fetch Synchronous Orders (Order History)GETAPI_SALES_ORDER_SRV/A_SalesOrder?&$filter=SalesOrderType eq {‘SalesOrderType’}and SoldToParty eq {‘SoldToParty’}&$top={value}
Fetch Synchronous Order DetailsGETAPI_SALES_ORDER_SRV/A_SalesOrder({‘order number’})

saps4omfacades

It contains the populators which convert the model object retrieved from above extension to POJO objects.

saps4ombackoffice

It provide the backoffice structure for order simulation feature.

saps4omocc

It provides the OCC layer for order simulation module.

These 2 extensions are now deprecated and there functionality can be achieved using above extension “sapsalesordersimulation”, a”sapsalesordersimulationbackoffice”

Feel free to connect for any assistance and support.

Leave a Reply

Your email address will not be published. Required fields are marked *