2009 Sep 23 9:22 AM
Hello expert,
How can I a external command from OS level? I do not mean FM GUI_EXEC which can only execute the commond from my local laptop.
the FM i am looking for should execute the file from D:\usr\sap\ABC\sys\....to restart the SAP system from OS level like it did in SM49.
Best regards,
Cliff
Hello expert,
How can I a external command from OS level? I do not mean FM GUI_EXEC which can only execute the commond from my local laptop.
the FM i am looking for should execute the file from D:\usr\sap\ABC\sys\....to restart the SAP system from OS level like it did in SM49.
Best regards,
Cliff
2009 Sep 23 9:28 AM
Hi,
Try with this RFC SXPG_COMMAND_EXECUTE. using this you can execute external commands in a external OS
Regards,
Vikranth
2009 Sep 23 9:32 AM
HI Vikranth,
I am using that. however It raise an error that my restart.bat can not be found..
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = 'd:\restart.bat' .
Many thanks.
2009 Sep 23 9:37 AM
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = 'C:\somu.bat'.
2009 Sep 23 9:39 AM
Hi,
SXPG_COMMAND_EXECUTE is only used when you want to execute a command on a external OS like a different UNIX server. If you are trying to exexute the file in the local presentation server use cl_gui_frontend_services=>execute as suggested.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
APPLICATION = 'd:\restart.bat'
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.
2009 Sep 23 9:42 AM
REPORT ZCOMMAND NO STANDARD PAGE HEADING.
PARAMETERS: CMD(30) DEFAULT 'd:\restart.bat' LOWER CASE.
call function 'GUI_EXEC'
exporting
command = CMD.
if the batch file is on the server is to use transactions SM69 and SM49 and then function module SXPG_COMMAND_EXECUTE.
2009 Sep 23 9:44 AM
i think the command should be UPPER CASE,
Edited by: eric.yang on Sep 23, 2009 10:46 AM
2009 Sep 23 9:54 AM
>
> i think the command should be UPPER CASE,
>
> Edited by: eric.yang on Sep 23, 2009 10:46 AM
No need of uppercase eric. just imagine a situation. can you have two files in a same folder with same name but different case?
2009 Sep 23 9:31 AM