In most of the clients, there is a requirement to use state-wise prefixes and different number ranges for different billing types, and for this requirement SAP S/4 HANA 2020 new feature – Flexible billing document numbering could be used.
This blog is to handle the requirement in SAP S/4 HANA 2020 On-Premise version for different billing document number prefixes based on the state (region) and the different number range for the billing type as different billing types are used. Few billing types are GST relevant, few are VAT relevant, and others.
Solution scope based on the new concept of SAP S/4 HANA 2020 – Flexible billing document numbering.
Prefix should be defined based on the region (state) and different number range intervals will be used for configured billing types. If flexible document numbering is not configured for any particular billing type then it will pick the standard number range interval assigned to that billing type.
Configuration would be done by following below SPRO path:
Required prefixes would be configured in the below screen:
After the creation of prefixes, we have to create the number ranges from the below path based on the configured prefixes:
In the below screen, we have to enter the prefix which we defined in the above configuration path and have to create NR intervals:
Note: Total length given by SAP for billing document number is 10, so if you have used the prefix of 2 characters then you can only use the running number range of length: 8.
After creation of the NR prefix and intervals, we have to write the logic in BADI released by SAP.
There are 2 ways to do it:
- Through the SAP FIORI – Custom Fields and Logic App (not able to take the ss as FIORI is not working currently) – Steps are given in SAP help support portal.
- By writing logic in SAP provided BADI: SD_BIL_FLEX_NUMBERING
An example given by SAP in the given BADI to refer:
In the given example which is provided by SAP where number range prefix and interval has been picked up based on Billing document type, company code.
In the scenario which we have used to pick the NR prefix as ‘TN’ based on the state code and NR interval based on the billing type, we have to write the below logic:
Create the enhancement ID for the enhancement:
Note: we can create separate enhancement IDs for every billing type or can use the same enhancements ID for multiple billing types.
After that, we have to define the custom routine, and assignment of routine needs to be done with billing type from below SPRO path:
After creation of routine number, we have to assign the enhancement ID created under BADI:
After that, we have to assign the routine number to the billing type from below SPRO path:
Note: If you have used different enhancement IDs and assigned to the different custom routine then assign the respective routine to their billing type or use the same routine to multiple billing types.
The same feature is available for sales document (Sales order) numbering as well in SAP S/4 HANA 2020.