2017 Dec 10 4:47 AM
Hi All,
Can anybody help me to resolve my issue?
I have a requirement to print PDF attachments from DMS server. In CV04N we have PDF attachments for every batch and material. My custom program is configured with output type. This output type will executed from VL02N. If medium type is 'print output' the PDF attachments should print from DMS server which are related delivery batch and material.
Can body give me the solution to resolve this issue.?
Thanks in advance ,
Regards,
Satish
Hi All,
Can anybody help me to resolve my issue?
I have a requirement to print PDF attachments from DMS server. In CV04N we have PDF attachments for every batch and material. My custom program is configured with output type. This output type will executed from VL02N. If medium type is 'print output' the PDF attachments should print from DMS server which are related delivery batch and material.
Can body give me the solution to resolve this issue.?
Thanks in advance ,
Regards,
Satish
2017 Dec 10 9:53 AM
This question has been recently asked exactly in the same way (Nov 29, Oct 9), and there was no answer. Don't you think you need to ask it differently?
I don't understand where your exact issue is. You have a custom program, you have a PDF already loaded via CV04N, and so, what then, where is the issue? Don't forget to tell about details: which print technology do you use, do you need to print immediately (local printer) or print in background (server printer)...
2017 Dec 10 12:05 PM
Hi Rossi,
Thanks for quick reply. The PDFs are uploaded into CV04N for every batch and material. The for this requirement we will have the output type which will trigger from VL02N/VT03N. Once output is triggered with medium type 'print output', all PDF attachments of delivery batch/shipment batch should be print. The printer name we will get in NAST. Based on the printer name PDFs should print. Here I need help to print the PDF from DMS server.
Do we have any function module/class-method to print PDF from DMS server?
Hope you understand my requirement.
Regards,
Satish
2017 Dec 10 4:29 PM
No, there's no function module/class method to print PDF from DMS server. You must first read the file from the "DMS server", this is easy as it has been answered many times in the forum. To print a PDF when you print immediately, the only simple solution is to execute the PDF print using cl_gui_frontend_services, and it has been answered on the forum too.
2017 Dec 13 8:54 PM
Hi Rossi,
Thanks for your quick reply. Could you provide the sequence of the methods execution of the class 'cl_gui_frontend_services' to print PDFs ?
If you have any sample code, kindly share the code to me.
Regards,
Satish
2017 Dec 14 5:48 AM
As I said, it has been already answered. When you find the answer, I can confirm your finding if you prefer.
2017 Dec 14 6:36 PM
Hi Rossi,
I've used class method cl_gui_frontend_services=>execute to print pdf from DMS server. initially I've downloaded the PDF attachment into my local drive and I've passed file path to parameter 'document' of cl_gui_frontend_services=>execute. But I'm not able to print attachment. Could you please give me any solution if you have?
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = lv_file_name "File path in local drive to print
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
.
IF SY-SUBRC EQ 0.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_DELETE
EXPORTING
FILENAME = lv_file_name "File path in local drive to delete the file
CHANGING
RC = rc "Integer type
EXCEPTIONS
FILE_DELETE_FAILED = 1
* CNTL_ERROR = 2
* ERROR_NO_GUI = 3
* FILE_NOT_FOUND = 4
* ACCESS_DENIED = 5
* UNKNOWN_ERROR = 6
* NOT_SUPPORTED_BY_GUI = 7
* WRONG_PARAMETER = 8
others = 9
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
<br>
Regards,
Satish
2017 Dec 14 7:49 PM
Good job. Now please debug your program : check the return code after EXECUTE (check the value of the RC variable + uncomment the list of exceptions). The file name must be the full path, and the name must end with ".PDF" (in Windows that will link to your PDF reader software). It should work if Acrobat Reader is installed on your laptop.
By the way, one thing at a time: don't delete the file during your test, as it's the best way to be unable to troubleshoot the issue! First you should succeed printing. Then, delete the file. Make sure the call to EXECUTE is synchronous (= 'X') before deleting the file!
2017 Dec 16 8:06 AM
Hi Rossi,
I passed synchronous (= 'X') to method EXECUTE. But it's taking too much time even for printing one file also.
Some times I'm getting print from printer. Some times the print is not coming. But the PDF is opening with error (File path not found') once program is executed. I want to stop the PDF open. Could you please provide solution for this ?
Please find the attachment for PDF error. Because of the below code the file is opening.
"Below Method from CL_GUI_FRONTEND_SERVICES=>EXECUTE
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
others = 3.
IF SY-SUBRC <> 0.
RAISE CNTL_ERROR.
ENDIF.
2017 Dec 16 10:34 AM
About acrord32.exe options, search again, this is not ABAP anymore -> https://stackoverflow.com/questions/619158/adobe-reader-command-line-reference
For passing options to the command, use EXECUTE differently -> https://archive.sap.com/discussions/thread/1603209
application = 'AcroRd32.exe'
parameter = '/p /h <path>.pdf' "P = Print, h = Hide Window
minimized = 'X'
synchronous = ' '
operation = ''
About the "not printing sometimes", maybe it's still because of the file deletion. Instead, try not deleting yourself, by downloading the file to the SAP GUI temporary folder, it will be deleted later automatically by the SAP GUI (after one hour or at next restart of the SAP GUI or something like that):
CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY( ... )
CL_GUI_CFW=>FLUSH( ). " mandatory to return the temporary folder into the variable
.
2017 Dec 21 10:15 AM
Hi Rossi,
I've passed the parameter value as parameter = '/p /h <path>.pdf' "P = Print, h = Hide Window.
But no use. Still PDF is getting open. Is there any other to print PDF by generating the spool.?
Please let me know if you have any other way to print PDF documents from DMS server.
Regards,
Satish
2017 Dec 21 4:59 PM
All your questions are not related to ABAP. SAP don't know how to print PDF. Please post on relevant forums (not SAP).
2017 Dec 22 4:32 PM
Try the following search:
sap Print PDF attachments from DMS server
2017 Dec 23 10:29 AM
First, don't call FILE_DELETE when you test (otherwise, that could be a reason to not work, if you delete a file while it's being printed).
Second, replace 'PRINT' with 'OPEN', remove the call to FILE_DELETE. Does it open correctly?
If yes, then try 'PRINT' without FILE_DELETE.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |