ABAP PRINT PDF FILE

在SAP中打印PDF文件时,可以使用SAP_PDF_VIEWER_DEMO程序的'PRINT'方法,或者通过GUI_EXECUTE调用Acrobat Reader的/p选项。然而,这可能会导致PDF按本地PC的打印机设置而非SAP打印队列的顺序打印。讨论还涉及了通过CL_GUI_FRONTEND_SERVICES=>EXECUTE方法直接打印PDF的问题,该方法会导致PDF打开并等待用户关闭。另外,建议使用OLE方法处理Excel和Word文件的打印,并提到了DOS命令来从SAP打印文件的相关资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

 

http://www.sapfans.com/forums/viewtopic.php?f=13&t=324672

 

Have a look at program SAP_PDF_VIEWER_DEMO. This has a 'PRINT' method.

If you don't want to go to all the trouble of using the PDF viewer you can always use GUI_EXECUTE to run Acrobat with a /p option.

However, if you are trying to do what I was which is to print a sequence of documents note that the print spooler used is the local pc's spooler rather than the SAP Spooler so your PDF can be printed at any time and not neccesarily in the sequence that you send the prints from SAP. It could also be printed on a totally different printer dependant on the users printer settings.

 

-----------------------------------------------------

I have a PDF file in "C:/".
printed pdf file using cl_gui_frontend_services=>execute.

When pdf file prints then it opens the acrobat reader and the program waits until I close the acrobat reader.

Could you please let me if any options is there without open the pdf file or if it opens don’t wait for the close(automatically closed).

 

 

-----------------------------------------------------

Have you got succeed to print a pdf directly from SAP?
And is it the same principe with excel file and word file?

 

You'll see that he is using the method of running acrobat reader and using a command line option to print the file.

As for Word and Excel files, use OLE.

 

I have still a problem to print a PDF in SAP.
The fact is that my file is not on my PC but on a server which it's necessary to connect to reach it, have you a idea to help me?
And have you know the DOS command to print a file (excel and word) from SAP.

 

 

 

 

http://forums.sdn.sap.com/message.jspa?messageID=8715149

 

I want to print PDF file from desk top using cl_gui_frontend_services=>execute . My issue is the PDF file will be open but not printing. can you please advide me how to call this method.

CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
* document = lv_dir
application = 'AcroRd32.exe'
parameter = 'C:/test.PDF'
minimized = 'X'
* synchronous = ' '
operation = 'PRINT'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10 .

 

 

 

-----------------------------------------------------

 

CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
* document = lv_dir
application = 'AcroRd32.exe'
parameter = '/p /h C:/YourPDFile.pdf'    "P = Print, h = Hide Window
minimized = 'X'
* synchronous = ' '
operation = ''
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10 .


Look also at URL http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm

 

-----------------------------------------------------

 

Look at the print method in program SAP_PDF_VIEWER_DEMO
CL_GUI PDF VIEWER=>print

 

http://wiki.sdn.sap.com/wiki/display/ABAP/Working+with+files#Workingwithfiles-OLE%2FDOIforOfficenativefiles%28Excel%2CWord%2Cetc.%29

 

 

 

http://www.sap-img.com/bc037.htm

Auto convert SAP spool output to PDF file

 

 

 

http://sap.ittoolbox.com/groups/technical-functional/sap-abap/print-pdf-file-2230035

 

 

 

 

ABAP(Advanced Business Application Programming,SAP NetWeaver 的编程语言)中,发送PDF文件给外围系统通常涉及以下步骤: 1. **创建PDF文件**:首先,你需要使用 SAP 自带的工具或第三方库(如 SAP Crystal Reports 或 iReport)生成 PDF 文件内容。 2. **读取 PDF 内容**:将生成的 PDF 保存到本地文件系统或内存中,以便后续操作。 3. **设置HTTP接口**:如果目标系统支持 HTTP 接口接收文件,你可以使用 `http_client` 模块在 ABAP 中发起 HTTP POST 请求。确保配置请求头包含 "Content-Type" 为 "application/pdf"。 4. **上传 PDF数据**:将 PDF 文件的内容作为二进制数据或从文件路径读取并发送到指定的 URL。 5. **处理响应**:接收到服务器的响应后,检查是否有错误信息或确认文件已成功接收。 6. **错误处理和日志记录**:处理可能出现的网络异常、文件读取错误等,并记录相应的日志。 **示例代码片段**(简化版): ```abap DATA: lv_pdf_file TYPE string, lv_url TYPE url, lv_http TYPE REF TO cl_http_client. lv_pdf_file = ... "这里填充生成的PDF文件路径或内容" lv_url = VALUE #(host = 'your.target.url', port = 80, path = '/api/upload') lv_http = cl_http_client=>create( ). lv_http->open( lv_url ). try. DATA(lv_response) = lv_http->post( iv_data = lv_pdf_file, iv_mimetype = 'application/pdf', iv_content_length = lines( lv_pdf_file ) ). catch cx_http_exception INTO DATA(ls_error). "处理错误" end try. lv_http->close( ). "处理返回结果,比如存储接收状态或发送确认邮件" ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值