‎2011 Jan 08 1:06 PM
Hi guys,
I need help for tcode SM69
How do we access a BAT file from a directory path for example
C:\Program Files\Software_ABC\Deeper_folder\genxy.bat
Operating System = windows nt
Type = Customer
But I have no idea how to go about for the Operating System Command.
I'm supposed to run it like
C:\Program Files\Software_ABC\Deeper_folder\genxy.bat "E:\usr\sap\EWD\DVEBMGS00\data\File_20110107114455.xml"
Any advice? Appreciate it
‎2011 Jan 09 6:47 AM
Anyone can assist?
basically how do we run the .bat file from a directory?
That .bat will then run to encrypt a xml file.
‎2011 Jan 09 11:48 AM
Hello,
In SM69 you have two fields for this.
In operating system command (obligatory) you put the actual command, this means the full path to your executable and the name of the executable, in your case : C:\Program Files\Software_ABC\Deeper_folder\genxy.bat
In the field Parameters for operating system command (not obligatory) : you put all your arguments, in your case the XML file.
The parameters field can be left empty, when you then start the command you can still define another value, in your case another XML file.
OS commands defined in SM69 are always executed on the server, sometimes there is a misunderstanding on this.
When you want to execute a .bat file that remains on another computer, example a simple workstation PC, you will need to use other SAP functionalities.
Success.
Wim Van den Wyngaert
‎2011 Jan 10 9:58 AM
Hi there,
thanks but when I try to run it,
I'm receiving
'C:\Program' is not recognized as an internal or external command, operable program or batch file. External program terminated with exit code 1
‎2011 Jan 10 10:09 AM
Hello,
Are you trying to execute the external command in online mode or in background mode?
BR,
Suhas
PS:You can't run external commands in online mode.
‎2011 Jan 10 10:10 AM
Hello,
It seems that your command is truncated after the first blank.
I do not know the Windows world that much but did you try to put your command between double quotes ?
Example : "C:\Program Files\Software_ABC\Deeper_folder\genxy.bat"
I hope this helps.
Wim Van den Wyngaert
‎2011 Jan 10 10:12 AM
hhm
My program(web dynpro) will call it from a class which I have created.
So its like web dynpro > call a method from class > then method will execute FM SXPG_COMMAND_EXECUTE with the created External Command at SM69?
‎2011 Jan 10 10:18 AM
Hello,
Looks like the .BAT file will be accessed online! If so try CL_GUI_FRONTEND_SERVICES=>EXECUTE instead of 'SXPG_COMMAND_EXECUTE'.
BR,
Suhas
‎2011 Jan 10 12:39 PM
you create external command and pass command name in FM
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
or u can use following way
CONSTANTS: c_extcom TYPE sxpgcolist-name VALUE 'ZTEST',
c_oper TYPE syopsys VALUE 'Windows NT'.
DATA: v_dir_input TYPE sxpgcolist-parameters. " Input Directory
DATA: t_result TYPE STANDARD TABLE OF btcxpm.
v_dir_input = 'cmd /c C:\Program Files\Software_ABC\Deeper_folder\genxy.bat'.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = c_extcom
additional_parameters = v_dir_input
operatingsystem = c_oper
TABLES
exec_protocol = t_result
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.
‎2011 Jan 10 12:44 PM
hiii,
instead of using .bat extension use .xls or .xml bcoz in windows doesn't knw for which pgm the .bat file is used.
so using .xls would be easy and would get the output immediately.
hope it helps you.
regards,
akshay ruia