‎2011 Nov 23 6:57 AM
Hi Experts,
I need to launch or terminate an external application (i.e. command prompt, notepad, etc.) in background job by using FM SXPG_COMMAND_EXECUTE. However, I am unable to proceed because of the following error occured after executing the command in SM69.
Can't exec external program (No such file or directory)
External program terminated with exit code 1
I was using the following sample code. Can someone tell me what might be the cause of the problem?
DATA: lv_status TYPE extcmdexex-status,
lt_output TYPE TABLE OF btcxpm,
lv_opsys TYPE sy-opsys.
lv_opsys = 'WINDOWS NT'.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZIEXPLORE'
additional_parameters = '/c'
operatingsystem = lv_opsys
IMPORTING
status = lv_status
TABLES
exec_protocol = lt_output
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.ZIEXPLORE command
Operating system command: cmd
Parameters for operating system command: taskkill /f /im iexplore.exe
Thanks and Regards,
Louie
‎2011 Nov 23 7:17 AM
Hi,
I think you have mention it in SM69 under operating system command like cmd /c taskkill /f /im iexplore.exe and the remove additional_parameters = '/c' and check it
‎2011 Nov 23 10:11 AM
Hi Keshav,
I tried it and the error is just the same. I intended to put /c in the additional parameters to close the command prompt after execution.
‎2011 Nov 23 10:36 AM
lv_opsys = 'WINDOWS NT'.
In Sm69 is this given in all upper case, if not give as its given in SM69 and try it once again.
Kesav
‎2011 Nov 23 11:07 AM
Yes it is. I also tried passing 'Windows NT' but it raised an exception command_not_found. I believe i'm passing the right operating system in it's correct case.
‎2011 Nov 23 11:15 AM
‎2011 Nov 23 12:31 PM
‎2011 Nov 23 12:35 PM
Now you reached the root cause of your problem. Happy to know that
Contact your basis team and get it corrected.
Kesav
‎2011 Nov 25 10:50 AM
Hi Keshav,
I tried your suggestion, and our basis are just adjusting the authorizations seen in SU53. I also browsed the related objects to this which are S_LOG_COM & S_RZL_ADM and I believe I already have authorizations to those. Do you think this was really the cause of the issue? By the way, I tried to run SXPG_COMMAND_EXECUTE using the following parameters below and it works fine. That's why I really have a doubt if the problem is with basis. Might be with the RFC connections in SM59. Please help. Thanks!
Operating System: UNIX
Operating System Command: ls
Parameters for operating system command: /usr/sap/tmp
‎2011 Nov 25 11:25 AM
Hi Louie,
I am not able to assume the reason of the problem, If you say that its not getting executed in SM49 then the problem lies there.
So I am providing you a link which might be helpful, just go through it and cross check. There is a parameter called "trace" in the fm mentioned.
Secton Microsoft Windows NT - [Prerequisites for Running External Commands and External Programs|http://help.sap.com/saphelp_nw70/helpdata/en/c4/3a7fbb505211d189550000e829fbbd/content.htm]
[Analyzing Problems with External Commands and Programs|http://help.sap.com/saphelp_nw70/helpdata/en/c4/3a80c4505211d189550000e829fbbd/content.htm]
May be you can post this question in [SAP AS General|; also.
‎2011 Nov 25 12:34 PM
Hi Louie,
if authorizations and parameters are correctly set, check below tables
SXPGCOSTAB
SXPGCOTABE
also try SY-OPSYS.
Regards,
Ravi.
‎2011 Nov 25 2:06 PM
Hi Ravi,
I saw that the custom and standard external commands are in SXPGCOSTAB and SXPGCOTABE tables respectively. Is it necessary that SY-OPSYS from the system should be passed and not the operating system created in SM69?
‎2011 Nov 28 5:18 AM
Hi,
Obiveously not nesseary to pass SY-OPSYS.
In my system operating system names are defined in table SXPGCOTABE as
UNIX
Windows NTi thougnt about case(Upper/Lower) of parameters defined.
Regards,
Ravi.