Easier way to configure flexible number ranges with prefixes for Sales Documents using CPF in S4 HANA 2022.
The main objective of this blog is to have a prefix of Country ISO code for Sales orders created for different Sales Organizations belonging to different countries.
The following example illustrates a typical use case for flexible sales document numbering.
Consider a multinational company that consists of five companies, each based in a different country, including Switzerland, Germany, India, US, and Italy.
When a new sales document of type ZSOR (standard order) is created by the German company DE11, the custom routine and formula implemented by us tells the system to use the next available number in number range interval 15 within number range prefix DE.
While, on the other instance, if an ZSOR standard order is created by the Italian company IT11, the custom routine and formula tells the system to use the next available number in number range interval 15 with number range prefix IT.
Just by looking at the Document number of Sales document or Delivery document or Billing document, one can easily identify to which Sales organization or Company the document belongs. This can be easily achieved by Using Configurable Parameters and Formulas (CPF) to Implement Flexible Sales Document Numbering without any ABAP help.
We can use this Flexible document number ranges to Sales documents, Delivery and Billing documents.
Let’s dive deep into this feature in SAP S4 HANA 2022 how we can achieve this to our Sales documents as per the requirement.
Configuration Procedure for Sales Orders (Customizing)
We must perform the following steps in Customizing for Sales and Distribution:
To use prefixes, we should define them in the Define Number Range Prefixes for Sales Documents activity in Customizing for Sales and Distribution.
IMG > Sales and Distribution > Sales > Sales Documents > Sales Document Header > Define Number Range Prefixes for SD Documents
On the screen change view “Number Range Prefix for SD document”, maintain the No range prefixes and description.
For this scenario, we have taken the Country names of the Sales organization as prefix.
|Prefix||Sales Organization Code||Country & ISO Code|
|CH||CH11||CH – Switzerland|
|DE||DE11||DE – Germany|
|GB||GB11||GB – United Kingdom|
|IN||IN11||IN – India|
|US||US11||US – USA|
After the prefixes are defined, we must refer them in our decision table in the steps 3.
We need to create custom number range intervals that the system can assign dynamically. The path is,
IMG > Sales and Distribution > Sales > Sales Documents > Sales Document Header > Define Number Ranges for Sales Documents
Here we have defined the number range for the prefix DE. Like this we must define the number ranges for all the prefixes we have defined.
Prefixes: CH, DE, GB, IN & US.
No Range: 15 – for all the prefixes.
(Optional) If we want to include custom fields as additional formula parameters, we can enable these custom fields as parameters in the Define Parameter Catalog for Flexible Sales Document Numbering activity.
IMG > Sales and Distribution > Sales > Configurable Parameters and Formulas in Sales > Define Parameter Catalog for Flexible Sales Document Numbering.
There are already some standard parameter catalogs delivered with CPF usage “S01”. We can also add new parameter catalogs to define business rules.
In this example, standard parameter catalogs are sufficient to define business rules for our purpose. Therefore, no need to add new catalogs in this step.
In this step we Define Formulas for Flexible Sales Document Numbering activity under Sales and Distribution
Path: IMG > Sales and Distribution > Sales > Sales Documents > Configurable Parameters and Formulas in Sales > Flexible Sales Document Numbering > Define Formulas for Flexible Sales Document Numbering.
We will create a CPF formula (including a decision table) that fulfils our business requirements. Save the formula and make a note of the formula ID.
Click folder “Define Formulas” to define a formula with description.
Assign Formula Parameters
Click the sub-folder “Assign Formula Parameters” to assign parameter catalogs to formula. The assigned parameters are used to build up CPF decision table.
Only following parameters are selected to build up decision table criteria:
- Sales Organization
- Sales Document Type
Define Formula Tasks
Click the sub-folder “Formula Tasks” to assign routine for CPF usage task. In CPF usage “S01”, there is only one usage task “SET_NUMBER_RANGE” to determine number range.
Assign Parameter Priority
Select the usage task and click sub-folder “Assign Parameter Priority” to define the priority of CPF parameter. Depending on the priority we give here, the parameters will be displayed as per the priority in the Define decision table.
Define Decision Table
Click the sub-folder “Define Decision Table” to maintain business rules based on selected parameters.
This completes our formula definition.
In this step we will perform the Define Custom Routines for Flexible Sales Document Numbering activity under
IMG > Sales and Distribution > System Adaptation > Routines > Define Custom Routines for Flexible Sales Document Numbering
Here, we must register a routine number and assign it to our formula by selecting the implementation type Configurable Parameters and Formulas (CPF) and entering the formula ID as the enhancement ID. Our formula (including its decision table) is now mapped to the routine number.
Click on New entries and define a routine number.
Select the routine number and double click on Assign Enhancement IDs to a Routine number.
Select New entries and maintain the entries as below and assign the formula which we have created in our earlier steps.
In this step we need to Assign Custom Routines to Sales Document Types.
IMG > Sales and Distribution > Sales > Sales Documents > Sales Document Header > Assign Custom Routines to Sales Document Types.
Choose the sales document type (in our case, ZSOR ) for which we want to trigger the formula that we have created. Then, enter the routine number that we registered in the previous step to assign the chosen sales document type to the target formula.
If everything is configured correctly, when a sales document of the relevant sales type is created, the system now calls the assigned CPF formula to determine the number range interval (and, if applicable, the prefix) from which the new sales document number is drawn.
Let’s Test Sales Order
Now let’s create the Sales documents for different Sales organizations and check.
DE11 Sales Organization.
For CH11 Sales Organization.
For IN11 Sales Organization.
For US11 Sales Organization.
For GB11 Sales Organization.
As we did CPF configuration successfully, all our sales documents got prefixes the way we configured.
This ends my blog post, and in my next blog we will configure the flexible number ranges for Delivery documents as per the business requirement.
I hope you found this blog post helpful, please share your thoughts and feedback in comments section.
Please contact me for any questions or comments!
Related Links on SAP Help Portal:
Thanks & Regards