WHEN 'EXCEL_DOWN'.
IF IT_DISP IS NOT INITIAL.
DATA: EXCEL_OUTPUT TYPE STRING.
DATA: EXCEL_OUTPUT_X TYPE XSTRING.
DATA: DISPOSITION TYPE STRING.
DATA: RESPONSE TYPE REF TO IF_HTTP_RESPONSE.
RESPONSE = RUNTIME->SERVER->RESPONSE.
CONSTANTS: CRLF TYPE STRING
VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
TAB TYPE STRING
VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
CLEAR EXCEL_OUTPUT.
CONCATENATE EXCEL_OUTPUT '헤' TAB
'더' TAB
'부' TAB
'분' CRLF "줄바꿈 구분자
INTO EXCEL_OUTPUT.
LOOP AT IT_DISP INTO WA_DISP.
CONCATENATE EXCEL_OUTPUT
WA_DISP-바 TAB "해당 필드명
WA_DISP-디 TAB
WA_DISP-부 TAB
WA_DISP-분 CRLF
INTO EXCEL_OUTPUT.
ENDLOOP.
DATA APP_TYPE TYPE STRING.
APP_TYPE = 'APPLICATION/MSEXCEL; CHARSET=UTF-16LE'.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = EXCEL_OUTPUT
MIMETYPE = 'APPLICATION/MSEXCEL; CHARSET=UTF-16LE'
IMPORTING
BUFFER = EXCEL_OUTPUT_X.
CONCATENATE CL_ABAP_CHAR_UTILITIES=>BYTE_ORDER_MARK_LITTLE
EXCEL_OUTPUT_X
INTO EXCEL_OUTPUT_X IN BYTE MODE.
RESPONSE->DELETE_HEADER_FIELD(
NAME = IF_HTTP_HEADER_FIELDS=>CACHE_CONTROL ).
RESPONSE->DELETE_HEADER_FIELD(
NAME = IF_HTTP_HEADER_FIELDS=>EXPIRES ).
RESPONSE->DELETE_HEADER_FIELD(
NAME = IF_HTTP_HEADER_FIELDS=>PRAGMA ).
RESPONSE->SET_DATA( DATA = EXCEL_OUTPUT_X ).
RESPONSE->SET_HEADER_FIELD( NAME = 'CONTENT-TYPE'
VALUE = 'APPLICATION/VND.MS-EXCEL' ).
NAVIGATION->RESPONSE_COMPLETE( ).
ENDIF.
'SAP > BSP' 카테고리의 다른 글
BSP - 숫자를 컨버젼하는 프로그램(3자리마다 컴마 찍자) (0) | 2008.02.25 |
---|---|
BSP - 파일 업로드와 다운로드 1 (0) | 2008.02.22 |
BSP - 각 필드의 자동 합계 소스 (0) | 2008.02.22 |
BSP - 나만의 EVENT 캐스팅 구문 (0) | 2008.02.22 |
BSP 정리 (0) | 2008.02.22 |