REPORT Excel.
TABLES:
sflight.
* header data................................
DATA :
header1 LIKE gxxlt_p-text VALUE 'Raj',
header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
* Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA END OF t_sflight.
* Internal table for holding the horizontal key.
DATA BEGIN OF t_hkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_h.
DATA END OF t_hkey .
* Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_v.
DATA END OF t_vkey .
* Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
INCLUDE STRUCTURE gxxlt_o.
DATA END OF t_online.
* Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
INCLUDE STRUCTURE gxxlt_p.
DATA END OF t_print.
* Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
INCLUDE STRUCTURE gxxlt_s.
DATA END OF t_sema.
* Retreiving data from sflight.
SELECT * FROM sflight
INTO TABLE t_sflight.
do 10 times.
enddo.
* Text which will be displayed online is declared here....
t_online-line_no = '1'.
t_online-info_name = 'Created by'.
t_online-info_value = 'Raj'.
APPEND t_online.
* Text which will be printed out..........................
t_print-hf = 'H'.
t_print-lcr = 'L'.
t_print-line_no = '1'.
t_print-text = 'This is the header'.
APPEND t_print.
t_print-hf = 'F'.
t_print-lcr = 'C'.
t_print-line_no = '1'.
t_print-text = 'This is the footer'.
APPEND t_print.
* Defining the vertical key columns.......
t_vkey-col_no = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.
t_vkey-col_no = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.
t_vkey-col_no = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.
t_vkey-col_no = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.
* Header text for the data columns................
t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.
t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.
t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.
t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.
t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.
t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.
* populating the SEMA data..........................
t_sema-col_no = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.
t_sema-col_no = 2.
APPEND t_sema.
t_sema-col_no = 3.
APPEND t_sema.
t_sema-col_no = 4.
APPEND t_sema.
t_sema-col_no = 5.
APPEND t_sema.
t_sema-col_no = 6.
APPEND t_sema.
t_sema-col_no = 7.
APPEND t_sema.
t_sema-col_no = 8.
APPEND t_sema.
t_sema-col_no = 9.
APPEND t_sema.
t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.
CALL FUNCTION 'XXL_FULL_API'
EXPORTING
* DATA_ENDING_AT = 54
* DATA_STARTING_AT = 5
filename = 'TESTFILE'
header_1 = header1
header_2 = header2
no_dialog = 'X'
no_start = ' '
n_att_cols = 6
n_hrz_keys = 1
n_vrt_keys = 4
sema_type = 'X'
* SO_TITLE = ' '
TABLES
data = t_sflight
hkey = t_hkey
online_text = t_online
print_text = t_print
sema = t_sema
vkey = t_vkey
EXCEPTIONS
cancelled_by_user = 1
data_too_big = 2
dim_mismatch_data = 3
dim_mismatch_sema = 4
dim_mismatch_vkey = 5
error_in_hkey = 6
error_in_sema = 7
file_open_error = 8
file_write_error = 9
inv_data_range = 10
inv_winsys = 11
inv_xxl = 12
OTHERS = 13
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*相关连接:http://blog.csdn.net/CompassButton/archive/2006/11/23/1408409.aspx
分享到:
相关推荐
使用oledb读写excel出使用oledb读写excel出使用oledb读写excel出使用oledb读写excel出
使用ADO连接Excel数据表,并读取的例子,比使用OLE的方法快N倍,并简单易用。
ABAP数据快速填充EXCEL,比传统的OLE方式要运行速度快。
一个基于Delphi语言编写的OLE自动化控件器,让Delphi支持打开.xls格式的Excel表格文件,简要概述一下实现步骤:建立OLE对象、使Excel可见,并将本程序最小化,以观察Excel的运行情况、使Excel窗口不可见、注意:...
OLE 操作Excel的示例,可以在窗体中显示Excel图表。
在SWT中使用OLE操纵Excel入门培训文档,里面整理了很多资源,下载的请使劲戳
OLE生成Excel代码实例
excel OLE控件操作 典型的几个操作办法
C#操作Excel(OLEDB)的实例,你可以参考这个代码发挥一下,写出属于自己的作品
ABAP OLE开发EXCEL
* 1、获取excel的工作簿名称【GetExcelSheetNames】。 * 2、获取指定工作簿的数据【GetExcelData】。 * 3、判断Excel工作簿是否存在【IsExist】。 * 4、对注册表的操作,解决读取Excel表格数据位数的限制...
以ole方式读取excel文件 ,以ole方式读取excel文件 ,以ole方式读取excel文件
abap excel ole 操作开发手册 指导文件 手把手教你如何操作
OLE导出: sap中abap 导出excel的方法很多,ole是其中一种,但其导出速度比较慢,一般只应用于对excel格式有特别要求的场所......
SWT通过OLE调用Excel,并对其进行操作。Eclipse3.3以上版本使用
ole去操作excel C#操作excel详解 直接上类,内有详细说明
使用OLE自动化方式操作Excel表格
VC通过ole方式操作excel,功能比较齐全。插入图片、数据导入导出、设置背景、 字体、合并单元格、设置边框、对齐方式等。此为exe文件,如果觉得可以,可索取源代码。
根据excel文件的完整存放路径,读取该excel文件所有的sheet的名字,默认的一般是sheet1,sheet2等,也可以自定义名字,得到的是一个DataTable,是sheet的名字集合。
ABAP ole下载到多个excel 上和一个excel上新增多个sheet 页 ;ABAP ole下载到多个exce PERFORM 注释了,和一个excel上新增多个sheet 页 ,注 是ABAP 代码 OLE