<?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: variable path for up/downloading file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911657#M57194</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;  Have a parameter for the 'file path' in the selection screen of the report and provide f4 help for that field, if the user changes the value by choosing f4 option, the changed value will be available in the parameter field, that can be passed to the function module used to download the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jun 2005 06:59:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-06-10T06:59:01Z</dc:date>
    <item>
      <title>variable path for up/downloading file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911656#M57193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i´ve developed a report that reads a file from a folder (input folder), then processes the data and finally deletes this file (from input folder) and downloads it to a new folder (output folder).&lt;/P&gt;&lt;P&gt;If user decides to use a &lt;U&gt;new path for up/download&lt;/U&gt; how can i control this new situation? via a table storing different paths?&lt;/P&gt;&lt;P&gt;Any suggestion will be welcomed.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 06:49:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911656#M57193</guid>
      <dc:creator>former_member182371</dc:creator>
      <dc:date>2005-06-10T06:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: variable path for up/downloading file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911657#M57194</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;  Have a parameter for the 'file path' in the selection screen of the report and provide f4 help for that field, if the user changes the value by choosing f4 option, the changed value will be available in the parameter field, that can be passed to the function module used to download the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 06:59:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911657#M57194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-10T06:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: variable path for up/downloading file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911658#M57195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;what i´m trying to control is to avoid modifying the program when the up/download path changes.&lt;/P&gt;&lt;P&gt;The user would rather prefer modifying an entry in a table and not the program.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 07:05:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911658#M57195</guid>
      <dc:creator>former_member182371</dc:creator>
      <dc:date>2005-06-10T07:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: variable path for up/downloading file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911659#M57196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;you're right, I've faced this issue several times before, and this is how I achieved it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Selection-screen
PARAMETERS: p_fileup LIKE rlgrap-filename OBLIGATORY,
            p_filedn LIKE rlgrap-filename OBLIGATORY.

* Events
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fileup.
  PERFORM f4_fichero USING p_fileup.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filedn.
  PERFORM f4_fichero USING p_filedn.

* Main program
START-OF-SELECTION.
  PERFORM carga_fichero.
*... further processing
  PERFORM descarga_fichero_errores.

* Routines
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  f4_fichero
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;_FILE  text
*----------------------------------------------------------------------*
FORM f4_fichero USING _file.
*
  DATA: l_subrc TYPE n.

  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
*   EXPORTING
*     PROGRAM_NAME        = sy-cprog
*     DYNPRO_NUMBER       = sy-dynnr
*     FIELD_NAME          = ' '
*     STATIC              = ' '
*     MASK                = ' '
    CHANGING
      file_name           = _file
    EXCEPTIONS
      mask_too_long       = 1
      error_message       = 2
      OTHERS              = 3.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    l_subrc = sy-subrc.

    MESSAGE e000(zf)
      WITH 'Error en función'(200)
           'KD_GET_FILENAME_ON_F4'
           'SY-SUBRC:'(201)
           l_subrc.
  ENDIF.
*
ENDFORM.                    " f4_fichero

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  carga_fichero
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM carga_fichero.
*
  DATA: l_subrc TYPE n.
  DATA: l_filename TYPE string.

  l_filename = p_fileup.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                      = l_filename
      filetype                      = 'ASC'
      has_field_separator           = c_yes
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = 'X'
*   IMPORTING
*     FILELENGTH                    =
*     HEADER                        =
    TABLES
      data_tab                      = t_fichero
    EXCEPTIONS
      file_open_error               = 1
      file_read_error               = 2
      no_batch                      = 3
      gui_refuse_filetransfer       = 4
      invalid_type                  = 5
      no_authority                  = 6
      unknown_error                 = 7
      bad_data_format               = 8
      header_not_allowed            = 9
      separator_not_allowed         = 10
      header_too_long               = 11
      unknown_dp_error              = 12
      access_denied                 = 13
      dp_out_of_memory              = 14
      disk_full                     = 15
      dp_timeout                    = 16
      error_message                 = 17
      OTHERS                        = 18.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    l_subrc = sy-subrc.

    MESSAGE e000(zf)
      WITH 'Error en función'(200)
           'GUI_UPLOAD'
           'SY-SUBRC:'(201)
           l_subrc.
  ENDIF.
*
ENDFORM.                    " carga_fichero

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  descarga_fichero_errores
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM descarga_fichero_errores.
*
  DATA: l_subrc TYPE n.
  DATA: l_filename TYPE string.
  DATA: lt_fichero LIKE e_fichero_entrada OCCURS 200 WITH HEADER LINE.

  l_filename = p_filedn.

  LOOP AT t_fichero WHERE NOT xerror IS initial.
    CLEAR: lt_fichero.
    MOVE-CORRESPONDING t_fichero TO lt_fichero.
    APPEND lt_fichero.
  ENDLOOP.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*     BIN_FILESIZE                  =
      filename                      = l_filename
      filetype                      = 'ASC'
*     APPEND                        = ' '
      write_field_separator         = c_yes
*     HEADER                        = '00'
*     TRUNC_TRAILING_BLANKS         = ' '
*     WRITE_LF                      = 'X'
*     COL_SELECT                    = ' '
*     COL_SELECT_MASK               = ' '
*   IMPORTING
*     FILELENGTH                    =
    TABLES
      data_tab                      = lt_fichero
    EXCEPTIONS
      file_write_error              = 1
      no_batch                      = 2
      gui_refuse_filetransfer       = 3
      invalid_type                  = 4
      no_authority                  = 5
      unknown_error                 = 6
      header_not_allowed            = 7
      separator_not_allowed         = 8
      filesize_not_allowed          = 9
      header_too_long               = 10
      dp_error_create               = 11
      dp_error_send                 = 12
      dp_error_write                = 13
      unknown_dp_error              = 14
      access_denied                 = 15
      dp_out_of_memory              = 16
      disk_full                     = 17
      dp_timeout                    = 18
      file_not_found                = 19
      dataprovider_exception        = 20
      control_flush_error           = 21
      error_message                 = 22
      OTHERS                        = 23.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    l_subrc = sy-subrc.

    MESSAGE e000(zf)
      WITH 'Error en función'(200)
           'GUI_DOWNLOAD'
           'SY-SUBRC:'(201)
           l_subrc.
  ENDIF.
*
ENDFORM.                    " descarga_fichero_errores
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The thing is, I ask for 2 paths: input file and error in output file. Then I code some f4* routines. Then I upload the input file (f4_carga_fichero), do the processing, and finally I loop at the records with error and download these records via form descarga_fichero_errores.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps. BR,&lt;/P&gt;&lt;P&gt;Alvaro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: Pablo-&amp;gt;Forza Atleti!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 07:06:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911659#M57196</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-06-10T07:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: variable path for up/downloading file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911660#M57197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thanks Alvaro you´re always a great help.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2005 08:47:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-path-for-up-downloading-file/m-p/911660#M57197</guid>
      <dc:creator>former_member182371</dc:creator>
      <dc:date>2005-06-10T08:47:31Z</dc:date>
    </item>
  </channel>
</rss>

