SM69 (external operating system commands)
how can i use the MKDIR dos command in SAP using SM69
Here i am using LS command in SAP :
data: begin of t_tabl occurs 0,
line(132),
end of t_tabl.
data: lc_command(100) type c.
start-of-selection.
Get all the file name falling under specified directory...
lc_command(3) = 'ls '.
lc_command+3(45) = p_dir. " Directory of file path
call 'SYSTEM' id 'COMMAND' field lc_command
id 'TAB' field t_tabl-sys.
Check any files exits in the directory.......................
if t_tabl[] is initial.
message e006 with 'No files exist in the specified directory ' p_dir.
endif.
You can use MKDIR instaed of LS
Thanks
Seshu
Similar Messages
-
External Operating system Commands -GPG
Hi Experts,
Im quite new in SAP and we have a task to encrypt a file generated from SAP for upload to bank. We use the external operating system commands to call the gpg commands for file encryption. But we encounter an error when we execute the command
below is the error we encounter
gpg: [Recptient's ID]: skip : public key not found
gpg: [Filename] : encryption failed : public key not found
but when I run the command on OS level it execute properly without any problem.
hope you guys could me an idea on how to fix the issue i encounter
Thanks in advance!!Louie,
What is the command that you used? which OS?
Thank you
Regards -
Re: Error while Execute External Operating System Command using T.code SM49
Dear Experts,
I Have uploaded one .exe file in the application server (eg: sum.exe) and created the OS command in SM69 transaction .
And maintained the application server path in the 'operating system command' field in SM69 t.code.
Our SAP system, oprating system is UNIX.
After I have executed the external command using transaction SM49 , but I got the below error.
Can not execute external program (permission denied) , External program terminated with exit code 1
Immediately I run the SU53 transaction code to check the authorization, but Authorization was successful.
Could any one please help on this error.
Thanks in advance.>>Can not execute external program (permission denied) , External program terminated with exit code 1
You need to give the permission as 755 to your file.
>>I Have uploaded one .exe file in the application server (eg: sum.exe)
You are on UNIX and do not expect to any result of .exe file as UNIX doesn't know about this. -
Integrating External Operating System Commands into ABAP program.
Hi folks,
using the transaction code sm69 it is possible to create an SAP command that's executing an operating system command.
Is it possible to integrate such an SAP command into our ABAP programs ?
How would we do so ?
Regards
ThomasHello Thomas,
We have an easier way of achieving this without declaring a command in SM69.
Try the below piece of code:
DATA: command LIKE rs37a-line.
DATA: BEGIN OF tabl OCCURS 0,
line(2000),
END OF tabl.
command = 'ls -l'.
CALL 'SYSTEM' ID 'COMMAND' FIELD command
ID 'TAB' FIELD tabl-*sys*.
Replace the string in the variable 'comand' with any UNIX command.
Regards
Sabu -
Execute external operating system command
Hi Friends,
I have a requirement to run a script file with extention '.PL' on the application server using ABAP.
i have sample how to run it in XI.
XI3.0 provides a very simple way of handling this using the "Operating System Command" in the File Adapter.
I post my output file in the following folder,
/usr/sap/sapout/test/
The shell script is available in the following path,
/usr/sap/bin/convert.pl
The figure below explains as to how we call the shell script using "Operating System Command".
File Acess parameters
Target Directory = /usr/sap/sapout/test/
File Name Scheme = TestOutput.txt
Processing Parameters
File Construction Mode = Add Time Stamp
File Type = Binary
Operating System Command = /usr/sap/bin/convert.pl %F
I have to do the same thing in ABAP as it has been done for XI as mentioned in the above example.
My operating system is UNIX.
If any one can give me a sample it would be really helpful to me.
Thanks in advance,
Arundhathi.Hi Arundhati,
You can run operating system commands from ABAP.
e.g. If you want to change UNIX right for any file, you can use following code.
lv_ucomm = 'chmod a+rwx 123.txt'.
CALL 'SYSTEM' ID 'COMMAND' FIELD lv_ucomm.
whatever command you provide in Field parameter ( lv_ucomm in the above case ), ABAP run that command at operating system level.
In your case, you can provide command in lv_ucomm to run script at operating system level.
Hope it will help you.
Regards,
Naren -
Auto-Reaction Method - External Operating System Command
Hello ,
I am trying to run a script (test.cmd) on a monitored java system out of solution manager via ccms auto-reaction method, but without success.
I have created a RFC Connection to the java system in transaction sm59, defined an external operation command in transaction sm69 (/usr/sap/test.cmd) and an auto-reaction method using that command. But when I test the command in transaction sm49 with the RFC connection as target destination, the command is executed on the local CEN system (SolutionManager system) instead of the monitored java system. I have no clue where's the problem???
Thanks for any help (points, points, points)
MirkoHi Anand,
can you please send me that doc too pleae.
[email protected]
I really appreciate your help.
Thanks, -
Wild Cards in External Operating System Commands for HP-UX
Hello,
Is it possible to use wildcards for HP-UX commands in SM69?
For example, I would think the following would work in HP-UX:
mv /directory/file_name.* /directory2
But whenever I execute a command with the * wildcard in SM69 I get the message 'No such file or directory'
Thanks,
JoelThis is wierd, I can't even do 'ls *.TRC'
Here's another example, using absolute path names that didn't work:
mv /usr/afisinw_cpafiscd/WHSE/ready/portalActivity_311688752_1243622628104.* /usr/afisinw_cpafiscd/WHSE/ready/portalActivityOld
error: cannot access: No such file or directory External program terminated with exit code 1
But when I replace the * with txt it works. Unfortuneately I need to move multiple portalActivity files each time, and the beauty of using an external command is that my ABAP program is only a few lines long.
Could there be some sort of a safety feature in SAP to prevent the use of * in external commands? -
How to call Operating System commands / external programs from within APEX
Hi,
Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
Any pointers will be greatly appreciated.
Thanks & Regards,Hi Guys,
I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
sqlplusw.exe user/password@database @script1.sql
sqlplusw.exe user/password@database @script2.sql
sqlplusw.exe user/password@database @script3.sql
sqlplusw.exe user/password@database @script4.sql
What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
Any help will be greatly appreciated.
Thanks & Regards, -
CCMS Auto-React: Operating System Commands
Hi Gurus,
I want to run an operating system command in the event that an alert is raised in my CEN CCMS system.
I have set up the operating system command in SCEN (using SM69) and tested it -- no problems. I have used the example given on help.sap.com. It works great from SM69 or SM49.
I have created a custom MTE Auto-Reaction Method that is a copy of the SAP standard and it points to the logical name of the op system command I created in SM69.
But, when I assign the Auto-Reaction method to an MTE and kick off the auto-reaction, nothing happens. I have tried assigning it auto-reaction method as a method for a local MTE and also as a central auto-reaction, but I get nothing.
Please help me see what I am missing.
Many thanks in advance,
Nic DoodsonHi Michael,
Thanks for the response, I hope you can help.
Logical command is called: Z_NI_ALERT_OVO
It calls the operating system command: /usr/sap/tmp/test.sh
It allows additional parameters.
test.sh is :
#!/usr/bin/sh
echo $2 alert from $1 Message $5 $4 > /usr/sap/tmp/alert_$3.txt
I can run this from SM49/SM69 and it works fine.
Method is: Z_SEND_ALERT_TO_OVO
Calls function module: SALO_EXECUTE_SYSTEM_COMMAND_V2
Can be executed on: Any Server
Execution Method: Periodically in Dialog Process
Parameters:
COMMAND : Z_NI_ALERT_OVO
PARAMATERS : <blank>
REACT_ON_ALERTS : red
MTENAME : SID/SEGMENT/CONTEXT/OBJECT/ATTRIBUTE
PARAMLIST_1: COLOR DATE_TIME MSG
PARAMLIST_2: ID
Help!
I can only think there is something about it being a local/centrally distrubuted auto-reaction method...I'm assigning it as a cenrally distributed auto-reaction method.
Any input would be great.
Cheers,
Nic -
How to execute Operating System commands from Stored procedure.
Any help on how to execute Operating System commands from stored procedures will be appreciated.
Nanditha.Search the forums for 'External Procedure' and you will find example code that has been posted before.
-
How to Run Operating System Command Before/After Message Processing SAP PI
Hi,
We are trying to execute multiple commands via "Operating System Command Before/After Message Processing".
When we use single command say for example cp or mv (copy or move) the commands get executed fine.
eg: cp %F /var/opt/data/outbound/Test/Dummy.txt
/this works fine/
when we club commands together or try to redirect the outputs of commands, none of the commands get executed.
eg:
cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
or
wc -l %F > /var/opt/data/outbound/Test/Dummy.txt
Is it possible to execute multiple commands or redirect the output of commands without using a shell script? The PI server we are working on iis hosted on UNIX environment.Hi Harleen,
try like this
cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
instead of semicolon try this
(1) &
command1 & command2
Execute Command1 and then execute Command2
(2) &&
command1 && command2
Runs the command2 only when command1 doesn't Complete successfully
(3) ||
command1 || command2
Runs the second command if the first command had an error
(4) ()
(command1 || command2) || (command3 & command4)
Defines the order in which commands are to be executed
Regards
Suraj -
Operating system command in file receiver adapter
Hi,
How to use the Run Operating system command after message processing option in the parameters tab of the file receiver adapter.
I am working on a scenario wherein a batch file needs to be invoked after the file is written on the file system.
So how do i invoke this batch file from the file reciever adapter ( Run Operating system command after message processing ).Hi,
did you see this page?
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/content.htm
it shows all you need to know
Regards,
Michal KRawczyk -
Unzip file using operating system command in file/ftp receiver adapter
Hi,
I'm wonderdering how to unzip a zip-file in the receiver file/ftp adapter. I know it is possible to do it using the 'Operating system command' feature, but somehow the command I use seems to be ignored! (I'm using SP14, unix).
The command I entered is quite simple: unzip %F (also tried the %f, but i guess it doesn't really matter wich on I use).
Is it possible that I'm unzipping to another directory than the one i expect? the unzip should be performed to/in the current directory, and assumingly current directory is the one stated in the 'Target Directory', right?
Hope someone can clearify this issue for me.
Best regards,
DanielHi Daniel,
It seems to me also, that the files are being unzipped to a different location than what you are expecting. The OS command might getting executed in some default location(i am trying to fnd that out)on the server and not in the target directory of the channel(It seems logical to me)....
If you have time...pls try this out & see whether this would help...
Have a shell script written with the following commands in them
cd <path to target directory>
unzip $1(filename from the channel)
and in the OS command in the Channel give....
<absolute path to the .sh file> %F
Thanks,
Renjith. -
File Adapter 7.11 - set operating system command line dynamically
Hi,
is there any way to set the "Operating System Command Line" in the file adapter as ASMA / dynamic attribute?
I need to set a command line exec depending on some XSL mapping values.
thx
holgerhi,
>>>is there any way to set the "Operating System Command Line" in the file adapter as ASMA / dynamic attribute?
>>>I need to set a command line exec depending on some XSL mapping values.
think about this approach:
you put the XSL values into the filename after the real name of the file
in the batch script you use those values in order to execute a dynamic exe command
after processing you just change the name of the file in the script by removing the xsl values
simple ? I think so
Regards,
Michal Krawczyk -
File Receiver Adapter:Run Operating System COmmand after message Processig:
Dear All,
I have gone through this link
[http://help.sap.com/saphelp_nw2004s/helpdata/EN/e3/94007075cae04f930cc4c034e411e1/content.htm]
But i have a problem.
In the scenario which we have, File name is DYNAMICALLY GENERATED by a UDF
I want to call the file at run time after message processing via Command Line and execute some os commands.
But since the file name is Dynamic....How will i call the file at run time in Command Line:
SYNTAX: %f(FileName)
How will i specify the file name in the above syntax as the file name is Dynamic and not constatnt.
Please Advice.
Senthilprakash.Dear All,
Yes just now i got the answer from this thread[OS command line script - Need help;
Actually i have another doubt now
In REVEIVER FILE ADAPTER:
when we give Run Operating system Command After Message processing
does the OS command get executed after the output file is placed in the Receiver folder/server or before its placed in the receiver folder?
Regards,
Senthilprakash.
Maybe you are looking for
-
Late 2011 MacBook Pro 13" noisy fan.
Hi everyone, about a month ago I purchased my MacBook Pro 13" Late 2011. Some info about it: OS X 10.9.4 2.4 GHz Intel Core i5 4 GB Ram Intel HD Graphics 3000 384 MB Anyway, from when i bought it, there was no issue with the fan, but recently, from a
-
Runtime error alv list report out put
Runtime Errors GETWA_NOT_ASSIGNED Date and Time 03.03.2014 13:11:56 Short text Field symbol has not yet been assigned. What happened? Error in the ABAP Application Program The current ABAP program "SAPLKKBL" had to be
-
Automatic clearing of FI documents
When I reversed a MIRO invoice through MR8M, the invoice was successfully reversed, but the corresponding FI documents were not reversed. Is that normal, shouldnt the FI document be reversed automatically. We are using ECC 6.0. The system gave me th
-
Hooking up my ps2 to my mac mini
I want to hook up my ps2 to my mac mini so i don't have to use my tv and use the 20" apple screen as the display instead. Im not sure what to buy and what would work, any ideas? Thanks
-
ITunes Store movie not syncing because login could not be verified
I bought a movie from the i tunes Store. When I sync with my ATV the movie does not sync. An information icon appears, and when I click on the icon it says that my movie could not sync because the ATV could not verify my login. The message suggest th