Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

gui_download

Former Member
0 Kudos

i was using FM gui download, and everything is fine.

Question is how to gave new name for every new downloaded record.

Eg. ABC_1.txt ; ABC_2.txt; ABC_1.txt;......ABC_n

1 ACCEPTED SOLUTION

former_member195698
Active Contributor
0 Kudos

use Concatenate to generate the file name and use a count variable.Increase the count for every loop pass...

loop at table.

count = count + 1

concatenate 'ABC_' count '.txt' into wf_filename.

Download this file

endloop

Or you can also use NUMBER RANGE object to generate a new number everytime you want to download a file.

Instead of declaring the count variable and incrementing it. Use the Number range object.

6 REPLIES 6

rainer_hbenthal
Active Contributor
0 Kudos

What is a record? What do you wanna achieve?

former_member195698
Active Contributor
0 Kudos

use Concatenate to generate the file name and use a count variable.Increase the count for every loop pass...

loop at table.

count = count + 1

concatenate 'ABC_' count '.txt' into wf_filename.

Download this file

endloop

Or you can also use NUMBER RANGE object to generate a new number everytime you want to download a file.

Instead of declaring the count variable and incrementing it. Use the Number range object.

Former Member
0 Kudos

Nick,

Your Question is not clear...

By Using GUI_DOWNLOAD you can download to only one file per one call of FM, you can not have multiple file names for one FM Call.

Regards,

Satish

Former Member
0 Kudos
* **********************************Create a SNRO 'ZOBJ'.

data: gc_range        TYPE inri-nrrangenr VALUE '1'.

  CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
      nr_range_nr             = gv_range
      object                  = 'ZOBJ'
    IMPORTING
      number                  = gv_no
    EXCEPTIONS
      interval_not_found      = 1
      number_range_not_intern = 2
      object_not_found        = 3
      quantity_is_0           = 4
      quantity_is_not_1       = 5
      interval_overflow       = 6
      buffer_overflow         = 7
      OTHERS                  = 8.
  IF sy-subrc EQ 0.
    CONCATENATE 'ABC_' gv_no ' .txt'INTO l_ofile1.
  ENDIF.

CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = l_ofile1
        filetype                = 'ASC'
      TABLES
        data_tab                = p_local_table
      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
        OTHERS                  = 22.
   
      MESSAGE e000 WITH text-036.
    ENDIF.

Former Member
0 Kudos

this files ABC_1.txt .....ABC_n will be view of some internal tables , every new view must have new number, that's the point.

0 Kudos

then use concatenate to build the filename and call gui_dowload as often as you need it.