*&---------------------------------------------------------------------*
*& Report YCX_021
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT YCX_021.
INCLUDE OLE2INCL . *----------------------------------------------------------------------- * Global GUI Controls Variables / Structures *----------------------------------------------------------------------- *--Data Definition of OLE DATA: GS_EXCEL TYPE OLE2_OBJECT , GS_WBOOKLIST TYPE OLE2_OBJECT , GS_APPLICATION TYPE OLE2_OBJECT , GS_WBOOK TYPE OLE2_OBJECT , GS_ACTIVESHEET TYPE OLE2_OBJECT , GS_SHEETS TYPE OLE2_OBJECT , GS_NEWSHEET TYPE OLE2_OBJECT , GS_CELL1 TYPE OLE2_OBJECT , GS_CELL2 TYPE OLE2_OBJECT , GS_CELLS TYPE OLE2_OBJECT , GS_RANGE TYPE OLE2_OBJECT , GS_FONT TYPE OLE2_OBJECT , GS_INTERIOR TYPE OLE2_OBJECT , GS_COLUMNS TYPE OLE2_OBJECT , GS_CHARTS TYPE OLE2_OBJECT , GS_CHART TYPE OLE2_OBJECT , GS_CHARTTITLE TYPE OLE2_OBJECT , GS_CHARTTITLECHAR TYPE OLE2_OBJECT , GS_CHARTOBJECTS TYPE OLE2_OBJECT . DATA GV_SHEET_NAME() TYPE C . DATA GV_OUTER_INDEX LIKE SY-INDEX . DATA GV_INTEX() TYPE C . DATA GV_LINE_CNTR TYPE I . "line counter DATA GV_LINNO TYPE I . "line number DATA GV_COLNO TYPE I . "column number DATA GV_VALUE TYPE I . "data *$*$----------------------------------------------------------------$*$* *$*$ Selection Screen $*$* *$*$----------------------------------------------------------------$*$* *----------------------------------------------------------------------- * Selection Screen *----------------------------------------------------------------------- PARAMETERS: P_SHEETS TYPE I . *$*$----------------------------------------------------------------$*$* *$*$ Main Program $*$* *$*$----------------------------------------------------------------$*$* *--------- START-OF-SELECTION ---------- START-OF-SELECTION . DO P_SHEETS TIMES . *--Forming sheet name GV_INTEX = SY-INDEX . GV_OUTER_INDEX = SY-INDEX . CONCATENATE 'Excel Sheet #' GV_INTEX INTO GV_SHEET_NAME . *--For the first loop, Excel is initiated and one new sheet is added IF SY-INDEX = . CREATE OBJECT GS_EXCEL 'EXCEL.APPLICATION' . SET PROPERTY OF GS_EXCEL 'Visible' = . GET PROPERTY OF GS_EXCEL 'Workbooks' = GS_WBOOKLIST . GET PROPERTY OF GS_WBOOKLIST 'Application' = GS_APPLICATION . SET PROPERTY OF GS_APPLICATION 'SheetsInNewWorkbook' = . CALL METHOD OF
GS_WBOOKLIST
'Add' = GS_WBOOK. GET PROPERTY OF GS_APPLICATION 'ActiveSheet' = GS_ACTIVESHEET . SET PROPERTY OF GS_ACTIVESHEET 'Name' = GV_SHEET_NAME . *--For the rest of loops, other sheets are added ELSE . GET PROPERTY OF GS_WBOOK 'Sheets' = GS_SHEETS . CALL METHOD OF
GS_SHEETS
'Add' = GS_NEWSHEET. SET PROPERTY OF GS_NEWSHEET 'Name' = GV_SHEET_NAME . ENDIF . GV_LINE_CNTR = . "line counter *--Title *--Selecting cell area to be merged. CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# =
# = . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL2
EXPORTING
# =
# = . CALL METHOD OF
GS_EXCEL
'Range' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2. CALL METHOD OF
GS_CELLS
'Select'. *--Merging CALL METHOD OF
GS_CELLS
'Merge'. *--Setting title data CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = . SET PROPERTY OF GS_CELL1 'Value' = 'TITLE' . *--Formatting the title GET PROPERTY OF GS_CELL1 'Font' = GS_FONT . SET PROPERTY OF GS_FONT 'Underline' = . SET PROPERTY OF GS_FONT 'Bold' = . SET PROPERTY OF GS_CELL1 'HorizontalAlignment' = - . GET PROPERTY OF GS_CELL1 'Interior' = GS_INTERIOR . SET PROPERTY OF GS_INTERIOR 'ColorIndex' = . SET PROPERTY OF GS_INTERIOR 'Pattern' = - . SET PROPERTY OF GS_INTERIOR 'PatternColorIndex' = - . GV_LINE_CNTR = GV_LINE_CNTR + . *--Writing some additional data for the title CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = . SET PROPERTY OF GS_CELL1 'Value' = 'Sheet No' . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = . SET PROPERTY OF GS_CELL1 'Value' = ':' . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = . SET PROPERTY OF GS_CELL1 'Value' = GV_INTEX . *--Formatting the area of additional data 1 CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# =
# = . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL2
EXPORTING
# = GV_LINE_CNTR
# = . CALL METHOD OF
GS_EXCEL
'Range' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2. CALL METHOD OF
GS_CELLS
'Select'. GET PROPERTY OF GS_CELLS 'Font' = GS_FONT . SET PROPERTY OF GS_FONT 'Bold' = . *--Formatting the area of additional data 2 CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# =
# = . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL2
EXPORTING
# = GV_LINE_CNTR
# = . CALL METHOD OF
GS_EXCEL
'Range' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2. CALL METHOD OF
GS_CELLS
'Select'. GET PROPERTY OF GS_CELLS 'Columns' = GS_COLUMNS . CALL METHOD OF
GS_COLUMNS
'AutoFit'. *--Bordering title data area CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# =
# = . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL2
EXPORTING
# = GV_LINE_CNTR
# = . CALL METHOD OF
GS_EXCEL
'Range' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2. CALL METHOD OF
GS_CELLS
'Select'. CALL METHOD OF
GS_CELLS
'BorderAround' EXPORTING
# = "continuous line
# = . "thick *--Putting axis labels GV_COLNO = . GV_LINE_CNTR = GV_LINE_CNTR + . GV_LINNO = GV_LINE_CNTR - . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINNO
# = . SET PROPERTY OF GS_CELL1 'Value' = 'X' . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = . SET PROPERTY OF GS_CELL1 'Value' = 'Y' . *--Generating some data DO TIMES . GV_VALUE = GV_OUTER_INDEX * SY-INDEX * . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINNO
# = GV_COLNO. SET PROPERTY OF GS_CELL1 'Value' = SY-INDEX . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = GV_COLNO. SET PROPERTY OF GS_CELL1 'Value' = GV_VALUE . GV_COLNO = GV_COLNO + . ENDDO . *--Source data area GV_COLNO = GV_COLNO - . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINNO
# = . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL2
EXPORTING
# = GV_LINE_CNTR
# = GV_COLNO. CALL METHOD OF
GS_EXCEL
'Range' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2. CALL METHOD OF
GS_CELLS
'Select'. GET PROPERTY OF GS_APPLICATION 'Charts' = GS_CHARTS . CALL METHOD OF
GS_CHARTS
'Add' = GS_CHART. CALL METHOD OF
GS_CHART
'Activate'. SET PROPERTY OF GS_CHART 'ChartType' = '' . "Vertical bar graph CALL METHOD OF
GS_CHART
'SetSourceData' EXPORTING
# = GS_CELLS
# = . SET PROPERTY OF GS_CHART 'HasTitle' = . GET PROPERTY OF GS_CHART 'ChartTitle' = GS_CHARTTITLE . GET PROPERTY OF GS_CHARTTITLE 'Characters' = GS_CHARTTITLECHAR . SET PROPERTY OF GS_CHARTTITLECHAR 'Text' = 'Sample Graph' . *--Locate the chart onto the current worksheet *--Activate current sheet CALL METHOD OF
GS_EXCEL
'WorkSheets' = GS_ACTIVESHEET
EXPORTING
# = GV_SHEET_NAME. CALL METHOD OF
GS_ACTIVESHEET
'Activate'. CALL METHOD OF
GS_CHART
'Location' EXPORTING
# =
# = GV_SHEET_NAME. *--Reposition the chart on the worksheet (cut&paste) CALL METHOD OF
GS_ACTIVESHEET
'ChartObjects' = GS_CHARTOBJECTS. CALL METHOD OF
GS_CHARTOBJECTS
'Select'. CALL METHOD OF
GS_CHARTOBJECTS
'Cut'. *--Select new area
GV_LINE_CNTR = GV_LINE_CNTR + . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL1
EXPORTING
# = GV_LINE_CNTR
# = . CALL METHOD OF
GS_EXCEL
'Cells' = GS_CELL2
EXPORTING
# = GV_LINE_CNTR
# = . CALL METHOD OF
GS_EXCEL
'Range' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2. CALL METHOD OF
GS_CELLS
'Select'. CALL METHOD OF
GS_ACTIVESHEET
'Paste'.
ENDDO. *--Deallocating memory
FREE:
GS_EXCEL, GS_WBOOKLIST, GS_APPLICATION, GS_WBOOK,
GS_ACTIVESHEET,GS_SHEETS, GS_NEWSHEET, GS_CELL1,
GS_CELL2, GS_CELLS, GS_RANGE, GS_FONT, GS_INTERIOR,
GS_COLUMNS, GS_CHARTS, GS_CHART, GS_CHARTTITLE,
GS_CHARTTITLECHAR, GS_CHARTOBJECTS .

ABAP DEMO ole示例程序的更多相关文章

  1. SAP demo包 示例程序

    在SAP的这个开发类中SABAPDEMOS,存放了N多的demo程序 有空的时候,可以看看.

  2. 小程序-demo:小程序示例-page/api

    ylbtech-小程序-demo:小程序示例-page/api 以下将演示小程序接口能力,具体属性参数详见小程序开发文档. 1. page/component返回顶部 1. a) .js Page({ ...

  3. 小程序-demo:小程序示例-page/component2

    ylbtech-小程序-demo:小程序示例-page/component2 以下将展示小程序官方组件能力,组件样式仅供参考,开发者可根据自身需求自定义组件样式,具体属性参数详见小程序开发文档. 1. ...

  4. 小程序-demo:小程序示例-page/component

    ylbtech-小程序-demo:小程序示例-page/component 以下将展示小程序官方组件能力,组件样式仅供参考,开发者可根据自身需求自定义组件样式,具体属性参数详见小程序开发文档. 1. ...

  5. 小程序-demo:小程序示例-page/common

    ylbtech-小程序-demo:小程序示例-page/common 1.返回顶部 0.     1. 2. pages/common返回顶部 1. -lib --weui.wxss /*! * we ...

  6. 小程序-demo:小程序示例

    ylbtech-小程序-demo:小程序示例     1.返回顶部 0. 1.app.js const openIdUrl = require('./config').openIdUrl App({ ...

  7. 【ABAP系列】SAP ABAP解析XML的示例程序

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP解析XML的示例 ...

  8. BitCoinJ之Hello World示例程序

    简介 比特币(BitCoin)是一种基于区块链(BlockChain)技术的数字化货币. 本文介绍了使用基于Java语言的BitCoinJ API实现一个简单的收取和支付比特币的示例程序. 开发环境 ...

  9. zigbee学习:示例程序SampleApp中通讯流程

    zigbee学习:示例程序SampleApp中通讯流程 本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明. 参考链接: http://wjf88223.bl ...

随机推荐

  1. Selenium常用API的使用java语言之20-获取窗口截图

    自动化用例是由程序去执行,因此有时候打印的错误信息并不十分明确.如果在脚本执行出错的时候能对当前窗口截图保存,那么通过图片就可以非常直观地看出出错的原因. WebDriver提供了截图函数getScr ...

  2. python - django (ORM常用字段)

    # """ python manage.py makemigrations # 更新操作 python manage.py migrate # 转换sql语句到数据库 1 ...

  3. 非自增编号字段,避免生成重复编号(以pdfNo编号为例)RedisLock/ReadLock

    非自增编号字段,避免生成重复编号(以pdfNo编号为例) 有个场景,用户查询延误航班信息,然后生产一个编号,默认第一个编号是1000001,其后新增的编号默认自增加1.每次有人来查延误信息,如果延误信 ...

  4. YAML_14 tags给指定的任务定义一个调用标识,以后不用重复整个过程,只需要执行tags标签的部分

    ansible]# vim adhttp.yml --- - hosts: cache   remote_user: root   tasks:     - copy:         src: /r ...

  5. CF463D Gargari and Permutations dp

    给定 $n<=10$ 个 $1$~$n$ 的排列,求这些排列的 $LCS$. 考虑两个排列怎么做:以第一个序列为基准,将第二个序列的元素按照该元素在第一个序列中出现位置重新编号. 然后,求一个 ...

  6. 二维$MLE$线段树

    关于二维线段树,ta死了 先来看看两种二维线段树的打法 1.四叉树 然而ta死了,ta是$\Theta (n)$的,加上线段树的常数,$T$飞稳 2.线段树套线段树 我尽量画出来... 图中每个方块是 ...

  7. 从Word到WinEdit的复制

    从Word像WinEdt复制文档时,发现如下问题: 后来网上搜索,参考http://blog.csdn.net/fht1051066200/article/details/38241059 中的说法: ...

  8. Prometheus告警规则增删改自动化

    Prometheus告警规则增删改自动化 前言: 随着容器技术的发展,zabbix监控方式与k8s的结合不完善,导致不得不放弃zabbix,而新的监控工具prometheus的使用就越来越多了.但是经 ...

  9. Zrender:实现波浪纹效果

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  10. SignalR的几种方式_转自:https://www.cnblogs.com/zuowj/p/5674615.html

    SignalR有三种传输模式: LongLooping(长轮询). WebSocket(HTML5的WEB套接字). Forever Frame(隐藏框架的长请求连接), 可以在WEB客户端显式指定一 ...