Skip to Content
author's profile photo Former Member
Former Member

finding next number

hi gurus,

what is the Fm for auto generation of numbers & how to get the number range object for date.

thaks & regards,

santosh.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:26 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 09:27 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.