Application Development and Automation 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: 
Read only

function module similar to function module 'download' in unicode system

Former Member
0 Likes
601

I have function module called download which gives us a pop up to select a path in the presentation server for storing file and also to select the file type but in unicode systems 'download' function has become obsolete. I have used methods file_ save_dialog and gui_download of class cl_gui_frontend_services but am not able to get a proper popup for filename and file type. Please reply as soon as possible.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
576
DATA: rc TYPE i,
     
      it_files TYPE filetable.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS: p_file(1024) TYPE c OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.


  CALL METHOD cl_gui_frontend_services=>file_open_dialog
  CHANGING
     file_table              = it_files
     rc                      = rc.

 READ TABLE it_files INDEX 1 INTO p_file.
start-of-selection.

perform getdata.

form getdata.
DATA: file TYPE string.
  file = p_file.

  CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
            filename                = file
            has_field_separator     = 'X'
       TABLES
            data_tab                = itab
       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
            OTHERS                  = 17.
*IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.

endform.

reward if usefull.

5 REPLIES 5
Read only

Former Member
0 Likes
577
DATA: rc TYPE i,
     
      it_files TYPE filetable.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS: p_file(1024) TYPE c OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.


  CALL METHOD cl_gui_frontend_services=>file_open_dialog
  CHANGING
     file_table              = it_files
     rc                      = rc.

 READ TABLE it_files INDEX 1 INTO p_file.
start-of-selection.

perform getdata.

form getdata.
DATA: file TYPE string.
  file = p_file.

  CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
            filename                = file
            has_field_separator     = 'X'
       TABLES
            data_tab                = itab
       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
            OTHERS                  = 17.
*IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.

endform.

reward if usefull.

Read only

0 Likes
576

You may have to use the dowloan just the above manner.

Read only

0 Likes
576

Hi,

As I have mentioned that i am using file_open_dialog the way u did...it is giving me search help for the file name bt i want search help for filename and also for file type(i.e. 'ASC,'BIN'..etc)...before using gui_download..plz guide me as its very urgent..

Read only

former_member386202
Active Contributor
0 Likes
576

Hi,

Use GUI_DOWNLOAD

&----


*& Form sub_download

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sub_download.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = p_path

filetype = 'ASC'

  • APPEND = ' '

write_field_separator = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = it_final

  • FIELDNAMES =

  • 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

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " sub_download

Regards,

Prashant

Read only

0 Likes
576

Hi,

you are hardcoding the file type as ASC , but my requirement is to give a dynamic search help to the user asking for file type.