‎2011 Nov 21 9:23 AM
My requirement is to launch an external application in BSP upon clicking a button. We tried to use method CL_GUI_FRONTEND_SERVICES=>EXECUTE, however, I found out that this is not possible in BSP as it is said to be working in a browser environment (source: []). I found another alternative by running a program (which is successful at foreground) in background job through triggering event (source: [http://www.erpdb.info/wp-content/uploads/2008/12/call-abap-program-from-bsp-sample-code.pdf]), but as I tried to simulate that, the program wasn't successful to launch an external application, i found out that sy-subrc after CL_GUI_FRONTEND_SERVICES=>EXECUTE is not equal to 0. Can someone tell me why it is not successful in background?
‎2011 Nov 21 9:34 AM
Hello,
The method CL_GUI_FRONTEND_SERVICES=>EXECUTE will not work in background.
The class CL_GUI_FRONTEND_SERVICES is meant for foreground services.
You need to use SUBMIT statement run the report in background.
Thanks,
Sandhya.
‎2011 Nov 21 9:34 AM
Hello,
The method CL_GUI_FRONTEND_SERVICES=>EXECUTE will not work in background.
The class CL_GUI_FRONTEND_SERVICES is meant for foreground services.
You need to use SUBMIT statement run the report in background.
Thanks,
Sandhya.
‎2011 Nov 21 9:51 AM
Hi Sandhya,
You need to use SUBMIT statement run the report in background.
That's exactly what I'm doing. I created a program to create a background job using SUBMIT statement, but still the method is not returning sy-subrc EQ 0. Do you know how to make it in foreground? I also tried to record the program (in SHDB) and create a session (in SM35) to execute it in foreground but still it is not successful to launch the application.
‎2011 Nov 21 10:15 AM
Hi Louie,
You can use the VIA SELECTION SCREEN addition in SUBMIT statement to run in foreground.
Syntax :
submit Y_REPORT via selection-screen with parameter1 = 'VALUE1'
with parameter2 = 'VALUE2' and return.
Thanks,
Sandhya.
‎2011 Nov 21 10:53 AM
Hello,
Please remember you cannot use GUI FMs, methods in background, period!
If you want to execute a program in background mode, you need to create an external OS command & call it using 'SXPG_COMMAND_EXECUTE'!
BR,
Suhas
PS: I've no experience on BSPs, not use whether an external OS command will help you to achieve your requirement
‎2011 Nov 21 11:56 AM
Sandhya,
I tried your suggestion and it worked by manually executing the program with syntax SUBMIT. However, my requirement is to launch immediately the application upon pressing the button. I don't want to display the selection screen and execute upon clicking it. Thanks to your suggestion anyway
Regards,
Louie
‎2011 Nov 21 12:07 PM
Suhas,
Thanks to your suggestion, even though you're still unsure if it will work, I'll still try to use it. Would you mind helping me translating the requirement below (below are just sample application and parameter) to function SXPG_COMMAND_EXECUTE? I'm currently researching on how to maintain external commands through SM69. Will really appreciate your help.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = '"C:\Program Files\Internet Explorer\IEXPLORE.EXE"'
parameter = 'www.google.com'
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,
Louie
‎2011 Nov 21 10:27 AM
Hi.
Can someone tell me why it is not successful in background?
CL_GUI_FRONTEND_SERVICES is a class for frontend GUI communication. If you run a program in background mode, then you have no frontend (and SAPGUI) access. This causes your issue, but I can see no workaround for that.
Regards,
Klaus