Sometimes customers ask the way to design Document Numbering with Intelligence for the Sales Billings. They need to identify, by the document number, some characteristics from the operation. The reasons for all of them are different but useful for their business. For example, they want to know the company code, or Country/Region, or document type category …

Now it is possible in SAP S/4HANA 2020 to create your own business logic to design your billing numbering in a simple way.

In this blog post, I will share with you in 3 steps How to Design “Flexible Billing Document Numbering” in SAP S/4HANA 2020. Also, some details to consider that I found in my journey.

First, let’s talk about the field “Billing Document”. It represents the internal and unique number of the Billing Document. Number field VBELN is used in the header Table VBRK, Item table VBRP and VBKD for commercial Data, among others. Its length in the data dictionary is 10 digits, and the type is “Character”.

The “Flexible Billing Document Numbering” makes available to you up to four first digits to use in your design (prefix), and the rest will be used to the number interval. For example, in my case, I will use the first two digits to set a prefix with an intelligence code identifier, and the rest, with a regular number interval.


Practical example

( Note: I adopt the Best Practice Sell from Stock (‏BD9‏) for my Scenario. )


My Prefix

My customer has two sales organization and they want to identify by the internal billing number each of them following this rule:

Sales Organization

CODE                                 Description                                      Prefix

1710                                  Sales Organization US                  US

1720                                  Sales Organization UR                  UR


The logic will only apply for their billing type “ZF2 – Billing Document”. It means, they do not require this prefix for the others billing types, as they will use the standard number range without prefix there.



STEP 1. Number Range Intervals:





STEP 2. Through the SAP FIORI Custom Fields and Logic app., set the BADI that fulfills your business rule. Let me show you how it works in my Fiori Launchpad:


STEP 3. Define Custom Routines & Assign to Billing Type. In my case Routine number 3000001 and Billing Type “ZF2”. You can see the detail in the video or screenshots:


Then you will assign the routine number with your document type:


Let’s carry out an example using the billing Type F2, we expect to have the document number without prefix. Now let’s run another one using ZF2, for this case we expect to have the document number with Prefix depending on Sales Organization.



With this steps you can in a simple way give high value to the Customer Business by configuring the billing document numbering and making posible to include business rules in the standard way too.


I hope you found this blog post Helpful.

Please contact me for any questions or comments!



Brought to you by the SAP S/4HANA RIG team.



For more information check Using Custom Logic (BAdI) to Implement Flexible Billing Document Numbering in the SAP Portal.

Randa Khaled

Randa Khaled

Author Since: November 19, 2020

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x