04-24-2007 10:22 AM
Hi,
my reqmnt is i want to validate a file path provided by the user in the selection screen.I want to check whether that particular file path is present in Application server or not. How to achieve this is ther any class or FM which will help me in achieving this result ?
regards,
Navneeth.K
04-24-2007 10:24 AM
try the statement
OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
if sy-subrc = 8.
message 'file not found' type i.
endif.
04-24-2007 10:24 AM
try the statement
OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
if sy-subrc = 8.
message 'file not found' type i.
endif.
04-24-2007 10:27 AM
You can give the search help of the application server file.Then u dont have to do any explicit validetion...
You can refer to below code to get the F4 help for application server:
PARAMETERS: p_phys RADIOBUTTON GROUP g1. " appln server file
PARAMETERS: p_ifile TYPE dxfile-filename LOWER CASE.
*---------------------------------------------------------------------
* AT SELECTION SCREEN ON VALUE REQUEST
*---------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ifile.
PERFORM help_input_file USING p_locl CHANGING p_ifile.
___________________________________________________
FORM help_input_file USING p_phys_file TYPE c
CHANGING p_source_path TYPE any.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_IFILE'
dyname = sy-repid
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
ENDFORM. " help_input_file
04-24-2007 10:28 AM
04-24-2007 10:30 AM
Hi Navneeth ,
Try this.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:file LIKE rlgrap-filename .
SELECTION-SCREEN END OF BLOCK b1.
DATA: v_file_name TYPE string,
v_file_name = file.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = v_file_name
RECEIVING
result = v_return
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE a000 WITH v_file_name text-001.(Specify valid file path)
EXIT.
ENDIF.
IF v_return IS INITIAL.
MESSAGE a000 WITH v_file_name text-002.("Invalid Filename ")
ENDIF.
Regards
Avi....