REFRESH MT_TITLE. CLEAR MS_TITLE.
MS_TITLE-NAME01 = '사번(08)'.
MS_TITLE-NAME02 = '직급(04)'.
MS_TITLE-NAME03 = '인사영역(04)'.
MS_TITLE-NAME04 = '인사하위영역(04)'.
MS_TITLE-NAME05 = '본부조직코드(08)'.
MS_TITLE-NAME06 = '처조직코드(08)'.
MS_TITLE-NAME07 = '사업소조직코드(08)'.
APPEND MS_TITLE TO MT_TITLE.
ENDMETHOD. "set_header
============================================================
METHOD DOWNLOAD_LAYOUT.
INCLUDE OLE2INCL. "Object Linking & Embedding
DATA: APPLICATION TYPE OLE2_OBJECT,
WORKBOOK TYPE OLE2_OBJECT,
SHEET TYPE OLE2_OBJECT,
CELLS TYPE OLE2_OBJECT.
DATA: L_INDEX(2) TYPE N.
DATA: L_FIELD(20) TYPE C.
FIELD-SYMBOLS:
CLEAR MS_TITLE.
CREATE OBJECT APPLICATION 'excel.application'.
SET PROPERTY OF APPLICATION 'visible' = 1.
CALL METHOD OF APPLICATION 'Workbooks' = WORKBOOK.
CALL METHOD OF WORKBOOK 'Add'.
* Create first Excel Sheet
CALL METHOD OF APPLICATION 'Worksheets' = SHEET
EXPORTING
#1 = 1.
CALL METHOD OF SHEET 'Activate'.
SET PROPERTY OF SHEET 'NAME' = 'SHEET1'.
READ TABLE MT_TITLE INDEX 1 INTO MS_TITLE.
CLEAR L_INDEX.
DATA: lr_tab_info TYPE REF TO cl_abap_tabledescr, "/alv
lr_tab_down TYPE REF TO cl_abap_tabledescr, "/download
lr_stru TYPE REF TO cl_abap_structdescr,
lr_stru_d TYPE REF TO cl_abap_structdescr,
lt_comp TYPE abap_component_tab,
lw_comp LIKE LINE OF lt_comp,
lt_comp_d TYPE abap_component_tab, "/download format
lw_comp_d LIKE LINE OF lt_comp_d,
l_col_count TYPE i.
*B* Get structure of data table
lr_tab_info ?= cl_abap_typedescr=>describe_by_data( MT_TITLE ).
lr_stru ?= lr_tab_info->get_table_line_type( ).
lt_comp = lr_stru->get_components( ).
l_col_count = LINES( lt_comp ).
DO l_col_count TIMES.
ADD 1 TO L_INDEX.
CALL METHOD OF SHEET 'Cells' = CELLS
EXPORTING
#1 = L_INDEX.
CONCATENATE 'MS_TITLE-NAME' L_INDEX INTO L_FIELD.
ASSIGN (L_FIELD) TO
SET PROPERTY OF CELLS 'Value' =
ENDDO.
* Save excel speadsheet to particular filename
CALL METHOD OF SHEET 'SaveAs'
EXPORTING
#1 = 'C:\\승진심사위원선정.xls'
#2 = 1."filename
"fileFormat
* Closes excel window, data is lost if not saved
ENDMETHOD. "download_layout
댓글 없음:
댓글 쓰기