*&---------------------------------------------------------------------*
*& Report ZEXCEL_HELLOWORLD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zexcel_helloworld.
*----------------------------------------------------------------------*
* INCLUDE DECLARATIONS
*----------------------------------------------------------------------*
INCLUDE zgexcel01.
INCLUDE zgexcel02.
*&---------------------------------------------------------------------*
*& D A T A *
*&---------------------------------------------------------------------*
DATA : gw_font TYPE zfont.
*&---------------------------------------------------------------------*
*& S E L E C T I O N S *
*&---------------------------------------------------------------------*
PARAMETERS : p_file TYPE string DEFAULT 'C:\hello_world.xls'.
*&---------------------------------------------------------------------*
*& S T A R T O F S E L E C T I O N *
*&---------------------------------------------------------------------*
START-OF-SELECTION.
CALL FUNCTION 'ZG_GENERATE_EXCEL_HEADER'
TABLES
excel = gi_excel.
PERFORM table.
PERFORM tr.PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_0000 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'No border' "Text
gw_font.
PERFORM tr.PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'border' "Text
gw_font.
PERFORM endtr.
PERFORM tr.PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
'200' "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'WIDTH not work' "Text
gw_font.
PERFORM endtr.
PERFORM tr.PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
'2' "column span
space "row span
space "background color
space "Field Type
space "Format
'col span' "Text
gw_font.
PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'col span' "Text
gw_font.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "back ground color
space "Field Type
space "Format
'col span' "Text
gw_font.
PERFORM endtr.
PERFORM tr.PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
'2' "row span
space "back ground color
space "Field Type
space "Format
'row span' "Text
gw_font.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "back ground color
space "Field Type
space "Format
'row span' "Text
gw_font.
PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "back ground color
space "Field Type
space "Format
'row span' "Text
gw_font.
PERFORM endtr.
PERFORM tr. PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
'FF0000' "background color
space "Field Type
space "Format
'BGCOLOR not work' "Text
gw_font.
PERFORM endtr.
PERFORM tr. PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1011 "style
space "align
space "width
space "column span
space "row span
space "back ground color
space "Field Type
space "Format
'Format number' "Text
gw_font.
PERFORM td3_3 USING c_1110 "style
space "align
space "width
space "column span
space "row span
space "back ground color
'NUM' "Field Type
d_2 "Format
'10000' "Text
gw_font.
PERFORM endtr.
PERFORM tr. PERFORM endtr.
PERFORM tr.
PERFORM td3_3 USING c_1011 "style
space "align
space "width
space "column span
space "row span
space "back ground color
space "Field Type
space "Format
'Format date' "Text
gw_font.
PERFORM td3_3 USING c_1110 "style
space "align
space "width
space "column span
space "row span
space "back ground color
'DATE' "Field Type
space "Format
'20100203' "Text
gw_font.
PERFORM endtr.
*SIZE
PERFORM tr. PERFORM endtr.
CLEAR gw_font.
gw_font-size = '50'.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'Font size 50 not work' "Text
gw_font.
PERFORM endtr.
*COLOR
PERFORM tr. PERFORM endtr.
CLEAR gw_font.
gw_font-color = 'RED'.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'Font color red' "Text
gw_font.
PERFORM endtr.
*FACE
PERFORM tr. PERFORM endtr.
CLEAR gw_font.
gw_font-face = 'EucrosiaUPC'.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'Face EucrosiaUPC not work' "Text
gw_font.
PERFORM endtr.
*BOLD
PERFORM tr. PERFORM endtr.
CLEAR gw_font.
gw_font-bold = 'X'.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'Bold' "Text
gw_font.
PERFORM endtr.
*ITALIC
PERFORM tr. PERFORM endtr.
CLEAR gw_font.
gw_font-italic = 'X'.
PERFORM tr.
PERFORM td3_3 USING c_1111 "style
space "align
space "width
space "column span
space "row span
space "background color
space "Field Type
space "Format
'Italic' "Text
gw_font.
PERFORM endtr.
PERFORM endtable.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file
* FILETYPE = 'ASC'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
* SHOW_TRANSFER_STATUS = ABAP_TRUE
* IMPORTING
* FILELENGTH =
TABLES
data_tab = gi_excel
* FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ไม่มีความคิดเห็น:
แสดงความคิดเห็น