<?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: Checking Correct Filepath and file type in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363536#M1234377</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;User can enter anything on the selection screen and it will accept that, but f4 help is given so as to make the selection of the path easy and user friendly and to store the file in .xls format by default which was the doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nitin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2009 04:04:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-07T04:04:48Z</dc:date>
    <item>
      <title>Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363528#M1234369</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 a requirement where in i need to check if the filepath entered by the user is valid, the filepath is where the internal table that i created in will be downloaded using GUI_DOWNLOAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to know if the directory exist: like C: or E: &lt;/P&gt;&lt;P&gt;and the file is in excel format.. .xls&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvin Rosales on Apr 7, 2009 5:18 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:18:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363528#M1234369</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T03:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363529#M1234370</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 do validations using &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'&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;Regards,&lt;/P&gt;&lt;P&gt;jaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:26:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363529#M1234370</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T03:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363530#M1234371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to use the FM FILE_GET_NAME_USING_PATH and do manipulations with the help of sy-subrc value given by it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:33:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363530#M1234371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T03:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363531#M1234372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For checking whether the file path is valid, you can use the code as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  call method cl_gui_frontend_services=&amp;gt;directory_exist
    exporting
      directory       = im_dirname
    receiving
      result          = x_directory
    exceptions
      cntl_error      = 1
      error_no_gui    = 2
      wrong_parameter = 3
      others          = 4.

case sy-subrc.
 when 1.
" your exception handling here
 when 2.
.....
endcase.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For checking the file format entered by the user, you can force the user to enter 'xls' after the dot (.) in the filename parameter itself on event &lt;STRONG&gt;AT SELECTION-SCREEN&lt;/STRONG&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you've validated the above you can use code below to download internal table data to the specified directory:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      call method cl_gui_frontend_services=&amp;gt;gui_download
        exporting   bin_filesize            = p_bin_filesize
                    filename                = l_fullpath
                    filetype                = p_filetype
                    write_lf                = p_write_lf
                    trunc_trailing_blanks   = p_trunc_blanks
                    trunc_trailing_blanks_eol = p_trunc_blanks_eol
                    append                  = p_append
                    codepage                = p_codepage
        importing   filelength              = p_filelength
        changing    data_tab                = &amp;lt;l_data_tab&amp;gt;
        exceptions  file_write_error        = 1
                    no_batch                = 2
                    gui_refuse_filetransfer = 3
                    invalid_type            = 4
                    unknown_error           = 5
                    others                  = 6.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sougata.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:40:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363531#M1234372</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2009-04-07T03:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363532#M1234373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jayapradha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the FM and splitted the directory and the file name.. how can i use the call methods? Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:40:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363532#M1234373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T03:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363533#M1234374</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 simply use this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'KD_GET_FILENAME_ON_F4'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            static        = 'X'&lt;/P&gt;&lt;P&gt;            mask          = '*.XLS'&lt;/P&gt;&lt;P&gt;       CHANGING&lt;/P&gt;&lt;P&gt;            file_name     = pa_fname&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            mask_too_long = 1&lt;/P&gt;&lt;P&gt;            OTHERS        = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here Pa_fname is the parameter field on the selection screen where f4 help will be provided and this fm will be called and you can select the path where you want to store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nitin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:48:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363533#M1234374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T03:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363534#M1234375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; You can simply use this FM.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'&lt;/P&gt;&lt;P&gt;&amp;gt;        EXPORTING&lt;/P&gt;&lt;P&gt;&amp;gt;             static        = 'X'&lt;/P&gt;&lt;P&gt;&amp;gt;             mask          = '*.XLS'&lt;/P&gt;&lt;P&gt;&amp;gt;        CHANGING&lt;/P&gt;&lt;P&gt;&amp;gt;             file_name     = pa_fname&lt;/P&gt;&lt;P&gt;&amp;gt;        EXCEPTIONS&lt;/P&gt;&lt;P&gt;&amp;gt;             mask_too_long = 1&lt;/P&gt;&lt;P&gt;&amp;gt;             OTHERS        = 2.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Here Pa_fname is the parameter field on the selection screen where f4 help will be provided and this fm will be called and you can select the path where you want to store.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards&lt;/P&gt;&lt;P&gt;&amp;gt; Nitin.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the person who will be running the program is also able to type whatever he feels like into the parameter and run the program! How do you know that he will click on the possible entries button (F4) and then choose the filename? Who is going to look over his shoulder and check??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 03:56:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363534#M1234375</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2009-04-07T03:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363535#M1234376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sougata,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply just additional question in using the &lt;/P&gt;&lt;P&gt;CALL METHOD cl_gui_frontend_services=&amp;gt;directory_exist&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      directory       = g_path  -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;gt; will this be the filepath directory (example: C:\ )&lt;/P&gt;&lt;P&gt;    RECEIVING&lt;/P&gt;&lt;P&gt;      result          = x_directory -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;gt; what type of data will this be?&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;&lt;/P&gt;&lt;P&gt;sorry for the followup question&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 04:01:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363535#M1234376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T04:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363536#M1234377</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;User can enter anything on the selection screen and it will accept that, but f4 help is given so as to make the selection of the path easy and user friendly and to store the file in .xls format by default which was the doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nitin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 04:04:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363536#M1234377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T04:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363537#M1234378</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;CALL METHOD cl_gui_frontend_services=&amp;gt;directory_exist&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;directory = g_path -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;gt; will this be the filepath directory (example: C:\ )&lt;/P&gt;&lt;P&gt;RECEIVING&lt;/P&gt;&lt;P&gt;result = x_directory -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;gt; It is of type c (Contains 'X' or ' '). &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;&lt;/P&gt;&lt;P&gt;Based on the value of x_directory, u can write code as below.&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_directory = 'X'.&lt;/P&gt;&lt;P&gt;write:/ 'Directory exists'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write:/ 'Directory not exists'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 04:08:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363537#M1234378</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2009-04-07T04:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Correct Filepath and file type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363538#M1234379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From above code I am not getting How will you validate the FILE TYPE ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2009 06:41:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/checking-correct-filepath-and-file-type/m-p/5363538#M1234379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-06T06:41:50Z</dc:date>
    </item>
  </channel>
</rss>

