Skip to Content
0
Former Member
Jul 09, 2015 at 09:52 AM

Call GUI_DOWNLOAD FM twice with different filetype to download two internal tables into same excel file

247 Views

Hi folks,

Please can you help?

What: Print two tables with different filetype in excel

Table 1: ASC

Table 2: DBF

When both tables are type ASC, the tables are downloaded correctly but when I use DBF for second table, it overwrites the first table even if APPEND = 'X' parameter has been used.

DBF is used in second table to manipulate the excel format for Amount column (highlighted below).

From 1.3 it will be printed as 1.30

To illustrate, please see below:

Code Snippet:

* Table 1 Print to excel - Vertical

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = w_error_filename

filetype = c_filetype

write_field_separator = 'X'

TABLES

data_tab = ts_vtab1

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 NE 0 .

MESSAGE e210 WITH 'Problem with the Download option.'(e83).

ENDIF.



* TABLE 2 PRINT

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = w_error_filename

filetype = c_filetype

append = 'X'

write_field_separator = 'X'

header = '00'

TABLES

data_tab = ts_error_list_final

fieldnames = y_htab2_header

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 NE 0 .

MESSAGE e210 WITH 'Problem with the Download option.'(e83).

ENDIF.

Thanks!!

Attachments

asc_dbf.jpg (76.1 kB)