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: 

diplay field names as headers using cl_gui_frontend_services->gui_download

Former Member
0 Kudos

Hello ABAP gurus,

actually i know how to display headers of fields using GUI_DOWNLOAD.

but i want to know how to to display headers of fields using cl_gui_frontend_services->gui_download, please give me reply and Advance thnx.

Regards

Mahesh

2 REPLIES 2

Former Member
0 Kudos

apart from the table u have declare a itab for field headers also ....char utilities.....

report ztest_download.

data: filename type string.

data: begin of data_tab occurs 0,

field1(1000),

end of data_tab.

data: begin of fieldnames occurs 0,

field1(1000),

end of fieldnames.

concatenate '9843298'

'jksdlkj' into data_tab-field1 separated by

cl_abap_char_utilities=>horizontal_tab.

append data_tab.

concatenate '123456789'

'rama krishna' into data_tab-field1 separated by

cl_abap_char_utilities=>horizontal_tab.

append data_tab.

concatenate 'Slno'

'data' into fieldnames-field1 separated by

cl_abap_char_utilities=>horizontal_tab.

append fieldnames.

filename = 'C:\test.xls'.

*filename = 'C:\test1.pdf'.

call function 'GUI_DOWNLOAD'

exporting

  • BIN_FILESIZE = BIN_FILESIZE

filename = filename

filetype = 'DAT'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • 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 = FILELENGTH

tables

data_tab = data_tab

fieldnames = 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.

else.

call method cl_gui_frontend_services=>execute

exporting

  • DOCUMENT =

application = 'EXCEL'

parameter = filename

  • DEFAULT_DIRECTORY =

  • MAXIMIZED =

  • MINIMIZED =

  • SYNCHRONOUS =

  • OPERATION = 'OPEN'

exceptions

cntl_error = 1

error_no_gui = 2

bad_parameter = 3

file_not_found = 4

path_not_found = 5

file_extension_unknown = 6

error_execute_failed = 7

synchronous_failed = 8

not_supported_by_gui = 9

others = 10

.

if sy-subrc <> 0.

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

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

endif.

endif.

reward points if helpful.........

0 Kudos

Hello Ramya,

you are using FM gui_download to display field headers in download file.but i need

to display field headers in download file using cl_gui_frontend_services->gui_download . so please tell me how to do using

cl_gui_frontend_services->gui_download .

Regards

Mahesh