<?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: Open File Functionality in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420495#M1049936</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; for navigating to the folder in your system the following code snippet will help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*Get the filename from user
  CALL METHOD cl_gui_frontend_services=&amp;gt;file_open_dialog
    EXPORTING
      window_title         = 'Title'
      default_extension    = 'XLS'
      file_filter          = cl_gui_frontend_services=&amp;gt;filetype_excel
    CHANGING
      filename             = lv_filename
      path                 = lv_path
      fullpath             = lv_fullpath
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Sep 2008 12:12:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-11T12:12:45Z</dc:date>
    <item>
      <title>Open File Functionality</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420491#M1049932</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 file is located on local disk, what is the FM that I can use to upload it into the SAP system, I want a Pop Up window so that i can browse through to upload the file and store the name of the file in a variable in the SAP Code.&lt;/P&gt;&lt;P&gt;Code Snippet Would Help Me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Harsha Ch.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 12:07:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420491#M1049932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T12:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Open File Functionality</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420492#M1049933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use FM GUI_UPLOAD to upload the file from presentation layer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETER: pfile LIKE rlgrap-filename OBLIGATORY.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'F4_FILENAME'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;P&gt;     program_name        = syst-cprog&lt;/P&gt;&lt;P&gt;     dynpro_number       = syst-dynnr&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FIELD_NAME          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   IMPORTING&lt;/P&gt;&lt;P&gt;     file_name           = pfile.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 12:09:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420492#M1049933</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T12:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Open File Functionality</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420493#M1049934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_rfname LIKE rlgrap-filename OBLIGATORY.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_rfname.&lt;/P&gt;&lt;P&gt;  PERFORM get_desktop_file_help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM upload_file_from_desktop CHANGING g_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Form  get_desktop_file_help&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM get_desktop_file_help.&lt;/P&gt;&lt;P&gt;  DATA : v_file LIKE rlgrap-filename.&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;      program_name  = syst-repid&lt;/P&gt;&lt;P&gt;      dynpro_number = syst-dynnr&lt;/P&gt;&lt;P&gt;      field_name    = 'P_RFNAME'&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      file_name     = v_file&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;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE i368(00) WITH 'Enter Correct File'.&lt;/P&gt;&lt;P&gt;    STOP.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    MOVE : v_file TO p_rfname.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " get_desktop_file_help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Form  upload_file_from_desktop&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM upload_file_from_desktop CHANGING p_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT sy-batch IS INITIAL.&lt;/P&gt;&lt;P&gt;    MESSAGE e368(00) WITH 'Files can only be uploaded'&lt;/P&gt;&lt;P&gt;                          'in foreground'.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                = p_rfname&lt;/P&gt;&lt;P&gt;        filetype                = 'DAT'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        data_tab                = it_data&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        conversion_error        = 1&lt;/P&gt;&lt;P&gt;        invalid_table_width     = 2&lt;/P&gt;&lt;P&gt;        invalid_type            = 3&lt;/P&gt;&lt;P&gt;        no_batch                = 4&lt;/P&gt;&lt;P&gt;        unknown_error           = 5&lt;/P&gt;&lt;P&gt;        gui_refuse_filetransfer = 6&lt;/P&gt;&lt;P&gt;        OTHERS                  = 7.&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;      MESSAGE i368(00) WITH 'Error while reading data from file'.&lt;/P&gt;&lt;P&gt;      MOVE : 'X' TO p_error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM.                    "upload_file_from_desktop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 12:10:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420493#M1049934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T12:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Open File Functionality</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420494#M1049935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have uploaded the file...i just want code for the pop-up&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 12:11:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420494#M1049935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T12:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Open File Functionality</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420495#M1049936</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; for navigating to the folder in your system the following code snippet will help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*Get the filename from user
  CALL METHOD cl_gui_frontend_services=&amp;gt;file_open_dialog
    EXPORTING
      window_title         = 'Title'
      default_extension    = 'XLS'
      file_filter          = cl_gui_frontend_services=&amp;gt;filetype_excel
    CHANGING
      filename             = lv_filename
      path                 = lv_path
      fullpath             = lv_fullpath
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 12:12:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420495#M1049936</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T12:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Open File Functionality</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420496#M1049937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK A2 WITH FRAME TITLE text-000.&lt;/P&gt;&lt;P&gt;PARAMETERS: filename LIKE RLGRAP-FILENAME OBLIGATORY&lt;/P&gt;&lt;P&gt;            DEFAULT  'c:\sapmoveA1.txt'.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK A2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write this under AT selection-screen event&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN on value-request for filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To select the file to upload&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call function 'WS_FILENAME_GET'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            def_filename     = ' '&lt;/P&gt;&lt;P&gt;            def_path         = 'C:\'&lt;/P&gt;&lt;P&gt;            mask             = ',&lt;STRONG&gt;.&lt;/STRONG&gt;,&lt;STRONG&gt;.&lt;/STRONG&gt;.'&lt;/P&gt;&lt;P&gt;            mode             = 'O'&lt;/P&gt;&lt;P&gt;            title            = 'Choose A File To Upload - AMEX'&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            filename         = filename&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            inv_winsys       = 1&lt;/P&gt;&lt;P&gt;            no_batch         = 2&lt;/P&gt;&lt;P&gt;            selection_cancel = 3&lt;/P&gt;&lt;P&gt;            selection_error  = 4&lt;/P&gt;&lt;P&gt;            others           = 5.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 12:21:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-file-functionality/m-p/4420496#M1049937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T12:21:07Z</dc:date>
    </item>
  </channel>
</rss>

