<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: One question about Selection screen in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642965#M1284261</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;file_exist&lt;/STRONG&gt;  method of class &lt;STRONG&gt;cl_gui_frontend_services&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;In the bellow code all your  &lt;STRONG&gt;requirements are fulfilled&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS : abap.
DATA : w_result TYPE abap_bool,
       w_file TYPE string.

PARAMETERS : p_file(30) TYPE c.
w_file = p_file.
CONDENSE w_file   NO-GAPS.

CALL METHOD cl_gui_frontend_services=&amp;gt;file_exist
  EXPORTING
    file                 = w_file
  RECEIVING
    result               = w_result  " Imports the results 
  EXCEPTIONS
    cntl_error           = 1
    error_no_gui         = 2
    wrong_parameter      = 3
    not_supported_by_gui = 4
    OTHERS               = 5.
IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

IF w_result NE 'X'.
  MESSAGE 'File path is not valid ! Enter a Valid path' TYPE 'I'.
  EXIT.   "  To retan the selection-screen If the file path is not correct
ENDIF.
WRITE : 'Test'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here  if the w_result's value is 'X' then the file exists else does not exist.&lt;/P&gt;&lt;P&gt;So accordingly Message and Exit are used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pinaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 May 2009 07:08:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-08T07:08:20Z</dc:date>
    <item>
      <title>One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642953#M1284249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing a report, on the selection screen, I need to input the file path and then do the file upload.&lt;/P&gt;&lt;P&gt;My question is about how to check the file path I put is correct or not? If it is incorrect, I want to get a message and the cursor still in the field and don't jump to the next page.&lt;/P&gt;&lt;P&gt;How can I do like that?&lt;/P&gt;&lt;P&gt;Any one has any suggestion, please help me.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chris Gu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:32:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642953#M1284249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642954#M1284250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Write the related code in AT SELECTION-SCREEN event &lt;/P&gt;&lt;P&gt;as below&lt;/P&gt;&lt;P&gt;If p_file Contains the reuired fiel type &lt;/P&gt;&lt;P&gt;for ex : .CSV , .TXT  or .xls or .DAT &lt;/P&gt;&lt;P&gt;if u r condtion fails provide a Error messaage saying that File type is wrong ...&lt;/P&gt;&lt;P&gt;Regarding File path : If u have laredy the defined file path the u can use that &lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:37:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642954#M1284250</guid>
      <dc:creator>shishupalreddy</dc:creator>
      <dc:date>2009-05-08T06:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642955#M1284251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the below pseudo code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS : p_upload TYPE rlgrap-filename.
AT SELECTION-SCREEN.
****validations on p_upload.
  PERFORM f_validationson_upload.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      f_validationson_upload
*&amp;amp;---------------------------------------------------------------------*
FORM f_validationson_upload .
  DATA: lv_len       TYPE i.
  lv_len = STRLEN( p_upload ).
  lv_len = lv_len - 4.
  TRANSLATE p_dnload+lv_len TO UPPER CASE.
  IF p_dnload+lv_len NE '.XLS'. "--&amp;gt; if file is not of type .'XLS' ,it will throw an error message
    MESSAGE text-020 TYPE 'S'.
    LEAVE TO SCREEN 1000.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; REgards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:37:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642955#M1284251</guid>
      <dc:creator>Mohamed_Mukhtar</dc:creator>
      <dc:date>2009-05-08T06:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642956#M1284252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;use the FM&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'&lt;/P&gt;&lt;P&gt;and method&lt;/P&gt;&lt;P&gt; CALL METHOD cl_gui_frontend_services=&amp;gt;directory_exist&lt;/P&gt;&lt;P&gt;CALL METHOD cl_gui_frontend_services=&amp;gt;file_exist&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass related file in the above FM and methods and try to validate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:40:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642956#M1284252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642957#M1284253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The FM whichyou are using for uploading the file will through the error message, then you can write the code set cursor on field and next populate the error message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:41:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642957#M1284253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642958#M1284254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use FM: 'GUI_UPLOAD' to read the file into an internal table 'AT SELECTION-SCREEN' event. If filepath is wrong, SY-SUBRC at end of FM will not be 0. Check for that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:42:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642958#M1284254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642959#M1284255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS :
  p_path  TYPE rlgrap-filename.

