SAP PRINT WORD/DOC DIRECTLY
来源:互联网 发布:无法过去摄像头数据 编辑:程序博客网 时间:2024/06/06 09:35
https://forums.sdn.sap.com/thread.jspa?threadID=15554&tstart=57645
How to print a word document directly from ABAP?
want to send word documents to printer. I found a FM CV150_PRINT_DOC
If your functionality allows you to open the doc first and then print it from there, then you can use the FM 'WS_EXECUTE'/ 'GUI_EXEC' to open the file (you should pass the full path of the winword.exe file/WORD prg name and your file path to this FM), and then print it from there
----------------------------------------------------
You can find some examples using transaction SE83 (Reuse Library): SAP Basis -> Controls -> Desktop Office Integration
----------------------------------------------------
I have another question. I could not get the idea of addressing the documents. I mean, when I debug the examples, I found out that the content of the documents are carried out to the internal tables. But where do we define the directory and the name of the files?
Best Regards,
Didem
ps: I think the best way is to use ws_execute, but unfortunately printers we use are not MS DOS compatible. I could not print anything from the command prompt.
----------------------------------------------------
To open a document you can use the following method:
CALL METHOD document->open_document
EXPORTING document_url = p_fname
IMPORTING retcode = retcode.
Where p_fname stands for the filename on your fileserver (use 'FILE://' + <directory name> + '/' + <name of the file> for local files).
----------------------------------------------------
Here is an example code utilizing OLE2.
REPORT print_via_ole_example .
INCLUDE ole2incl .
DATA: gs_word TYPE ole2_object ,
gs_documents TYPE ole2_object ,
gs_newdoc TYPE ole2_object ,
gs_actdoc TYPE ole2_object .
START-OF-SELECTION .
CREATE OBJECT gs_word 'WORD.APPLICATION'.
SET PROPERTY OF gs_word 'Visible' = '0' .
CALL METHOD OF gs_word 'Documents' = gs_documents.
CALL METHOD OF gs_documents 'Open' = gs_newdoc
EXPORTING #1 = 'D:/my_doc.doc' .
CALL METHOD OF gs_word 'ActiveDocument' = gs_actdoc .
CALL METHOD OF gs_actdoc 'PrintOut' .
CALL METHOD OF gs_word 'Quit' .
END-OF-SELECTION.
FREE: gs_word, gs_actdoc, gs_documents, gs_newdoc .
----------------------------------------------------
First of all, the requirement is not clear. What exactly do you want? Do you want to print a word document, which is stored in SAP Document Management System or you just want to print a document using ABAP code, which is stored on your local machine ?
CV150_PRINT_DOC can only be used when the word document is stored in SAP DMS. You must have a Document Info Record created in SAP for it.
If you want to print a word document from your PC, you may think of using office integration. You may open the document as an OLE object and print using method PRINT_DOCUMENT of I_OI_DOCUMENT_PROXY.
https://forums.sdn.sap.com/thread.jspa?threadID=15554&tstart=57645
http://forums.sdn.sap.com/thread.jspa?threadID=1064038&tstart=26234
Print a PDF document from ABAP
Could you pls. help me with the following requirement:
We need to print a PDF document on the local desktop to the local (default) printer:
On executing the program the document should open, get printed and get closed.
There are some OLE commands (for instantiating the OLE object and printing). We have got the code for word document:
CREATE OBJECT h_word 'WORD.BASIC'.
call method of h_word 'AppShow'.
call method of h_word 'FILEOPEN' exporting #1 = e_filename1.
call method of h_word 'FILEPRINT'.
call method of h_word 'FILECLOSE'.
call method of h_word 'FILEEXIT'.
free object h_word.
The above code print the word document. We need similar code for PDF document.
For this the PDF document needs to be registered in SOLE transaction. What should be the entry in SOLE transaction to register the PDF document?
Any inputs in this regard will help us a lot.
we have standard report RSTXPDFT4 to convert to pdf use this and download it .
First see in transaction SOLE whether PDF OLE application is maintained.
You can have a look at OLE for demo for excel and word.
If you debug it then you will get the clear picture what to do.
REPORT ZTEST_PRINT_DOC.
*REPORT print_via_ole_example .
INCLUDE ole2incl .
DATA: gs_word TYPE ole2_object ,
gs_documents TYPE ole2_object ,
gs_newdoc TYPE ole2_object ,
gs_actdoc TYPE ole2_object .
START-OF-SELECTION .
CREATE OBJECT gs_word 'WORD.APPLICATION'.
SET PROPERTY OF gs_word 'Visible' = '0' .
CALL METHOD OF gs_word 'Documents' = gs_documents.
CALL METHOD OF gs_documents 'Open' = gs_newdoc
EXPORTING
* #1 = 'E:/US-M-TERMS-20110126.doc' .
#1 = '/tmp/US-M-TERMS-20110126.doc' .
CALL METHOD OF gs_word 'ActiveDocument' = gs_actdoc .
CALL METHOD OF gs_actdoc 'PrintOut' .
CALL METHOD OF gs_word 'Quit' .
END-OF-SELECTION.
FREE: gs_word, gs_actdoc, gs_documents, gs_newdoc .
SMW0/
OAOR/
CG3Z/AL11 文件采用这种方式直接上传服务器
这几天还没弄清楚文件传到FTP服务器/SAP DMS/SAP的服务器 处理文件时有什么区别
- SAP PRINT WORD/DOC DIRECTLY
- SAP print Document
- 浅析doc(word)格式文件内部结构
- 【word | html】word(doc | docx) 转 html
- Print Documents From Delphi - Print PDF, DOC, XLS, HTML, RTF, DOCX, TXT
- pdf 转 doc(Word)的方法
- 发送邮件带word附件的.doc
- POI Word DOC格式转Html
- office word 2007 无法打开 .doc
- ASP.NET利用DOC模板导出Word
- 使用POI读写word doc文件
- mac os 秒开 word doc 文档
- 使用POI读写Word doc文件
- 使用POI转换word doc文件
- 使用POI读写word doc文件
- 使用POI转换word doc文件
- 使用POI转换word doc文件
- POI把html写入word doc文件
- shell里的` ` $( ) ${ } expr $(( ))
- ria 里面的写文件例子
- shell -- include 文件
- mxml 读取 xml 的例子
- shell --函数
- SAP PRINT WORD/DOC DIRECTLY
- SQL 5 限制结果集行数(MySQL & Oracle)
- ubuntu10.10安装体验方法大汇总
- 网站架构(页面静态化,图片服务器分离,负载均衡)方案全解析
- shell 编程——for in 循环
- shell编程——循环语句
- Ubuntu 10.04 Eclipse C/C++平台搭建
- UNIX通用系统变量和shell命令行参数
- COM 代理存根模式下COM组件的实现和加载