05/08/2010

Save XLS Files to Presentation Server


REPORT zteste.

DATA: your_file_name TYPE string,
your_file_path TYPE string,
the_full_path TYPE string.

TYPES:

BEGIN OF the_alv_structure,
field1(10) TYPE c,
field2(10) TYPE c,
END OF the_alv_structure.

DATA: the_alv_itab TYPE TABLE OF the_alv_structure.
DATA: wa LIKE LINE OF the_alv_itab.

wa-field1 = 'A1'.
wa-field2 = 'B1'.
APPEND wa TO the_alv_itab.

wa-field1 = 'A2'.
wa-field2 = 'B2'.
APPEND wa TO the_alv_itab.

wa-field1 = 'A3'.
wa-field2 = 'B3'.
APPEND wa TO the_alv_itab.

CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
default_extension = '.xls'
default_file_name = 'Text'
CHANGING
filename = your_file_name
path = your_file_path
fullpath = the_full_path.

CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = the_full_path
write_field_separator = 'X'
CHANGING
data_tab = the_alv_itab.

Nenhum comentário:

Postar um comentário