‎2010 Mar 02 4:17 PM
hi all.
if i want get a boolean value that explain if there is a file in a server directory, can i use a particular function?
‎2010 Mar 03 8:55 AM
‎2010 Mar 02 4:22 PM
Hi,
If it is in the presentation server, Check out the class CL_GUI_FRONTEND_SERVICES. There is a method for checking the existence of the file.
‎2010 Mar 03 8:43 AM
‎2010 Mar 02 4:26 PM
If its presentation server use cl_gui_frontend_services=>file_exist
if application server then use DX_FILE_EXISTENCE_CHECK or just use a open dataset statement and check the value of sy-subrc.
‎2010 Mar 03 8:45 AM
‎2010 Mar 03 9:36 AM
This function module can be used for both servers.
parameters: p_file(128) .
at selection-screen on p_file.
perform check_file_exist using p_file sy-subrc.
if sy-subrc ne 0.
message e000 with 'File does not exist or Path+Filename > 128 chars'.
endif.
*&---------------------------------------------------------------------*
*& Form CHECK_FILE_EXIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_SY_SUBRC text
*----------------------------------------------------------------------*
form check_file_exist using p_file p_subrc.
data: l_exist(1).
call function 'DX_FILE_EXISTENCE_CHECK'
exporting
filename = p_file
pc = 'X' "if space then check is made in application server else in presentation server
importing
file_exists = l_exist.
if l_exist ne 'X'.
p_subrc = 8.
endif.
endform. " CHECK_FILE_EXIST
‎2010 Mar 03 8:55 AM
‎2010 Mar 03 8:56 AM
What kind of server? Presenation server or application server?