TYPES : BEGIN OF ty_struct,
col_name(30),
END OF ty_struct,
ty_columns TYPE STANDARD TABLE OF ty_struct WITH EMPTY KEY.
DATA : lt_columns TYPE ty_struct,
lt_temp TYPE dfies_tab.
TRY.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'ZSTRUCTURE_NAME'
langu = sy-langu
TABLES
dfies_tab = lt_temp
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc = 0.
lt_columns = CORRESPONDING #( lt_temp MAPPING col_name = fieldtext ).
ENDIF.
CATCH cx_root.
"Please write your own exception handling code here
ENDTRY.
IF gt_data_table IS NOT INITIAL.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = p_download
TABLES
data_tab = gt_data_table
fieldnames = lt_columns
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_pivot_fields = 7
download_problem = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid
TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE |File downloaded successfully| TYPE 'S'.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |