Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- FI 용어정리
- SAP
- 스마트폼
- sapa
- 방화벽
- EXIT
- 동적 쿼리
- 이명박
- Enhancement
- fi
- selection screen
- Standard Function
- 오라클 함수
- alv 정형화
- List box
- 엑소버드
- Java
- UTF-8
- ABAP
- ALV
- EUC-kr
- KOSA
- 머니플랜
- ole
- gimp
- badi
- 가계부
- Smart Forms
- 유닉스
- function
Archives
- Today
- Total
Drunken Lion
[OLE] Excel 양식 sample 본문
REPORT ztest.
* excel sheet download
TYPE-POOLS: OLE2.
TABLES: sscrfields.
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
SELECTION-SCREEN FUNCTION KEY 1.
INITIALIZATION.
sscrfields-functxt_01 = '@48@ 샘플파일다운로드'.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'FC01'.
PERFORM FILE_DOWNLOAD_RTN.
ENDIF.
*&---------------------------------------------------------------------*
*& Form FILE_DOWNLOAD_RTN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM file_download_rtn .
* start Excel
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
PERFORM err_hdl.
SET PROPERTY OF h_excel 'Visible' = 1.
PERFORM err_hdl.
* get list of workbooks, initially empty
CALL METHOD OF h_excel 'Workbooks' = h_mapl.
PERFORM err_hdl.
* add a new workbook
CALL METHOD OF h_mapl 'Add' = h_map.
PERFORM err_hdl.
* output column headings to active Excel sheet
PERFORM fill_cell USING 1 1 1 '자산번호'.
PERFORM fill_cell USING 1 2 1 '감가Key'.
PERFORM fill_cell USING 1 3 1 '내용연수'.
FREE OBJECT h_excel.
PERFORM err_hdl.
STOP.
ENDFORM. " FILE_DOWNLOAD_RTN
*&---------------------------------------------------------------------*
*& Form ERR_HDL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM err_hdl .
IF sy-subrc <> 0.
MESSAGE s003 DISPLAY LIKE 'W' WITH 'OLE 자동화 에러 :' sy-subrc.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
*&---------------------------------------------------------------------*
*& Form FILL_CELL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_1 text
* -->P_1 text
* -->P_1 text
* -->P_0196 text
*----------------------------------------------------------------------*
FORM fill_cell USING i j bold p_val.
CALL METHOD OF h_excel 'Cells' = h_zl
EXPORTING
#1 = i
#2 = j.
PERFORM err_hdl.
SET PROPERTY OF h_zl 'Value' = p_val .
PERFORM err_hdl.
GET PROPERTY OF h_zl 'Font' = h_f.
PERFORM err_hdl.
SET PROPERTY OF h_f 'Bold' = bold .
PERFORM err_hdl.
ENDFORM. " FILL_CELL
'SAP > ABAP' 카테고리의 다른 글
[OLE] 내 나름의 분석 (0) | 2009.10.12 |
---|---|
엑셀 / 텍스트 파일 업로드 (0) | 2009.09.28 |
파일 upload - upload 파일 종류 file filter (0) | 2009.09.18 |
LSMW Manual (0) | 2009.09.15 |
Selection Screen 에 Ucomm 추가 (0) | 2009.09.14 |