*&---------------------------------------------------------------------*
*& Report ZEXCEL_XLSX
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZEXCEL_XLSX.
DATA : gi_data TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
PARAMETERS : p_file type text128 DEFAULT '' .
START-OF-SELECTION.
SELECT * FROM vbak INTO TABLE GI_DATA UP TO 10 ROWS.
DATA : lv_filename TYPE string,
lv_fullpath TYPE string,
lv_file LIKE rlgrap-filename.
CONCATENATE sy-datum '_' sy-uzeit INTO lv_filename.
CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
EXPORTING
window_title = 'Download Label Printing'
default_extension = 'xlsx'
default_file_name = lv_filename
* WITH_ENCODING =
* FILE_FILTER =
initial_directory = 'C:\'
* DEFAULT_ENCODING =
IMPORTING
filename = lv_filename
* PATH =
fullpath = lv_fullpath
* USER_ACTION =
* FILE_ENCODING =
.
lv_file = lv_fullpath.
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_filename = lv_file
* I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = gi_data
* CHANGING
* I_TAB_CONVERTED_DATA =
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CONCATENATE 'Download to' lv_fullpath INTO lv_fullpath SEPARATED BY space.
MESSAGE lv_fullpath TYPE 'I'.
Subscribe to:
Post Comments (Atom)
0 Response to "Abap Create Excel Format XLSX"
Post a Comment