Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Generating automatic numbers

Former Member
0 Likes
639

hi,

I need any Fm which genrates serial number automatically.

5 REPLIES 5
Read only

ferry_lianto
Active Contributor
0 Likes
613

Hi,

If you are looking to get the next number from a serial number range object that you have, then you will have to use the NUMBER_GET_NEXT function module and pass the number range object.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
613

Use the function "NUMBER_GET_NEXT "

Read only

0 Likes
613

can u please explain the parametes,

i am unable to get the output.

Read only

ferry_lianto
Active Contributor
0 Likes
613

Hi,

Please check this sample codes form other thread.


 INCLUDE ZRANGENO.
 
data: wnorange like INRI-NRRANGENR,      "number range,
      wsubobj  like inri-SUBOBJECT,            "sub object
      wdocno(12).
 
* Steps :-
* 1. Number range Sub Object must be maintain in table ZSGRP
*    You can used transaction SE16 to create a table entries.
* 2. Maintain number range and intervals in transaction code SNUM
*
 
*
 
call function 'NUMBER_RANGE_ENQUEUE'
         exporting
               object              = 'ZOWNNO'   "Create with SNUM
         exceptions
               foreign_lock        = 1
               object_not_found    = 2
               system_failure      = 3
               others              = 4.
  if sy-subrc ne 0.
*   message e086 with 'Lock error' sy-subrc.
  endif.
 
  call function 'NUMBER_GET_NEXT'
         exporting
               nr_range_nr         = wnorange
               object              = 'ZOWNNO'
               subobject           = wsubobj
         importing
               number                  = wdocno  "Number generated by SAP
         exceptions
               interval_not_found      = 1
               number_range_not_intern = 2
               object_not_found        = 3
               quantity_is_0           = 4
               quantity_is_not_1       = 5
               internal_overflow       = 6
               others                  = 7.
  if sy-subrc ne 0.
*   message e086 with 'Number Range' sy-subrc.
  endif.
 
  call function 'NUMBER_RANGE_DEQUEUE'
    exporting
      object                 = 'ZOWNNO'.
 
  if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.


Regards,

Ferry Lianto

Read only

Former Member
0 Likes
613