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

replacement for DOWNLOAD function module in ECC6.0 ?

Former Member
0 Likes
518

DOWNLOAD function module is obsolete in ECC6.0.

What is the replacement for DOWNLOAD function module in ECC6.0 ?

I have tried with method:GUI_DOWNLOAD and Class: CL_GUI_FRONTEND_SERVICES.

But FIELDNAMES is missing in TABLES.

Please sugest me right method to be used in ECC6.0.

4 REPLIES 4
Read only

Former Member
0 Likes
483

Hi,

You are using the write FM.

They are the replacement of DOWNLOAD.

Regards,

Atish

Read only

gopi_narendra
Active Contributor
0 Likes
483
    call function 'GUI_DOWNLOAD'
      exporting
        FILENAME                = L_FNAME
        FILETYPE                = 'DAT'
      tables
        DATA_TAB                = IT_FINAL
        FIELDNAMES              = IT_HEADING " Header fields
      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.

You have the fieldnames as well in the fm : GUI_DOWNLOAD.

And you are on the right funtion module. please go thru it in SE37 where in you can find the fieldnames as well

Regards

Gopi

Read only

Former Member
0 Likes
483

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = LCNS_FLSEL

MULTISELECTION = ABAP_FALSE

CHANGING

FILE_TABLE = W_FLTB

RC = W_RC

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

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

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

ELSE.

LOOP AT W_FLTB INTO W_FLLN.

P_PATH = W_FLLN.

EXIT.

ENDLOOP.

ENDIF.

DATA: ld_filename TYPE string,

ld_path TYPE string,

ld_fullpath TYPE string,

ld_result TYPE i.

  • Display save dialog window

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

  • window_title = ' '

DEFAULT_EXTENSION = 'xls'

default_file_name = 'accountsdata'

INITIAL_DIRECTORY = 'c:\temp\'

CHANGING

filename = ld_filename

path = ld_path

fullpath = ld_fullpath

user_action = ld_result.

  • Check user did not cancel request

CHECK ld_result EQ '0'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = ld_fullpath

filetype = 'ASC'

  • APPEND = 'X'

write_field_separator = 'X'

  • CONFIRM_OVERWRITE = 'X'

TABLES

data_tab = it_datatab[] "need to declare and populate

EXCEPTIONS

file_open_error = 1

file_write_error = 2

OTHERS = 3.

ENDIF.

ENDIF.

Read only

Former Member
0 Likes
483

Hi,

You have a HEADER field in it, You can use that

call method cl_gui_frontend_services=>gui_download

exporting

  • BIN_FILESIZE =

filename = 'RESULTS_POLL.txt'

FILETYPE = 'ASC'

  • APPEND = SPACE

  • WRITE_FIELD_SEPARATOR = SPACE

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = SPACE

  • WRITE_LF = 'X'

  • COL_SELECT = SPACE

  • COL_SELECT_MASK = SPACE

  • DAT_MODE = SPACE

  • CONFIRM_OVERWRITE = SPACE

  • NO_AUTH_CHECK = SPACE

  • CODEPAGE = SPACE

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = SPACE

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • IMPORTING

  • FILELENGTH =

changing

data_tab = lt_singlerow

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

NOT_SUPPORTED_BY_GUI = 22

ERROR_NO_GUI = 23

others = 24

.

if sy-subrc <> 0.

write 'Unsuccessful'.

endif.

Regards

Sudheer