Friday, June 21, 2013

ABAP - Number Ranges creation

Create a number range object in the transaction code SNRO.
For Example YRYA_OBJ.

 DATAreturn TYPE inri-returncode.
  datanumber type num10.

CALL FUNCTION 'NUMBER_GET_NEXT'
  EXPORTING
    NR_RANGE_NR                   = '01'
    OBJECT                        = 'YRYA_OBJ'
*   QUANTITY                      = '1'
   SUBOBJECT                     = 'IN01'
   TOYEAR                        = '2012'
*   IGNORE_BUFFER                 = ' '
 IMPORTING
   NUMBER                        = number
*   QUANTITY                      =
   RETURNCODE                    = return
 EXCEPTIONS
   INTERVAL_NOT_FOUND            = 1
   NUMBER_RANGE_NOT_INTERN       = 2
   OBJECT_NOT_FOUND              = 3
   QUANTITY_IS_0                 = 4
   QUANTITY_IS_NOT_1             = 5
   INTERVAL_OVERFLOW             = 6
   BUFFER_OVERFLOW               = 7
   OTHERS                        = 8
          .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

writenumber.



OUTPUT:

 

 

The report will give you the number incemented by 1 for each execution. 

No comments:

Post a Comment