Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

Auto generation of number for a custom field

$
0
0

Purpose of this blog

In this blog I am sharing one of the requirement where user wanted to have an auto generation of number for a custom field called as 'Registration Number' for this we can follow different approach, but the approach which I followed was by using Number Range Objects. For this I created a custom number range. In this blog i will be mentioning how to create the custom number range object and how to use it in our ABAP program.

 

Steps

  1. Goto transaction SNRO.

1.png

 

Enter number range object name and click on create.

2. Depending on requirement choose other details. I used standard data type.

2.png

3. Select the buffering type

3.png

4.png

If NR Transaction is maintained then this provides you a transaction code for number range maintenance. This helps in production environment to maintain number range, and is better to have for the security reasons.

This tcode property can be checked in se93.

4. Now we can maintain the number range using tcode ZNRDOC.

5.png

Once the Number range object is created we can use it in our program.

In the program below function modules are used

  1. NUMBER_GET_NEXT – to get next number for the field for me it is Registration number.
  2. NUMBER_RANGE_INTERVAL_UPDATE -  to update Number range object
  3. NUMBER_RANGE_UPDATE_CLOSE – to close the changes on the database.


Advantage:

  • Maintenance of number range is easy .
  • Provides us a track of numbers consumed in NR status.




Viewing all articles
Browse latest Browse all 948

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>