惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 知秋一叶

透视ERP增强 SAP ABAP 点滴记录 计算BOM函数 BADI查找方法 PP几个表关系 SAP/SD - 做SD你要知道的透明表 SD--va01的屏幕增强 关于SmartForm和ScriptForm的输出格式设置说明 ABAP常用系统变量 ABAP日期函数 sap库存相关表 IDOC实例, Outbound IDOC Aix命令:列出使用内存和Cpu前几位的进程 Provider 错误 '80004005' 未指定的错误 的最终解决方法 SAP取消的凭证信息表 sap转换成基本订单单位 - 知秋一叶 - 博客园 sqlserver实现网络备份 js常用资料 经典正则表达式 (收藏整理)
内表转WORD一法, 可以调用WORD做报表了
知秋一叶 · 2010-08-27 · via 博客园 - 知秋一叶

今天在技术群里再讨论ABAP调用WORD打印的问题, 忽然想起.NET中常用组合HTML字符串的方法来导出WORD文件, 这个方法在ABAP中应该也可以吧, 于是简单做了个测试, 代码如下:

 DATA: BEGIN OF wa_html,
        zhtml(255),
      END OF wa_html,
      gt_html LIKE TABLE OF wa_html.

DATA: v_str TYPE string.

DEFINE appd_html.
  wa_html-zhtml = &1.
  append wa_html to gt_html.
  clear wa_html.
END-OF-DEFINITION.

appd_html: '<table style="width:100%;border:1px black solid;font-size:10px; border-collapse:collapse;font-family:Arial Unicode MS;">',
           '<tr>',
           '<td align="center" style="border:1px black solid;">1111111111</td>',
           '<td align="center" style="border:1px black solid;">2222222222</td>',
           '</tr>',
           '<tr>',
           '<td align="center" style="border:1px black solid;">1111111111</td>',
           '<td align="center" style="border:1px black solid;">2222222222</td>',
           '</tr>',
           '<tr>',
           '<td align="center" style="border:1px black solid;">1111111111</td>',
           '<td align="center" style="border:1px black solid;">2222222222</td>',
           '</tr>',
           '</table>'.

CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    filename = 'c:\a.doc'
  CHANGING
    data_tab = gt_html.

IF sy-subrc EQ 0.
  write 'OK'.
ELSE.
  write 'ER'.
ENDIF.

运行上面的代码后, 会在C盘生成一个A.DOC的文件, 双击, 可以看到Word能正够正常显示内容及格式. 再自动化一点,就是实例化OLE对象并打开这个文件啦, 这里就不写了, 有兴趣的自己试吧.

---------------------------------2010-07-05 更新----------------------------------------

注: 加上如下代码, 程序运行将直接调用Wod打开文件

 CALL FUNCTION 'CALL_INTERNET_ADRESS'
 EXPORTING
   PI_ADRESS           = 'c:\a.doc'
*   PI_TECHKEY          = ''
 EXCEPTIONS
   NO_INPUT_DATA       = 1
   OTHERS              = 2

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wren2004/archive/2010/07/02/5708947.aspx