Background
In S/4HANA Cloud, the SAP best practice content provided by SAP normally fulfills basic E2E business requirement. Different from S/4HANA On-Prem or S/4HANA Private Cloud where customer has full access to the backend system (e.g. SPRO) to change configuration, customer uses SSCUI apps to change some configuration settings in S/4HANA Cloud. However, most SSCUI settings are only defined in the design time and it is difficult to handle different process variants in Q2C order process.
With help of CPF tool (Configurable Parameters & Formulas), it is possible to define business rules in S/4HANA Cloud to influence different aspects of sales order process at runtime.
This blog shows CPF usage “S02” to determine requested delivery date on sales order header based on flexible business rules defined in CPF decision table.
Business Example
The field “Requested Delivery Date” in sales order header is used to capture the requested delivery date by customer. This date can be current date, or proposed by system based on certain rules. Following customizing settings are defined in the sales order type to influence requested delivery date calculation.
These settings are not sufficient to fulfill customer’s requirement to calculate the requested delivery date. For example, due to different sales area the offset of requested delivery date would be different. Customer would like to have 5 days offset for one sales area and set 10 days offset to another sales area.
In this example, I’d like to show the detail steps of using CPF to define requested delivery date offset based on different sales office via business rules.
Configuration Details
Following configurations need to be defined to enable the flexible number range feature. Generic user “BPC_EXPERT” is used to define required configurations via SSCUI.
Define Factory Calendar Rules
The factory calendar shall always be considered when determining date. Therefore, before defining business rules for requested delivery date, it makes sense to define what factory calendar should be used in the order process.
Go to SSCUI 103829 “Define Rules to Determine Factory Calendar” to define factory calendar determination sequence.
Define the factory calendar determination priority as Sales Org -> Sold-to Party -> Calendar Rule. This means the factory calendar will be determined from sales organization of sales order as the first priority, then use factory calendar from sold-to party if no factory calendar is determined from sales organization. The default factory calendar will be used if no factory calendar is determined from both sales organization and sold-to party.
Define Parameter Catalog for Requested Delivery Date
Open the SSCUI 103827 “Define Parameter Catalog for Requested Delivery Date” to define parameters which will be used to build up the CPF decision table.
There are some standard parameters available so that customer can build up business rules based on these parameters.
Define Formulas for Requested Delivery Date
Open the SSCUI 103828 “Define Formulas for Requested Delivery Date” to define CPF formulas.
Define Formulas
Define a new CPF formula and specify the formula ID
Assign Formula Parameters
Select the formula ID and double click the sub-folder “Assign Formula Parameters” to assign parameter
Define Formula Tasks
Click into the sub-folder “Formula Tasks” to define formula tasks
The standard usage task “SET_REQD_DELIV_DATE” is available to determine the requested delivery type. Routine 1 means the CPF decision table is used for this formula.
Define Parameter Priority
Click into the sub-folder “Assign Parameter Priority” to set the priority of parameter which makes the column sequence of decision table.
Define Decision Table
The next step is to define business rules in decision table. Define business rules as below:
In the decision table, I set 5 days offset for sales office 100 and sales group 100, and 10 days offset for sales office 120 and sales group 120, and 30 days offset for sales office 130 and sales group 130.
Define Custom Routines for Requested Delivery Date
Go to SSCUI 103830 “Define Custom Routines for Requested Delivery Date in Sales Documents” to define custom routines.
Select the routine number and link the CPF formula to the routine number
Assign Custom Routines to Sales Document Types
Open the SSCUI 103823 “Assign Custom Routines to Sales Document Types” to link the custom routine to sales document type.
In this example, select the custom routine and assign it to the standard order type “OR”.
Sales Order Testing
Log onto S/4HANA Cloud system with generic user “INTERNAL_SALES_REP”.
Create Sales Order with Sales Office 100
Create a sales order via VA01, and provide required information like sold-to party, customer reference, and material
Because there is no sales office/sales group determined in sales order, the requested delivery date is determined by current system date.
Go to sales order header to set sales office and sales group.
Go back to the sales order overview page to check the requested delivery date.
The offset 5 days is considered to calculate the requested delivery date when sales office/sales group is 100/100.
Create Sales Order with Sales Office 120
Open the sales order Fiori app to create sales order.
The current date is used as requested delivery date if no sales office/sales group is specified.
Specify the sales office and sales group
The 10 days offset is used to determine the requested delivery date when sales office and sales group 120/120 is specified in sales order.
Additional Notes
The CPF provides more flexibility to influence sales document process at runtime without enhancing core logic. It is friendly to the business user and citizen developers who may lack of ABAP experience of implementing Cloud BAdIs.
The CPF usage “S02” only controls requested delivery date on sales order header level, and the logic will not be triggered in the changing mode.