AT SELECTION-SCREEN ON p_path.

  IF sscrfields-ucomm = 'ONLI'.
    PERFORM validate_file_path USING p_path.
  ENDIF.                               " IF SSCRFIELDS-UCOMM = 'ONLI'..


FORM validate_file_path USING pv_path LIKE p_path.

  DATA: lw_path TYPE string,
        lw_return TYPE abap_bool.

  lw_path = pv_path.
  IF sy-ucomm = 'ONLI' AND p_path IS INITIAL.
    CLEAR sscrfields-ucomm.
    MESSAGE e010(ad) WITH 'Fill in All the required fields'.
  ELSE.
    CALL METHOD cl_gui_frontend_services=&amp;gt;directory_exist
      EXPORTING
        directory            = lw_path
      RECEIVING
        result               = lw_return
      EXCEPTIONS
        cntl_error           = 1
        error_no_gui         = 2
        wrong_parameter      = 3
        not_supported_by_gui = 4
        OTHERS               = 5.
    IF sy-subrc &amp;lt;&amp;gt; 0 OR lw_return IS INITIAL.
      CLEAR sscrfields-ucomm.
      MESSAGE e010(ad) WITH 'Invalid Path'.
    ENDIF.                             " IF SY-SUBRC &amp;lt;&amp;gt; 0 OR LW_RETURN.

  ENDIF.                               " IF SY-UCOMM = 'ONLI' AND P_PA.

ENDFORM.                               " FORM VALIDATE_FILE_PATH USING.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR use:   &lt;STRONG&gt;CALL METHOD cl_gui_frontend_services=&amp;gt;File_EXISTS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gurpreet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:43:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642959#M1284255</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642960#M1284256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use call method cl_gui_frontend_services=&amp;gt;file_exist to check if a file exists. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method cl_gui_frontend_services=&amp;gt;file_exist&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      file            = source_file_path&lt;/P&gt;&lt;P&gt;    receiving&lt;/P&gt;&lt;P&gt;      result          = rc&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      cntl_error      = 1&lt;/P&gt;&lt;P&gt;      error_no_gui    = 2&lt;/P&gt;&lt;P&gt;      wrong_parameter = 3&lt;/P&gt;&lt;P&gt;      others          = 4.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    raise cntl_error.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:45:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642960#M1284256</guid>
      <dc:creator>dev_parbutteea</dc:creator>
      <dc:date>2009-05-08T06:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642961#M1284257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    do it this way: check my code after calling gui_upload what condition i am using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters:
  p_file type rlgrap-filename.          " File name

*"--------------------------------------------------------------------*
*           AT SELECTION-SCREEN ON VALUE-REQUEST EVENT                
*"--------------------------------------------------------------------*
at selection-screen on value-request for p_file.

  perform get_file_name.

*"--------------------------------------------------------------------*
*                       AT SELECTION-SCREEN EVENT                     
*"--------------------------------------------------------------------*
at selection-screen on p_file.

  perform validate_upload_file.

*---------------------------------------------------------------------*
*  Form  GET_FILE_NAME                                                
*---------------------------------------------------------------------*
form get_file_name.

  call function 'F4_FILENAME'
   exporting
     program_name        = syst-cprog
     dynpro_number       = syst-dynnr
     field_name          = ' '
   importing
     file_name           = p_file.

endform.                               " GET_FILE_NAME

*---------------------------------------------------------------------*
*  Form  VALIDATE_UPLOAD_FILE                                         
*---------------------------------------------------------------------*
form validate_upload_file.

  data:
    lw_file  type string.              " File Path

  lw_file = p_file.

  call function 'GUI_UPLOAD'
    exporting
      filename                    = lw_file
      filetype                    = 'ASC'
      has_field_separator         = 'X'
      dat_mode                    = 'X'
    tables
      data_tab                    = t_final_data.
 

  IF sy-subrc ne 0 and t_final_data is initial. " here message if file path is wrong
    Message 'File not found' type 'E'.
  ELSEIF sy-subrc eq 0 and t_final_data is initial.
    Message 'File empty' type 'E'.
  ENDIF.                               

