2022 Mar 13 5:12 PM
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?
2022 Mar 14 8:40 PM
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!
2022 Mar 13 5:29 PM
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?
2022 Mar 13 6:01 PM
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.
2022 Mar 14 2:12 PM
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.
2022 Mar 14 1:56 PM
To confirm what sandra.rossi wrote
You could add some code to insure GUI is available before calling some GUI feature.
IF cl_gui_frontend_services=>gui_is_running = 'X'.
2022 Mar 14 4:16 PM
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.
2022 Mar 14 8:40 PM
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!