Application Development and Automation 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: 
Read only

Cl_gui_frontend_services->get_temp_directory does not work in the printing program

0 Kudos
1,665

Hello!

I need to use the method cl_gui_frontend_services->get_temp_directory in the printing program (one of PM Order form exactly). It works fine in the case of the preview. When I press "Print/Fax" button it returns "NOT_SUPPORTED_BY_GUI" exception. Any suggestions?

1 ACCEPTED SOLUTION
Read only

1,430

I found a solution (thanks to my colleagues Sławek and Krzysztof for their help!).

I implemented Customer Exit IWO10009 - check before saving maintenance order. When a shop paper is selected to print, I use command SET LOCAL UPDATE TASK . It allows to use methods of class cl_gui_frontend_services in my printing program.

Thank you Sandra and Raymond for your contribution!

6 REPLIES 6
Read only

Sandra_Rossi
Active Contributor
1,430

GUI functions cannot be accessed from processes not connected to a GUI client, e.g. background processes can't use GUI functions.

My second thought would be that printing runs in the update task, but if you run it in dialog GUI operations are also permitted in the update task.

Did you search in the forum and in the SAP notes?

Read only

0 Kudos
1,430

Hi Sandra,

Of course, I have explored many posts and found no solution.

The strangest thing for me is the fact, that after clicking "Print Preview" it works fine.

Maybe we should pay attention to the differences in the preview and proper printing processes?

The visible difference is that after selecting the "Print / Fax" option, it automatically saves and closes the order. However, when preview is selected, the subscreen with the selection of papers for printing remains open.

Read only

0 Kudos
1,430

Please use the COMMENT button for comments, questions, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.

Read only

RaymondGiuseppi
Active Contributor
1,430

To confirm what sandra.rossi wrote

  • In preview, your program is running in an interactive session, connected with a screen GUI
  • At runtime, your program is probably running in an update task, no connection to a screen GUI

You could add some code to insure GUI is available before calling some GUI feature.

IF cl_gui_frontend_services=>gui_is_running = 'X'.
    Read only

    Sandra_Rossi
    Active Contributor
    0 Kudos
    1,430

    As Raymond said, I confirm there was a mistake in my answer, in fact there's no connection to SAP GUI, except SAPSprint which can still be contacted to print the form.

    Read only

    1,431

    I found a solution (thanks to my colleagues Sławek and Krzysztof for their help!).

    I implemented Customer Exit IWO10009 - check before saving maintenance order. When a shop paper is selected to print, I use command SET LOCAL UPDATE TASK . It allows to use methods of class cl_gui_frontend_services in my printing program.

    Thank you Sandra and Raymond for your contribution!