Requirement: Number Range for Delivery number must be determined based on following parameters.
Solution: In S/4HANA, new solution using CPF is available for determining number range for Delivery document numbering.
System will generate a CPF decision table with parameters as columns. We have to maintain different combinations of values and corresponding number range interval.
It is also possible to maintain number range prefixes.
Define parameters. IMG -> Logistics Execution -> Shipping -> Basic Shipping Functions -> Configurable Parameters and Formulas in Shipping -> Define Parameter Catalog Entries for Flexible Delivery Document NumberingParameters Delivery Type and Shipping Point are defined by SAP and Data Source Routine 1 for filling these parameters is also delivered by SAP.But the parameter Creation Year is defined by us, and a custom Data Source Routine is needed for filling this parameter value.
Define custom Data Source Routine. Note: This step is NOT needed if we want to use only SAP defined Parameters.As a first step we must create a BAdI implementation for BAdI definition BADI_LE_SHP_CPF_D01_DATA_SRC. In this BAdI implementation we will fill the value for parameter Creation Year.Important: BAdI Filter accepts value in the range 30000 – 99999 (Data Source Routine). This is the first place where we define new Data Source Routine.After the BAdI implementation, go to t-code CPF_D01_DS_ROUT for assigning newly defined Data Source Routine to Usage D01 (Flexible Number Range for Delivery).
Select the newly defined Data Source Routine and assign parameter Creation Year to it.
Define formula to determine number range for delivery.
Till now we have defined all needed parameters. Now lets define the formula using these parameters.IMG -> Logistics Execution -> Shipping -> Basic Shipping Functions -> Configurable Parameters and Formulas in Shipping -> Define Formulas for Flexible Delivery Document Numbering
Assign required parameters to the formula.
The parameter NUMBERRANGERESULT is available by default in this list. This is parameter is a result parameter.
Formula Task SET_NUMBER_RANGE is available by default.
Select formula task SET_NUMBER_RANGE and assign parameters and define priority for them. While processing decision table, parameter having highest priority will be compared first.
Now our CPF decision table is ready. Maintain entries.
Define custom Routine for Flexible Delivery Document Numbering.
It is time to assign our formula to a Routine.
Define custom Routine.Note: Allowed range 3000000 to 3009999.IMG -> Logistics Execution -> Shipping -> Basic Shipping Functions -> System Modification -> Routines -> Define custom Routine for Flexible Delivery Document Numbering
Assign Formula to Routine.
Assign custom Routine to Delivery Document Type.
Assign the Routine to relevant Delivery Document Types. IMG -> Logistics Execution -> Shipping -> Basic Shipping Functions -> Configurable Parameters and Formulas in Shipping -> Assign custom Routine to Delivery Document Type
Note: For this delivery type, number range 17 is the fallback when the Routine is failed to determine a number range.
Conclusion: Now you know how to do the configuration for the flexible Delivery (Usage type: D01) document numbering. How to create custom parameters and fill value for them.
It is the same steps (IMG path, T-codes and BAdI are different) which we have to follow for Billing(Usage type: B01) document flexible numbering.