S/4HANA Q2C Sales Flexibility – Determine Number Range for Sales Document

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 which customer has full access to the backend to change configuration, customer uses SSCUI apps to change some configuration settings in S/4HANA Cloud. However, most SSCUI settings are defined in the design time and it is difficult to handle the process variance 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 sales order at runtime.

This blog shows flexibility to control number range for sales document in S/4HANA Cloud. Please find detail information in SAP help.

The standard sales order type “OR” is pre-delivered by SAP with scope item BD9. There is standard number range assigned to standard order type “OR”. But some customers want to differentiate the sales order numbering according to certain criteria, e.g. different numbering prefix should be determined based on different country, sales area, order reason, etc.

In this example, I’d like to show the steps of using CPF to determine different numbering prefix per order reasons.

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 Number Range Prefixes for SD Documents

Open the SSCUI 103283 “Define Number Range Prefixes for SD Documents” to define prefixes. In this example, two prefixes are defined for “Advertisement” sales order and “Fast Delivery” sales order.

Define%20Number%20Range%20Prefixes

Define Number Range Prefixes

Define Parameter Catalogs for Flexible Sales Document Numbering

Open the SSCUI 104013 “Define Parameter Catalog for Flexible Sales Document Numbering” to define parameters which can be used to build CPF decision table.

Standard%20Parameter%20Catalogs%20for%20Flexible%20Numbering

Standard Parameter Catalogs for Flexible Numbering

There are already some standard parameter catalogs delivered with CPF usage “S01”. Customer can also add new parameter catalog 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.

Define CPF Formulas for Flexible Document Numbering

Open SSCUI 10414 “Define Formulas for Flexible Sales Document Numbering” to define CPF formulas. There are following steps to define business rules in CPF formulas:

Define Formulas

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.

Assign%20Formula%20Parameters

Assign Formula Parameters

Only following parameters are selected to build up decision table criteria:

  • Company Code
  • Sales Organization
  • Sales Document Type
  • Order Reason Code

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.

Formula%20Tasks

Formula Tasks

For CPF usage “S01”, only CPF decision table is offered to define business rules. For some CPF usages, other options are possible, for example, BRF+.

Assign Parameter Priority

Select the usage task and click sub-folder “Assign Parameter Priority” to define the priority of CPF parameter.

Assign%20Parameter%20Priority

Assign Parameter Priority

Define Decision Table

Click the sub-folder “Define Decision Table” to maintain business rules based on selected parameters.

Define%20Decision%20Table

Define Decision Table

The decision table is build up dynamically according to selected parameters. In this example, the number range prefix “ADV” is defined when order reason is “005” which represents “Newspaper Advertisement” and number range prefix “FDL” is defined for order reason “007” which represents “Fast Delivery”.

Define Custom Routines for Flexible Sales Document Numbering

Open SSCUI 104015 “Define Custom Routines for Flexible Sales Document Numbering” to define custom routine for CPF formula which was defined in previous step.

Define%20Routine%20Number

Define Routine Number

Click the sub-folder “Assign Enhancement IDs to a Routine Number” to link CPF formula to custom routine.

Assign%20Enhancement%20ID%20to%20Custom%20Routine

Assign Enhancement ID to Custom Routine

Assign Custom Routines to Sales Document Types

Open SSCUI 103823 “Assign Custom Routines to Sales Document Types” to link custom routine to sales document type so that business rules defined in CPF formula can function in sales document process.

Assign%20Custom%20Routine%20to%20Sales%20Document%20Type

Assign Custom Routine to Sales Document Type

Log onto S/4HANA Cloud system with generic user “INTERNAL_SALES_REP”.

Create Order via VA01

Open the app “Manage Sales Orders” to create sales order via VA01.

Create%20Sales%20Order

Create Sales Order

In the sales order overview page, provide required information like sold-to party, customer reference, material, and set order reason to “Newspaper Advertisement”

Sales%20Order%20Overview%20Page

Sales Order Overview Page

Save the sales order and check the sales order number.

Order%20Creation%20Message

Order Creation Message

The number range prefix “ADV” is applied to the sales order when order reason is 005 “Newspaper Advertisement”.

Create Order via Fiori App

Open the app “Manage Sales Orders” to create sales order via new Sticky UI. Provide order type and sales area

Create%20Sales%20Order

Create Sales Order

Provide required information in sales order screen like sold-to party, customer reference, and make sure the order reason 007 “Fast Delivery” is maintained.

Sales%20Order%20Overview

Sales Order Overview

Press button “Create” to save the sales order. The number range prefix “FDL” is determined because the order reason 007 is maintained in the sales order.

Sales%20Order%20with%20Order%20Reason%20007

Sales Order with Order Reason 007

Order Creation without Triggering CPF

Create a new sales order and leave order reason empty.

No%20Order%20Reason%20in%20Sales%20Order

No Order Reason in Sales Order

Save the sales order and check the sales order number. Sales%20Order%20with%20Standard%20Number%20Range

Sales Order with Standard Number Range

The standard sales order number range is determined and there is no prefix used in sales order number.

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.

Regarding CPF feature of flexible sales document number range, there are some restrictions. For example, numbering determination is only triggered when creating a new sales order. Once sales order number is determined and saved, changing sales order is not triggering number range re-determination. Please check help document (link) for other restrictions.