endform.                               " VALIDATE_UPLOAD_FILE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Pritam Ghosh on May 8, 2009 8:57 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:45:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642961#M1284257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642962#M1284258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this will help ful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data : P_file(50)    type c,&lt;/P&gt;&lt;P&gt;       P_pathname(4) type c,&lt;/P&gt;&lt;P&gt;         k(1024)     type c.&lt;/P&gt;&lt;P&gt;         &lt;/P&gt;&lt;P&gt;constant : filepath(4) type c value '.txt'.         &lt;/P&gt;&lt;P&gt;P_file = 'C:\Vendor.txt'.&lt;/P&gt;&lt;P&gt;k = strlen( p_file ).&lt;/P&gt;&lt;P&gt;k = k - 4.&lt;/P&gt;&lt;P&gt;p_pathname = p_file+k(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if filepath &amp;lt;&amp;gt; P_pathname.&lt;/P&gt;&lt;P&gt;Message 'Invalid path' TYPE 'E'.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:45:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642962#M1284258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642963#M1284259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use FM F4_FILENAME in AT SELECTION-SCREEN ON VALUE-REQUEST event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sarbajit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642963#M1284259</guid>
      <dc:creator>sarbajitm</dc:creator>
      <dc:date>2009-05-08T06:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642964#M1284260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use this method CL_GUI_FRONTEND_SERVICES-&amp;gt;FILE_EXIST ti check the existence of file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS: p_file TYPE char100.
DATA : g_file TYPE string.
DATA p_result TYPE c.

AT SELECTION-SCREEN ON p_file.
  g_file = p_file.
  CALL METHOD cl_gui_frontend_services=&amp;gt;file_exist
    EXPORTING
      file                 = g_file
    RECEIVING
      result               = p_result
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      wrong_parameter      = 3
      not_supported_by_gui = 4
      OTHERS               = 5.
  IF p_result EQ ' '.
    MESSAGE e016(pn) WITH 'File Does not exist/Check the File path'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 06:47:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642964#M1284260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T06:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642965#M1284261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can use &lt;STRONG&gt;file_exist&lt;/STRONG&gt;  method of class &lt;STRONG&gt;cl_gui_frontend_services&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;In the bellow code all your  &lt;STRONG&gt;requirements are fulfilled&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS : abap.
DATA : w_result TYPE abap_bool,
       w_file TYPE string.

PARAMETERS : p_file(30) TYPE c.
w_file = p_file.
CONDENSE w_file   NO-GAPS.

CALL METHOD cl_gui_frontend_services=&amp;gt;file_exist
  EXPORTING
    file                 = w_file
  RECEIVING
    result               = w_result  " Imports the results 
  EXCEPTIONS
    cntl_error           = 1
    error_no_gui         = 2
    wrong_parameter      = 3
    not_supported_by_gui = 4
    OTHERS               = 5.
IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

IF w_result NE 'X'.
  MESSAGE 'File path is not valid ! Enter a Valid path' TYPE 'I'.
  EXIT.   "  To retan the selection-screen If the file path is not correct
ENDIF.
WRITE : 'Test'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here  if the w_result's value is 'X' then the file exists else does not exist.&lt;/P&gt;&lt;P&gt;So accordingly Message and Exit are used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pinaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 07:08:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642965#M1284261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T07:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642966#M1284262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have one doubt, I have input a correct file path and the file exists in the local server, &lt;/P&gt;&lt;P&gt;when I use the  directory_exist method, result is still empty. Why? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chris Gu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Gu Chris on May 8, 2009 10:28 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 08:22:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642966#M1284262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T08:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: One question about Selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642967#M1284263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Solved.&lt;/P&gt;&lt;P&gt;Used the file_exist method, I can get the result = 'X' if I enter the existed file path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chris Gu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 08:28:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/one-question-about-selection-screen/m-p/5642967#M1284263</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-08T08:28:25Z</dc:date>
    </item>
  </channel>
</rss>

