08-23-2007 7:42 AM
hi,
I have a parameter filename in the selection screen. is there a way where i can ensure that user doesnt enter any special characters in the file name?
thanks in advance.
Neha
08-23-2007 8:01 AM
Hi Neha.
You can use SF_SPECIALCHAR_DELETE function.
CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
EXPORTING
with_specialchar = in_file_name
IMPORTING
WITHOUT_SPECIALCHAR = out_file_name
EXCEPTIONS
RESULT_WORD_EMPTY = 1
OTHERS = 2
.
IF in_file_name <> out_file_name.
There is special characters in the file name.
endif.
Regards.
Sayan
08-23-2007 7:45 AM
check the method <b>FILE_EXIST</b> of the class <b>CL_GUI_FRONTEND_SERVICES</b>. It checks the existence of the file in the frontend, hope this helps.
08-23-2007 7:48 AM
Hi,
Check this
IF p_file NP '*.xls'.
MESSAGE e000 WITH text-t07.
ENDIF.
You can also use F4_FILENAME to get a popup when f4 is pressed
Regards,
Niyaz
08-23-2007 7:49 AM
Hi Neha,
You can write simple code in AT SELECTION-SCREEN event by giving the special charators. I hope try it.
Reward if useful.
kishore
08-23-2007 8:01 AM
Hi Neha.
You can use SF_SPECIALCHAR_DELETE function.
CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
EXPORTING
with_specialchar = in_file_name
IMPORTING
WITHOUT_SPECIALCHAR = out_file_name
EXCEPTIONS
RESULT_WORD_EMPTY = 1
OTHERS = 2
.
IF in_file_name <> out_file_name.
There is special characters in the file name.
endif.
Regards.
Sayan
08-23-2007 8:05 AM
Use this function to allow user to select a file name from the system.
Consider p_file is the name of the parameter.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = space
def_path = space
mask = ',.,..'
mode = space
title = space
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.