Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Close PDF file opened with cl_gui_frontend_services=>execute

Former Member
0 Kudos

Hi All,

I am using cl_gui_frontend_services=>execute to open and print a PDF file from the desktop. Once the PDF file prints, Acrobat Reader keeps open and the user must close it manually. Is there a way of closing it automatically? I searched the Forum and the Web and found no solution on this. Is it possible? If so, how?

I found this thread but it is kind of complicated as several printers are used.

Thanks & Regards,

Ernesto.

7 REPLIES 7

Former Member
0 Kudos

Hi,

I think you can try using OLE for closing PDF.

You can get some idea from source code of SAP function module MS_WORD_OLE_FORMLETTER.

0 Kudos

Hi,

Thanks for your reply. I've looking at this FM but it seems to be for Word Documents only.

Regards,

Ernesto.

raymond_giuseppi
Active Contributor
0 Kudos

You need to add a "/t" to the command/application "AcroRd32.exe", try

CALL METHOD cl_gui_frontend_services=>execute
  EXPORTING
    application            = 'AcroRd32.exe'
    parameter              = '/p /t <file path and name>.pdf'
    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.

Regards,

Raymond

0 Kudos

Hi Raymond,

Very helpful! My PDF closes but the Acrobat Reader application stays open. Can this be closed?

Thanks

Ernesto

0 Kudos

Sorry, i don't remember the exact switch, try to search in [forums.adobe.com]

Regards,

Raymond

0 Kudos

Hi,

I couldn't find anything to close the Adobe Application.

I close the thread.

Ernesto.

vishal_agrawal3
Participant
0 Kudos

Hi All,

Am facing the same problem. After printing, the adobe acrobat reader is still open. Did anyone find any solution to this problem?

Regards,

Vishal Agrawal