- 浏览: 404153 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
yiming163:
thank you!
eCATT, LSMW in detail -
泡泡蓝:
把WITH INCLUDES.改成 WITH ANALYSI ...
User Exits,Customer Exits,BAdI and BTE -
泡泡蓝:
王弈争 写道泡泡蓝 写道SCAN ABAP-SOURCE SO ...
User Exits,Customer Exits,BAdI and BTE -
王弈争:
泡泡蓝 写道SCAN ABAP-SOURCE SOURCETA ...
User Exits,Customer Exits,BAdI and BTE -
jgtang82:
泡泡,我没遇到你所说的问题呀
User Exits,Customer Exits,BAdI and BTE
REPORT ZEXCELWRITE NO STANDARD PAGE HEADING..
* this report demonstrates how to send some ABAP data to an
* EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
* handles for OLE objects
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
TABLES: SPFLI.
DATA H TYPE I.
* table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*&---------------------------------------------------------------------*
*& Event START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
* read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
* display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
* display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
* start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
* PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
* CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
.
* PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
* 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.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 1 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
* copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
* changes by Kishore - start
* CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTIN G #1 = 2.
PERFORM ERR_HDL.
* add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP
EXPORTING
#1 = 2.
PERFORM ERR_HDL.
* tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 1 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
* copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
* changes by Kishore - end
* disconnect from Excel
* CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
*---------------------------------------------------------------------*
* FORM FILL_CELL *
*---------------------------------------------------------------------*
* sets cell at coordinates i,j to value val boldtype bold *
*---------------------------------------------------------------------*
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL
EXPORTING
#1 = I
#2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = 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
*&---------------------------------------------------------------------*
*& Form ERR_HDL
*&---------------------------------------------------------------------*
* outputs OLE error if any *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
发表评论
-
Sap Number Range Object (SNRO)
2010-12-21 16:11 1811Brief Example http://www.sapte ... -
SAP R/3 Security Tables
2010-12-09 15:27 1604Below the list of SAP R/3 Sec ... -
Class def & impl, Inherit & overwriting, interface & using it, event & handler
2010-12-08 10:05 1135Below codes is a simply and rou ... -
IDOC_INPUT_ORDERS with error msg RV45A-VBAP_SELKZ (2) is not input field
2010-11-08 14:51 2395[Issue] Hi I am creating a mul ... -
SAP ALV Trees
2010-11-05 14:07 2138BCALV_GRID_DND_TREE ALV Grid: D ... -
Creating a SAP shortcut for any transaction and sending it by mail
2010-11-02 11:12 1993Refer to SAP wiki: http://wiki. ... -
Note 573128 - Debugging programs in the background
2010-11-01 20:13 1171Note 573128 - Debugging program ... -
Function Module related on Date calculations (ZT)
2010-07-20 17:00 1680http://wiki.sdn.sap.com/wiki/di ... -
SAP SDN Interesting Topics
2010-06-29 09:48 972Web Dynpro ABAP Performance Too ... -
SE16N &SAP_EDIT, ICON at Selection Screen
2010-06-12 17:35 1723摘录From blog of 翱翔云天 1. SE16N & ... -
Debug background processes, update/system code,model dialog...
2009-12-18 13:55 1188How do I debug running backgrou ... -
ABAP character variables vs. string variables
2009-11-16 11:23 2932Chinese Version: http://blog.cs ... -
ECC6 ALV Dump
2009-10-21 15:20 1024[Dump] 1. Use system reserved ... -
Simple Transfermation Program
2009-08-07 23:42 1987Have you been requested to gene ... -
eCATT, LSMW in detail
2009-02-15 10:14 3436eCATT : http://sap.iteye.com/bl ... -
Trigger ABAP program using UNIX script
2009-01-09 13:27 22341. Create a batch job in SM37 f ... -
How to cancel active job, del/change schedule job
2008-12-26 09:56 2299if the job is active and you wa ... -
How to Run UNIX script from ABAP?
2008-12-19 12:52 2514Look at SM69, SM49 and Functio ... -
REUSE_ALV_GRID_DISPLAY事件子过程和cl_gui_grid类的事件对应关系
2008-12-04 18:46 3847一、SLIS定义的ALV的事件名称* Eventsslis_e ... -
DDIC info related tables
2008-12-03 09:58 1933Data elementsDD04L Data elem ...
相关推荐
ABAP ole下载到多个excel 上和一个excel上新增多个sheet 页 ;ABAP ole下载到多个exce PERFORM 注释了,和一个excel上新增多个sheet 页 ,注 是ABAP 代码 OLE
ABAP OLE 颜色代码 ABAP OLE 颜色代码是指在 ABAP 编程语言中使用的颜色代码。这些代码用于在用户界面中显示不同的颜色,例如背景颜色、文字颜色、按钮颜色等。 在 ABAP 中,颜色代码通常以 šestnaestkovo ...
ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。...
在SAP ABAP环境中,DOI(Data Output Interface)和OLE(Object Linking and Embedding)是两种常用的工具,用于与外部系统交互,特别是在处理数据导出到如Microsoft Excel这样的应用程序时。下面将详细介绍这两个...
abap excel ole 操作开发手册 指导文件 手把手教你如何操作
ABAP简单的OLE练习 本文档旨在介绍ABAP中的OLE(Object Linking and ...本文档介绍了ABAP中OLE技术的简单应用,包括OLE技术的应用、ABAP中的OLE对象、对Excel的操作、内部表的应用、CALL METHOD语句的应用等知识点。
在实际业务场景中,有时我们需要将数据从SAP系统导出到Excel进行分析或者报告生成,这就涉及到ABAP与Excel的接口操作。下面将详细阐述如何在ABAP中处理与Excel交互的三种常见需求。 1. 在预定的某一个位置输出一个...
在本场景中,我们将探讨如何通过OLE(Object Linking and Embedding)技术在ABAP中实现Excel数据导出。 OLE是一种由Microsoft开发的技术,它允许不同应用程序之间的对象交互,使得一个程序可以嵌入或链接另一个程序...
ABAP数据快速填充EXCEL,比传统的OLE方式要运行速度快。
本主题将深入探讨“ABAP EXCEL通用类”——ZCL_EXCEL,它是SAP ABAP开发者用于处理Excel文件的一个强大工具。ZCL_EXCEL类允许程序员在后台生成、读取和修改Excel文件,从而实现与Microsoft Excel的数据交互。 首先...
ABAP OLE开发技术是一门针对SAP系统中ABAP编程语言进行自动化操作的技术。通过学习ABAP OLE技术,开发者能够控制其他程序,使得SAP系统能够自动化执行其他程序的任务,例如Microsoft Office应用程序的操作,这种技术...
在SAP系统中,ABAP OLE2 Excel技术主要用于与Microsoft Excel进行集成,允许ABAP程序员在SAP后台创建、修改或读取Excel文件。这种技术是基于对象链接和嵌入(OLE2)协议,它是早期Windows平台上的一个组件对象模型...
在SAP ABAP环境中,与Excel进行交互是常见的任务,特别是在数据导入导出、报告生成或用户自定义数据处理场景中。"abap与excel接口统一方法"主要涉及如何在ABAP程序中创建一个标准、可复用的接口来读取、写入Excel...
SAP ABAP OLE 操作 EXCEL 小结 SAP ABAP OLE 操作 EXCEL 小结是指使用 SAP ABAP 语言通过 OLE(Object Linking and Embedding)技术来操作 EXCEL 文件的技术。在 SAP 系统中,ABAP 语言可以直接操作 EXCEL 文件,...
ABAP与Excel接口的统一方法主要涉及在SAP ABAP编程中如何通过OLE Automation技术与Microsoft Excel进行交互,实现数据的读取和写入。以下将详细解释这个过程的关键步骤和所需的知识点。 1. **基本介绍** - **单字...
7. **Web Dynpro ABAP**:在Web环境下,可以利用Web Dynpro ABAP组件处理Excel,比如通过`wdc_excel_input`和`wdc_excel_output`元素。 8. **OpenOffice Integration**:SAP也支持通过OpenOffice API与Excel文件...
在 ABAP-EXCEL 编程中,我们可以使用 Excel 的 OLE AUTOMATION 接口来操作 Excel 文件,实现数据的输入、处理和输出。 ABAP-EXCEL 编程的统一接口使用方法包括三种可能的需求: 1. 在预定的某一个位置输出一个单字...
创建Excel是ABAP编程实现Excel操作的基础,通过使用ABAP的OLE(Object Linking and Embedding)机制,可以创建一个新的Excel文件。OLE是一种OLE自动化机制,允许ABAP程序与其他应用程序进行交互操作。在ABAP中,可以...