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

Similar Messages

  • 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.

  • 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

  • Executing a Operating System command from Stored Procedure ??

    I want to execute a Operating System command from a PL/SQL Stored Procedure, can anyone suggest me how can I do this ??
    I am on Sun-Solaris with Oracle 8.1.7 database.
    Please do email me at [email protected]
    Thanks in Advance,
    Ramesh L.

    Are you using a webserver? If so, you could make your operating system script into a CGI program, then execute it from pl/sql using utl_http.request.

  • 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
    Thomas

    Hello 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

  • 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)
    Mirko

    Hi 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,
    Joel

    This 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?

  • 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

  • Executing Operating system commands in ABAP

    Hi
    I want to execute a unix operating system command in an ABAP program. I remember seeing code which executes an operating system command. Could any please let me know about that code?
    Thank You.
    Eswar

    Hi,
    you can try something like this.
    data:cmd(254) type c.
    data: RESULT(255) OCCURS 100 WITH HEADER LINE.
                cmd = 'ls'.
    ** Execute command
      REFRESH RESULT.
      CALL 'SYSTEM' ID 'COMMAND' FIELD CMD
                    ID 'TAB'     FIELD RESULT-*SYS*.
    Kostas

  • Operating System Command in JDBC Sender

    Hello everybody,
    I'm trying to find some syntax to execute an operating system command on Windows Server 2003, but the commands don't seem to work I'm actually trying to generate a directory, now the problem is that I can't find syntax examples on how to do this I tried something like MKDIR TEST, now is the syntax of the command lines as you write them in Command Prompt, or maybe there is my error, thanks in advance.
    Regards,

    Confirmed.
    JDBC sender also support OS command.
    Refer to note 841704 if you face any issue while executing OS command in JDBC adapter.
    Note: OS Command execute when processing in database executed successfully. It is even independent on OS command Errors.
    Thanks
    Farooq
    Edited by: Farooq Farooqui on Jan 16, 2009 11:36 AM

  • How does client invoke an operating system command in the Server machine.?

    Guys,
    Is there any way that a client could trigger an operating system command on the Oracle Server machine?
    I've a VB scipt file in the server machine.My requirement is to execute that VB file on the server machine.(The script would essentially create a DSN on the server machine).
    The normal way to execute a VB script would be to specify the name of the file in the command prompt.(If my VB script ONDEMAND.VBS resides in C:\ONDEMAND folder,I need to execute the statement
    "C:\ONDEMAND\ONDEMAND.VBS" in the command prompt to get it executed.)
    I would utilise the SQL command below
    HOST C:\ONDEMAND\ONDEMAND.VBS
    to invoke it programatically(from a PL\SQL scipt).
    Can someone help me in utiliting HOST command in Oracle(Or by any other means) for a client database operation to execute an Operating system command in the Oracle server machine?
    Thanks,
    Bhagat

    Hi Bhagat,
    This has been asked several times recently:
    Executing Shell Script from PL/SQL Block
    Fire an executable using oracle
    Cheers,
    Colin

  • 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,

  • 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.

  • Vista: use the windows program manager to execute operating system commands

    attempting to run forms 6 on vista... the forms app attempts a call sqlplus using the host builtin to populate some tables before calling the report.
    in windows vista i get a message box indicating "use the windows program manager to execute operating system commands".
    is this windwos vista message? would this have to do with permissions?
    any insight most appreciated and thanks in advance.

    I don't know about the HOST-problem, but..
    the forms app attempts a call sqlplus using the host builtin to populate some tables before calling the report.What about putting the logic from the SQL*Plus-scripts into a database-procedure and call that instead. I think,, with the current approach you will get problems at least when you have to migrate to Web (e.g. Forms 10g).

  • Executing operating system command within trigger or procedure

    Hello
    Can some one help me out as how to execute operating system command (unix or windows ex.. stop,start,cc,del or copy etc...) in a trigger or procedure.
    My requirement is, if some predefined error occure then listener listener should be stopped automatically.
    Thanks in advance
    kvss

    Here is some code to tell you how to do:
    First a small Java program that taker a string as a parameter and executes it as an os-command
    import java.lang.Runtime;
    import java.lang.Process;
    public class Commands extends Object {
    * Constructor
    public Commands() {
    // On NT the command should be like this "cmd /c del c:\temp\readme.txt"
    // exec execute('cmd /c del c:\temp\readme.txt');
    public static void execute (String cmd ) {
    try {
    Process p = Runtime.getRuntime().exec(cmd);
    try {
    p.waitFor();
    catch (java.lang.InterruptedException intex ) {
    intex.printStackTrace();
    System.out.println("Return = "+ p.exitValue());
    System.out.println(" Done ...");
    catch ( java.io.IOException iox) {
    iox.printStackTrace();
    ===================end of java ====
    Use loadjava to load it into the database and create a pl/sql wrapper around the java code.
    See the manual about loadjava details.
    Log in to sqlplus as SYSTEM and create a role for this purpose e.g. 'JAVA_ROLE'
    and exec the following as SYSTEM or SYS to make sure the user has the the needed privs.
    dbms_java.grant_permission('JAVA_ROLE','SYS:java.io.FilePermission','<<ALL FILES>>','read,write,execute,delete');
    dbms_java.grant_permission('JAVA_ROLE','SYS:java.lang.RuntimePermission','writeFileDescriptor',null);
    dbms_java.grant_permission('JAVA_ROLE','SYS:java.lang.RuntimePermission','readFileDescriptor',null);
    and you're done.

Maybe you are looking for

  • ICloud on my iPad does not work in iOS 8

    Hi all, I have a problem with iCloud after upgrade to iOS 8 on my iPad. I have updated from IOS 7 to 8 without turning on the iCloud Drive feature (because of the Mavericks on my Macbook Pro in that time). Applications like “Pages”, “Numbers”, “MindN

  • Can't open a VI

    I can't open my VI. There is a message " Labview.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created ". I send to you the VI and the failurelog file. I think maybe there was a pr

  • Itunes -50 error-any suggestions?

    I tried to rent a movie, and was given this error message in Itunes. 

  • CS5 Bridge and Permission Problems

    Hello there; I just started experiencing a problem with Adobe Bridge.  I am (and have been) using CS5 with no problems at all until just recently.  Adobe Bridge does not seem to delete image files or rename image files for some strange reason.  I get

  • What is up with my iMac?

    So here is what is happening to my iMac, (by the way its a power g5 non iSight leopard OS)It began to freeze and slow down , got the grey screen and would not boot up again. Tried all of the combination of command + keys available, nothing. Tried tar