2007 Dec 26 11:03 AM
Hi,
I want to auto generate a number for my custom screen like PO number or SO number in standard.
Is there any function module for this.
thnx in advance
Priya
2007 Dec 26 11:16 AM
But why do u need a FM for this if it is in standard for PO or so , It will trigger from SNRO .
Explicitly if u need to use in ur program u need to use this FM .
See for this u need to use this Fm 'NUMBER_GET_NEXT' .
Before that u need to maintain object and subobject for the numebr generation which is normally done by the functional consultants .
They do this configuration in Tcode SNRO .
Collect the parameters for this FM from the object .
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'XXXXXX''
QUANTITY = 'X'
SUBOBJECT = 'XXXX-FIELD'
TOYEAR = '0000'
IGNORE_BUFFER = ' '
IMPORTING
NUMBER = INTERNAL TABLE
Internal table will hold the number of the sequence.
For ur case when the configuration is done in SNRO that will inturn pick the number in sequence . No need of FM
Regards,
Vijay.
2007 Dec 26 11:06 AM
Hi,
check the function module
NUMBER_RANGE_INTERVAL_UPDATE
regards,
\siva chalasani.
2007 Dec 26 11:13 AM
ARF_DETERMINE_SCREEN_NUMBER Determine actual screen number
DETERMINE_SCREEN_NUMBER Determine actual screen number
2007 Dec 26 11:16 AM
But why do u need a FM for this if it is in standard for PO or so , It will trigger from SNRO .
Explicitly if u need to use in ur program u need to use this FM .
See for this u need to use this Fm 'NUMBER_GET_NEXT' .
Before that u need to maintain object and subobject for the numebr generation which is normally done by the functional consultants .
They do this configuration in Tcode SNRO .
Collect the parameters for this FM from the object .
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'XXXXXX''
QUANTITY = 'X'
SUBOBJECT = 'XXXX-FIELD'
TOYEAR = '0000'
IGNORE_BUFFER = ' '
IMPORTING
NUMBER = INTERNAL TABLE
Internal table will hold the number of the sequence.
For ur case when the configuration is done in SNRO that will inturn pick the number in sequence . No need of FM
Regards,
Vijay.
2007 Dec 26 2:28 PM
Hi this code will work for u to generate an auto code. And later u need some more code for updating this auto generated code into DB.
code:
Function zbapi_lifecycle_codegeneration.
Declaration of variables
DATA : lv_dlcode TYPE string .
DATA : lv_str1 TYPE string,
lv_str2(10) TYPE c ,
lv_number TYPE i ,
itab TYPE TABLE OF string,
text TYPE string .
checking if any previous codes are present.
SELECT SINGLE MAX( dlcode ) FROM zse_devlifecycle INTO lv_dlcode .
IF lv_dlcode IS NOT INITIAL.
CONDENSE lv_dlcode .
lv_str1 = lv_dlcode(2) .
lv_str2 = lv_dlcode+2(3).
ADD 1 TO lv_str2 .
CONDENSE lv_str2 .
lv_number = STRLEN( lv_str2 ).
IF lv_number EQ 1 .
perfixing the generated code with 00 so that it looks like the given format.
CONCATENATE lv_str1 '00' lv_str2 INTO e_dlcode.
ELSEIF lv_number EQ 2 .
CONCATENATE lv_str1 '0' lv_str2 INTO e_dlcode .
ELSE .
CONCATENATE lv_str1 lv_str2 INTO e_dlcode.
ENDIF .
ELSEIF lv_dlcode IS INITIAL .
e_dlcode = 'LC001'.
ENDIF.
ENDFUNCTION.
with regards,
Hema Sundara.
pls give points if this works for u.