on 01-31-2008 9:24 AM
hi gurus,
what is the Fm for auto generation of numbers & how to get the number range object for date.
thaks & regards,
santosh.
FM : NUMBER_GET_NEXT
DATA l_number TYPE i.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'ZTEST'
quantity = '1'
IMPORTING
number = l_number
quantity = ' '
RETURNCODE =
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
OTHERS = 7.
display l_number.
each time you call NUMBER_GET_RANGE the number is automatically increased.
You can also create the number range in your program instead of using SNRO with the functions:
NUMBER_RANGE_INTERVAL_LIST : verify if a number range already exist
NUMBER_RANGE_ENQUEUE : lock the specifier number range
NUMBER_RANGE_INTERVAL_UPDATE : create the number range
NUMBER_RANGE_UPDATE_CLOSE : commit changes NUMBER_RANGE_DEQUEUE : unlock
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use FM NUMBER_GET_NEXT
see the sample code:
&----
*& Form GET_NEXT_NUMBER
&----
FORM get_next_number_class.
DATA: inumber(10) TYPE c.
SELECT SINGLE * FROM klah WHERE class = 'PRODUCTCODE'.
IF sy-subrc NE 0.
entry in KLAH is not yet exiting => get next number
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'KLASSE'
quantity = '1'
SUBOBJECT = ' '
TOYEAR = '0000'
IGNORE_BUFFER = ' '
IMPORTING
number = inumber
QUANTITY =
RETURNCODE =
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
entry is already existing => take the number
inumber = klah-clint.
ENDIF.
ENDFORM. " GET_NEXT_NUMBER
Regards,
Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.