2007 Mar 19 4:38 AM
hi experts,
cud u plz tell me in details with coding how to use NUMBER_GET_NEXT fm with the help of tc snro.
2007 Mar 19 4:42 AM
FU NUMBER_GET_NEXT
____________________________________________________
Short Text
NUmber range: Assigns next free number
Preliminary comment
This function module has been released.
The documentation is being revised so that it conforms to t
requirements for released function modules.
The function module assigns the next free numbers of a numb
number is assigned as a default if no larger number is dema
parameter QUANTITY. If more than one number is demanded and
numbers are available up to the interval limit, the numbers
assigned up to the interval limit. If the last number was a
first interval number is provided again during the next cal
The length of the number depends on the definition of the n
object. However, the length is not determined from the defi
allocating, but is calculated from the length of th from-nu
number range.
All exceptions are created with MESSAGE ... RAISING ... .
Example:
1. Object HUGO, not year-dependent, next free number searc
DATA: RC LIKE INRI-RETURNCODE,
Example:
1. Object HUGO, not year-dependent, next free number searched for
DATA: RC LIKE INRI-RETURNCODE,
NUMBER(10) TYPE C.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING OBJECT = 'HUGO'
NR_RANGE_NR = '01'
IMPORTING RETURNCODE = RC
NUMBER = NUMBER.
CASE RC.
WHEN ' '.
everything o.k.
WHEN '1'.
the assigned number lies in the critical area.
WHEN '2'.
this was the last number, next time the first number
will be assigned
ENDCASE.
2. Object EGON, year-dependent, next 5 free numbers for 1992 in company
code 0001 searched for.
DATA: RC LIKE INRI-RETURNCODE,
NUMBER(10) TYPE C,
YEAR LIKE INRI-TOYEAR,
QUAN LIKE INRI-QUANTITY.
YEAR = '1992'.
QUAN = 5.
T001-BUKRS = '0001'.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING OBJECT = 'EGON'
NR_RANGE_NR = '01'
SUBOBJECT = T001-BUKRS
TOYEAR = YEAR
IMPORTING RETURNCODE = RC
QUANTITY = QUAN
NUMBER = NUMBER.
last assigned number is in NUMBER
number of the assigned numbers is in QUANTITY
first free number is calculated from:
BER - QUANTITY + 1.
SE RC.
WHEN ' '.
everything o.k.
WHEN '1'.
the assigned number lies in the critical area.
WHEN '2'.
this was the last number, next time the first numb
ned
WHEN '3'.
more numbers are demanded than are available,
the number of the assigned numbers is in QUAN.
DCASE.
Message was edited by:
sunil kumar
2007 Mar 19 4:46 AM
Table control and NUMBER_GET_NEXT ? could you elobrate bit more?
aRs
2007 Mar 19 4:46 AM
Hi,
This fun module is used to generate continuous numbers for any document:
First you have to create an object in the SNRO Transaction, and that has to be passed to this fun module.
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,
Anji
2007 Mar 19 4:51 AM
Hi
Open this NUMBER_GET_NEXT FM in Se37.
Put crusor in FM mane then click -
> Button where-Used list .
You can find numbers of program so you can analysis what are the parameter need to pass and do as your requriment.
Thanks
Sasmita