0% found this document useful (0 votes)
464 views2 pages

Sap DMS

This document discusses a solution for directly printing PDF drawings from SAP's document management system without any user interaction. The code uses the cl_gui_frontend_services=>execute function to call Adobe Reader, passing the path to the PDF file along with parameters to print the file and hide the main window. By calling this function, the PDF is printed automatically after being checked out from the document management system and saved locally on the Windows frontend.

Uploaded by

VineetKumarSingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
464 views2 pages

Sap DMS

This document discusses a solution for directly printing PDF drawings from SAP's document management system without any user interaction. The code uses the cl_gui_frontend_services=>execute function to call Adobe Reader, passing the path to the PDF file along with parameters to print the file and hide the main window. By calling this function, the PDF is printed automatically after being checked out from the document management system and saved locally on the Windows frontend.

Uploaded by

VineetKumarSingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Sap DMS direct print of pdf drawings on

Windows frontend
My problem was to print a pdf from SAP document management system automatically, without
user actions needed;
I solved this using the classic function cl_gui_frontend_services=>execute giving as parameter
not only the path of the file to open, but the concatenation of the specific Adobe Reader call
parameters to print and hide the main window (simply: /p /h ).
Here it is the entire code of my function:
FUNCTION z_print_pdf_draw.
* IMPORTING
* VALUE(PDOKAR) TYPE DRAW-DOKAR
* VALUE(PDOKNR) TYPE DRAW-DOKNR
* VALUE(PDOKVR) TYPE DRAW-DOKVR
*Direct Print of pdf drawings, Windows Frontend only
TABLES: draw.
SELECT SINGLE * FROM draw INTO draw
WHERE dokar = pdokar AND
doknr = pdoknr AND
dokvr = pdokvr.
IF sy-subrc = 0.
DATA: sourcef TYPE string,
targetf TYPE string,
printcommand TYPE string,
dms_file TYPE dms_doc_file.
CONCATENATE C:\Temp\ draw-mrk_filep INTO targetf.
CONCATENATE /p /h targetf INTO printcommand.
P = Print, h = Hide Window
dms_file-fileno = 1.
MOVE targetf TO dms_file-filename.
dms_file-dappl = PDF.
dms_file-dttrg = draw-dttrg.
*save the pdf file locally
CALL FUNCTION CV120_DOC_CHECKOUT_TO_CLIENT
EXPORTING
ps_draw
= draw
ps_doc_file
= dms_file
.
IF sy-subrc = 0.
* print the pdf!
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = AcroRd32.exe

*application = Acrobat.exe
parameter = printcommand
minimized = X
operation =
EXCEPTIONS
*
OTHERS = 10 .
ENDIF.
ELSE.
* file not found
ENDIF.
ENDFUNCTION.

You might also like