*&---------------------------------------------------------------------*
*& 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. mysql 索引基本概念

    1. 什么是索引? 索引是一种数据结构,可以帮助我们快速的进行数据的查找. 2. 索引是个什么样的数据结构呢? 索引的数据结构和具体存储引擎的实现有关, 在MySQL中使用较多的索引有Hash索引,B ...

  2. BurpSuite经常拦截firefox报文如success.txt的解决办法

    因为工作需要经常使用Burp对收发报文进行检测,平时习惯使用火狐浏览器,但是火狐浏览器经常进行一些登录状态的检测,导致Burp拦截中出现大量的火狐报文,如http://detectportal.fir ...

  3. 针对Model类的代码修剪器

    直接用Mybatis Generator生成的Model类大概是这样的 package com.spldeolin.demoapp.po; import java.util.Date; import ...

  4. AtCoder Beginner Contest 133 E - Virus Tree 2(组合数学)

    题意 n个点的树k种颜色,距离不超过2的点对需颜色不同,求方案数 Code(copy) #include<iostream> #include<cstdio> #include ...

  5. SpringCloud:Ribbon负载均衡

    1.概述 Spring Cloud Ribbon是基于Netflix Ribbon实现的一套客户端       负载均衡的工具. 简单的说,Ribbon是Netflix发布的开源项目,主要功能是提供客 ...

  6. C++2.0新特性(二)——<一致性初始化、Initializer_list 、for循环、explicit>

    一.一致性初始化(uniform initialization) 之前初始化时存在多个版本,让使用者使用时比较混乱,现在提供一种万用的初始化方法,就是使用大括号. 原理解析:当编译器看到大括号包起来的 ...

  7. arts打卡13周

    算法: 报数序列是一个整数序列,按照其中的整数的顺序进行报数,得到下一个数.其前五项如下: 1. 12. 113. 214. 12115. 1112211 被读作  "one 1" ...

  8. MySQL5.7授权用户远程访问

    做个记录,每次弄环境的时候,特别是弄mysql环境,时不时都要用到下面的命令 命令如下: grant all privileges on *.* to 'root'@'%' identified by ...

  9. 用sublime3编写运行16位汇编程序_详细教程

    最近需要学8086汇编,课堂教学竟然是PPT看代码,然而不运行程序是没法学编程的.网上的教程有很多坑点,摸索出了正确的步骤. 1.安装sublime3.安装MASM32.64位系统安装DOSBOX(因 ...

  10. 利用pgAgent创建定时任务

    使用Postgresql自带的pgAgent,可以很方便地创建定时执行任务.现在网上的资料都比较旧,Postgresql版本更新得比较快,导致网上的一些教程都不合用了,现在我写分享一下自己的经验. P ...