05-11-2010 9:44 AM
Hi experts
I would like to send a sequence number in a file name and use the code below.
DATA: bla, bla, bla
selection-screen begin of block blk1 with frame title text-001.
parameters: P_FILE type string obligatory lower case.
selection-screen end of block blk1.
CALL FUNCTION 'NUMBER_GET_NEXT_SOP'
EXEPTION
nrrangenr = NUMBERRANGENUMBER
object = 'ZHR_SEQNR'
quantity = '1'
mandt = SY-MANDT
IMPORTING
number = ZSEQNR
CONCATENATE '/usr/sap/' zseqnr '_' sy-datum '.txt' into p_file.
select * from ..............
The parameters should look like /usr/sap/0000000001_20100511.txt but it looks like this /usr/sap/_20100511.txt
If i call the function modul above, further down, after i have done all the selections i get the sequence number but then it is to late, the parameter has already been set.
Anyone having any idea // Peter B
05-11-2010 9:51 AM
Hi, try this
selection-screen begin of block blk1 with frame title text-001.
parameters: P_FILE type string obligatory lower case.
selection-screen end of block blk1.
INITIALIZATION. "You should put this piece of code at initialization event
CALL FUNCTION 'NUMBER_GET_NEXT_SOP'
EXEPTION
nrrangenr = NUMBERRANGENUMBER
object = 'ZHR_SEQNR'
quantity = '1'
mandt = SY-MANDT
IMPORTING
number = ZSEQNR
CONCATENATE '/usr/sap/' zseqnr '_' sy-datum '.txt' into p_file.
START-OF-SELECTION. "THe selection must be under START-OF-SELECTION event
Select *.....
ATTENTION! If you don't lock the paramter p_file, the user can change it.
05-11-2010 9:51 AM
Hi, try this
selection-screen begin of block blk1 with frame title text-001.
parameters: P_FILE type string obligatory lower case.
selection-screen end of block blk1.
INITIALIZATION. "You should put this piece of code at initialization event
CALL FUNCTION 'NUMBER_GET_NEXT_SOP'
EXEPTION
nrrangenr = NUMBERRANGENUMBER
object = 'ZHR_SEQNR'
quantity = '1'
mandt = SY-MANDT
IMPORTING
number = ZSEQNR
CONCATENATE '/usr/sap/' zseqnr '_' sy-datum '.txt' into p_file.
START-OF-SELECTION. "THe selection must be under START-OF-SELECTION event
Select *.....
ATTENTION! If you don't lock the paramter p_file, the user can change it.
05-11-2010 10:02 AM
Unfortunately, that did not help.
Any other suggestions?
// Peter B
05-11-2010 10:05 AM
05-11-2010 10:27 AM
ZSEQNR is declared as CHAR10
The function module works perfect if it's placed further down in the program.
// Peter B
05-11-2010 10:31 AM
Can you put a break point after INITIALIZATION and check if p_file is compiled in the right way, with the seq. number?
05-11-2010 10:35 AM
Hi,
If you execute the function module independently in SE37, are you getting the desired output ?
Regards
Vinod
05-11-2010 11:31 AM
Hi.
I have executed the FM in SE37 and there it works fine.
I have also put a break after the initialization in the program and had a look, but no sequence number is created.
// Peter B
05-11-2010 11:35 AM
Hi,
Check inside the program where you have defined the value for parameter "NUMBERRANGENUMBER" ?
Regards
Vinod
05-11-2010 11:56 AM
Data: zhr_seqnr like inri-object,
numberrangenumber like inri-nrrangenr.
numberrangenumber = '01'.
These are defined before the selection-screen.
// Peter B
05-11-2010 12:16 PM
Hi,
I simulated your code with some changes & working properly
selection-screen begin of block blk1 with frame title text-001.
parameters: p_file type char256 obligatory lower case.
selection-screen end of block blk1.
data zseqnr(10) type n.
initialization. "You should put this piece of code at initialization event
call function 'NUMBER_GET_NEXT_SOP'
exporting
nr_range_nr = '01'
object = 'ZTEST'
quantity = '1'
mandt = sy-mandt
importing
number = zseqnr.
concatenate '/usr/sap/' zseqnr '_' sy-datum '.txt' into p_file.
start-of-selection.
write 😕 p_file.
Regards
Vinod
05-11-2010 12:33 PM
Thank you very much Vinod.
I hardcoded nr_range_nr (01) and now it works fine.
// Peter B