<?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: file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404018#M535758</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 think you can try out with this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS : p_file type rlgrap-filename .&lt;/P&gt;&lt;P&gt;DATA : V_rETURN TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**To generate F4 help to select the file path &lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.&lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'F4_FILENAME'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Validation whether filep path exists&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON P_FILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'WS_QUERY'&lt;/P&gt;&lt;P&gt;              EXPORTING &lt;/P&gt;&lt;P&gt;                 FILENAE = P_FILE&lt;/P&gt;&lt;P&gt;                 QUERY = 'FE'                   "FILE EXISTS&lt;/P&gt;&lt;P&gt;              IMPORTING &lt;/P&gt;&lt;P&gt;                 RETURN = V_RETURN .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF V_RETURN = 0.&lt;/P&gt;&lt;P&gt;      MESSAGE 'FILE DOES NOT EXIST' TYPE 'E'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you will get the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward for helpful answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2007 12:17:34 GMT</pubDate>
    <dc:creator>varma_narayana</dc:creator>
    <dc:date>2007-06-25T12:17:34Z</dc:date>
    <item>
      <title>file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404015#M535755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose I have a file stored in a particular directory in say PC, then how do I &lt;/P&gt;&lt;P&gt;(1) Validate if file path exists&lt;/P&gt;&lt;P&gt;(2) Fetch data from file of file path exists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 12:05:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404015#M535755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T12:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404016#M535756</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;Check this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: file type string,
      result(1) type c.
 
 
start-of-selection.
 
  file = 'C:/abaps/test.txt'.
 
  call method cl_gui_frontend_services=&amp;gt;file_exist
    exporting
      file            = file
    receiving
      result          = result.
 
 
  if result = 'X'.
    write:/ 'file does exist'.
  else.
    write:/ 'file not found'.
  endif.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If useful reward.&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 12:09:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404016#M535756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T12:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404017#M535757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sumit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  For presentation server ( desktop,pc ) you may use the FM GUI_UPLOAD&lt;/P&gt;&lt;P&gt;where u need to give the pathname of the file .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not validate but serves both 1 and 2 , sought by you .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the pathname/ file name is wrong, the FM throws exception .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~ Laxmi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Reward all helpful answers&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 12:13:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404017#M535757</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T12:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404018#M535758</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 think you can try out with this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS : p_file type rlgrap-filename .&lt;/P&gt;&lt;P&gt;DATA : V_rETURN TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**To generate F4 help to select the file path &lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.&lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'F4_FILENAME'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Validation whether filep path exists&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON P_FILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'WS_QUERY'&lt;/P&gt;&lt;P&gt;              EXPORTING &lt;/P&gt;&lt;P&gt;                 FILENAE = P_FILE&lt;/P&gt;&lt;P&gt;                 QUERY = 'FE'                   "FILE EXISTS&lt;/P&gt;&lt;P&gt;              IMPORTING &lt;/P&gt;&lt;P&gt;                 RETURN = V_RETURN .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF V_RETURN = 0.&lt;/P&gt;&lt;P&gt;      MESSAGE 'FILE DOES NOT EXIST' TYPE 'E'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you will get the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward for helpful answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 12:17:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404018#M535758</guid>
      <dc:creator>varma_narayana</dc:creator>
      <dc:date>2007-06-25T12:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404019#M535759</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;To validate file path:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM check_file_path .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To Check the file path&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF pa_upd EQ gc_x.&lt;/P&gt;&lt;P&gt;    SEARCH pa_file FOR gc_csv.&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE gc_zero_num.&lt;/P&gt;&lt;P&gt;      MESSAGE i019.&lt;/P&gt;&lt;P&gt;      LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " check_file_path&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To upload file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM upload_csv_file .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR gv_file.&lt;/P&gt;&lt;P&gt;  gv_file = pa_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      filename                = gv_file&lt;/P&gt;&lt;P&gt;      filetype                = gc_asc&lt;/P&gt;&lt;P&gt;      has_field_separator     = gc_x&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data_tab                = gt_dummy&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      file_open_error         = 1&lt;/P&gt;&lt;P&gt;      file_read_error         = 2&lt;/P&gt;&lt;P&gt;      no_batch                = 3&lt;/P&gt;&lt;P&gt;      gui_refuse_filetransfer = 4&lt;/P&gt;&lt;P&gt;      invalid_type            = 5&lt;/P&gt;&lt;P&gt;      no_authority            = 6&lt;/P&gt;&lt;P&gt;      unknown_error           = 7&lt;/P&gt;&lt;P&gt;      bad_data_format         = 8&lt;/P&gt;&lt;P&gt;      header_not_allowed      = 9&lt;/P&gt;&lt;P&gt;      separator_not_allowed   = 10&lt;/P&gt;&lt;P&gt;      header_too_long         = 11&lt;/P&gt;&lt;P&gt;      unknown_dp_error        = 12&lt;/P&gt;&lt;P&gt;      access_denied           = 13&lt;/P&gt;&lt;P&gt;      dp_out_of_memory        = 14&lt;/P&gt;&lt;P&gt;      disk_full               = 15&lt;/P&gt;&lt;P&gt;      dp_timeout              = 16&lt;/P&gt;&lt;P&gt;      OTHERS                  = 17.&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE gc_zero_num.&lt;/P&gt;&lt;P&gt;    MESSAGE i006.&lt;/P&gt;&lt;P&gt;    LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check if the input file is blank&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF gt_dummy[] IS INITIAL.&lt;/P&gt;&lt;P&gt;    MESSAGE i007.&lt;/P&gt;&lt;P&gt;    LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;  ENDIF.&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;Kannaiah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 12:52:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file/m-p/2404019#M535759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T12:52:50Z</dc:date>
    </item>
  </channel>
</rss>

