Is it possible to run host command in sap environment

hi
could any body tel me
is it possible to run host command in sap environment
then how..?

yeah , by using FM
EXECUTE_FUNCTION
Regards
Prabhu

Similar Messages

  • Is it possible to run host command from SAP environment? How do you run?

    Hi
    Is it possible to run host command from SAP environment? How do you run?
    Thank You

    Hello Subhash
    You will more details in the following thread:
    Re: How to define command for SXPG_COMMAND_EXECUTE
    Regards
      Uwe

  • Possible to run host command ???

    Hi experts,
    Is it possible to run host command from SAP environment? How do you run? 
    Thanks,
    Logu

    check whether this helps
    DATA:os TYPE sxpgcolist-opsystem.
        DATA:host TYPE rfcdisplay-rfchost.
        DATA:commandname TYPE sxpgcolist-name.
        DATA:exec_protocol LIKE STANDARD TABLE OF btcxpm.
        os = sy-opsys.
        host = sy-host.
        commandname = 'ZDOWNLOAD'.  "SAP Command Name
        CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
          EXPORTING
            commandname     = commandname
            operatingsystem = os
            targetsystem    = host
            stdout          = 'X'
            stderr          = 'X'
            terminationwait = 'X'
          TABLES
            exec_protocol   = exec_protocol[].
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

  • Wht is run host command.

    Is it possible to run host command from SAP environment? how do u run

    Hello Shilpa,
    Please check the prerequisites for calling external Programms where the Host calling is described in detail in this folllwog link.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7fbb505211d189550000e829fbbd/content.htm
    Please award points for helkpful answers.
    Revert back for queries.
    Br,
    Sri

  • Not able to create Oracle External Procedure to Run Host Commands

    Trying to follow this article
    http://timarcher.com/node/9
    Its related to
    Oracle External Procedure to Run Host Commands
    steps
    1)mkdir –p /u01/app/usfapp/oracle_external_procs/oracle_host
    2)
    Author is suggesting to create a file
    but header file is missing in very first line... may be not sure..say it is <stdio.h>Create a file named oracle_host.c. The contents of this file will be:
    #include
    int RunCmd(char *cmd)
    return(system(cmd));
    4) Create the file named makefile. The contents of this file will be:
    oracle_host: oracle_host.o
    gcc -shared -o oracle_host.so oracle_host.o
    $ cat makefile
    oracle_host: oracle_host.o
         gcc -shared -o oracle_host.so oracle_host.o
    5)
    Now run the command make
    The output on my server looks like:
    [u01/app/usfapp/oracle_external_procs/oracle_host]
    banner@usfbannerte [TRNG] > make
    gcc -shared -o oracle_host.so oracle_host.o
    here I stuck .. Not able to run this step ]$ make
    gcc -shared -o oracle_host.so oracle_host.o
    /usr/bin/ld: oracle_host.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    oracle_host.o: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [oracle_host] Error 1
    Any one has any idea what went wrong
    Any other link related to this is most welcomed.
    Please suggest ...

    hi
    please update
    or
    provide any other link / document for
    Oracle External Procedure to Run Host Commands
    --using c
    Thanks in advance.

  • Is it possible to run a command prompt(or DOS Command) through flash and run a Activex(.OCX) file from flash

    Hi all
        Is it possible to run a command prompt(or DOS Command) through flash.If it possible please guide me to do that throug AS 3.0.
       and
    Is it Possible to run a activex (.OCX) file from flash. If it is so please guide me the way to do it
    Thanks and Advance
    Sankar.M.S

    Or create a desktop shortcut (in Windows) or an application launcher ( in Linux GUI).

  • Is it possible to run a command when a monitor goes to a healthy state?

     
    Hi,  I'm using SCOM 2007R2
    Is it possible to run a command/script when a web application Monitor changes to a healthy state?
    I have a web application monitor that checks four different websites from our proxy servers.  on the aggregate rollup of all four sites I have a health rollup policy of 'Best state' meaning
    that the monitor will only go critical if all four sites are unreachable. If that happens I have a Diagnostic task that runs to Stop the w3svc service.
    This stops the proxy server serving ‘Page cannot be displayed’ content to the users within the company.
    What I would like to do is start IIS automatically when the web application monitor goes to a healthy state.
    I’m guessing I’m going to need a script that perhaps pings the sites every few minutes then starts the w3svc service if it gets a result.

    Hi,
    I recommend you touch the Orchestrator, Orchestrator can integrate
    SCOM.
    Use Orchestrator to design a Runbook for your task. When the state of a web application Monitor changes to healthy, then run a command/script.
    System Center 2012 Orchestrator.
    Orchestrator is a workflow management solution for the data center. Orchestrator lets you automate the creation, monitoring, and deployment of resources in your environment.
    For more information, please review the link below:
    System Center Integration Pack for System Center Operations Manager 2007 R2
    http://technet.microsoft.com/en-us/library/hh531770.aspx
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Is it possible to run a command prompt(or DOS Command)  and Activex File(.OCX)

    Hi all
    Is it possible to run a command prompt(or DOS Command) through flash.If it possible please guide me to do that throug as 2.0. and is it possible to run a Activex File(.OCX) through flash.
    Thanks and Regards
    Sankar.M.S

    Or create a desktop shortcut (in Windows) or an application launcher ( in Linux GUI).

  • Can PL/SQL Run Host Command (DOS Command) ??

    Hi All,
    Can PL/Sql run HOST Command ?
    If can't, iis there any other way to execute the DOS command ?
    Thanks for help.
    Iwan

    Hi sarah,
    i have tried, but it didn't work.
    in my abc.sql script : (host in pl/sql level)
    BEGIN
    HOST('cmd /C dir *.*');
    END;
    exit
    but it still didn't work
    so i tried in sqlplus level :
    variable vStatus VARCHAR2(1);
    variable vCmd VARCHAR2(3000);
    BEGIN
    :vCmd := 'C:\Program Files\Internet Explorer\iexplore';
    END;
    HOST("C:\Program Files\Internet Explorer\iexplore");
    EXIT;
    if i put HOST("C:\Program Files\Internet Explorer\iexplore"); --> it worked....
    If i put HOST(:vCmd); --> i won't work.
    Any body can help ?
    Thanks,
    Iwan

  • How to run DOS command in Java environment?

    Can i run DOS command in Java environment?
    I did like this:
    Runtime r = Runtime.getRuntime();
    r.exec("cmd.exe");
    r.exec("set classpath=%CLASSPATH%;.\\tmp")
    but failed.
    However if I run the java command, it runs successfully.
    r.exec("javac Test.java");
    r.exec("java Test");
    how should I do so that i can run the DOS commands metioned above in Java Environment?
    thanks a lot.

    Have a look at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    This may help. I wonder if this is ok ?
    Runtime r= Runtime.getRuntime();
    r.exec("cmd.exe /C set classpath=%CLASSPATH%;.\\tmp\"");

  • Trouble Running Host Command

    Hello folks I am trying to create a procedure to run linux host commands. I have found and used code available throughout the internet and it compiles and runs, but no matter what command I send to the host I get a 'Not Found' exception, even if I send as the command the full path to the executable. Here is my code:
    *1- Java Procedure*
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) {
    finalCommand = new String[4];
    finalCommand[0] = "C:\\winnt\\system32\\cmd.exe";
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    } else {                              // Linux or Unix System
    finalCommand = new String[3];
    //finalCommand[0] = "/bin/sh";
    //finalCommand[1] = "-c";
    //finalCommand[2] = "'" + command + "'";
    finalCommand[0] = command;
    finalCommand[1] = "";
    finalCommand[2] = "";
    // Execute the command...
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    // Capture output from STDOUT...
    BufferedReader br_in = null;
    try {
    br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println("stdout: " + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_in.close();
    } catch (IOException ioe) {
    System.out.println("Error printing process output.");
    ioe.printStackTrace();
    } finally {
    try {
    br_in.close();
    } catch (Exception ex) {}
    // Capture output from STDERR...
    BufferedReader br_err = null;
    try {
    br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println("stderr: " + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    br_err.close();
    } catch (IOException ioe) {
    System.out.println("Error printing execution errors.");
    ioe.printStackTrace();
    } finally {
    try {
    br_err.close();
    } catch (Exception ex) {}
    catch (Exception ex) {
    System.out.println("Exception: " + ex.getLocalizedMessage());
         ex.printStackTrace();
    *2- PL/SQL Package*
    CREATE OR REPLACE PACKAGE CIF_HOST_PKG IS
    PROCEDURE host (p_command IN VARCHAR2);
    END CIF_HOST_PKG;
    PROCEDURE host (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    END CIF_HOST_PKG;
    *3- Java Permission*
    EXEC Dbms_Java.Grant_Permission('CIF', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC Dbms_Java.Grant_Permission('CIF', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    exec dbms_java.grant_permission( 'CIF', 'SYS:java.io.FilePermission', '/bin/sh', 'execute' );
    exec dbms_java.grant_permission( 'CIF', 'SYS:java.io.FilePermission', '/bin/ps', 'read , execute' );
    exec dbms_java.grant_permission( 'CIF', 'SYS:java.io.FilePermission', '/bin/ls', 'read , execute' );
    *4- Test Code*
    set serveroutput on size 1000000
    exec dbms_java.set_output(1000000)
    exec CIF_HOST_PKG.host('/bin/ls -l');
    *5- Test Output*
    anonymous block completed
    Exception: Exception during creation of the process: java.io.IOException: '/bin/ls -l' not found
    java.io.IOException: Exception during creation of the process: java.io.IOException: '/bin/ls -l' not found
         at java.lang.OracleProcess.start(OracleProcess.java:259)
         at java.lang.ProcessBuilder.start(ProcessBuilder.java:483)
         at java.lang.Runtime.exec(Runtime.java:591)
         at java.lang.Runtime.exec(Runtime.java:464)
         at Host.executeCommand(Host:24)
    Any idea on what am I doing wrong?
    Thank you in advance,
    Andre

    Has oracle user permissions to /bin/ls ?
    try in sqlplus:
    host /bin/ls -lIf not try chmod 777 /bin/lsElse you can try my package http://github.com/xtender/xt_svn
    select * from table(XT_SVN_TEST.shell_exec('/bin/ls -l /var/tmp'))Best regards,
    Malakshinov Sayan

  • Java running host command

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE     11.1.0.6.0     Production
    TNS for HPUX: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Hi,
    I am not familiar with Java setting in Oracle
    I have a a stored procedure that call a java program to execute host command like
    ssh user1@localhost '/home/user1/someprogram'
    if we execute this directly using PuTTY
    we can do the following with no problem
    su - oracle
    ssh user1@localhost '/home/user1/someprogram'
    but when we execute the stored procedure,
    we have to do
    */usr/bin/ssh* user1@localhost '/home/user1/someprogram'
    does anybody where to set the path or environment to make the java know the path correctly.
    thanks
    Edited by: HGDBA on Mar 11, 2011 10:49 AM

    OK. You can try the following:
    Login as the Unix user (e.g. oracle) on the pre-upgrade environment and run the following command.
    echo $PATH
    Repeat the above in the post-upgrade environment and compare the two outputs. Generally, PATH will be set using an environment script called from .profile of the user or it could be directly defined in .profile.
    You can check this by examining the .profile after logging in as the OS user (e.g. oracle):
    vi ~/.profile #i.e check the .profile in the user's home directory.
    It's my best guess, as sometimes the PATH could be added later on (for. e.g by another script). Anyways, give it a try and tell what you find.

  • Java running host command - moved from PL/SQL forums

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for HPUX: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Hi,
    I am not familiar with Java setting in Oracle
    I have a a stored procedure that call a java program to execute host command like
    ssh user1@localhost '/home/user1/someprogram'
    if we execute this directly using PuTTY
    we can do the following with no problem
    su - oracle
    ssh user1@localhost '/home/user1/someprogram'
    but when we execute the stored procedure,
    we have to do
    */usr/bin/ssh* user1@localhost '/home/user1/someprogram'
    does anybody where to set the path or environment to make the java know the path correctly.
    thanks
    ps:. this is happen after we recently upgraded our Oracle from 9.2.0.8 to 11.1.0.6

    pgoel wrote:
    You said,
    a stored procedure that call a java program to execute host command like ssh user1@localhost '/home/user1/someprogram'SP -calls> Java Program (JP) -runs> ssh user1@localhost '/home/user1/someprogram'. is that right? I presume locahost is a database server.correct
    this is the stored procedure
    CREATE OR REPLACE PROCEDURE host_command (p_command  IN  VARCHAR2)
      AS LANGUAGE JAVA
      NAME 'Host.executeCommand (java.lang.String)';and this is the java
    create or replace and compile java source named host as
    import java.io.*;
    public class Host {
      public static void executeCommand(String command) {
        try {
          String[] finalCommand;
          if (isWindows()) {
            finalCommand = new String[4];
            // Use the appropriate path for your windows version.
            finalCommand[0] = "C:\\windows\\system32\\cmd.exe";  // Windows XP/2003
            //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe";  // Windows NT/2000
            finalCommand[1] = "/y";
            finalCommand[2] = "/c";
            finalCommand[3] = command;
          else {
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
          new Thread(new Runnable(){
            public void run() {
              BufferedReader br_in = null;
              try {
                br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
                String buff = null;
                while ((buff = br_in.readLine()) != null) {
                  System.out.println("Process out :" + buff);
                  try {Thread.sleep(100); } catch(Exception e) {}
                br_in.close();
              catch (IOException ioe) {
                System.out.println("Exception caught printing process output.");
                ioe.printStackTrace();
              finally {
                try {
                  br_in.close();
                } catch (Exception ex) {}
          }).start();
          new Thread(new Runnable(){
            public void run() {
              BufferedReader br_err = null;
              try {
                br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
                String buff = null;
                while ((buff = br_err.readLine()) != null) {
                  System.out.println("Process err :" + buff);
                  try {Thread.sleep(100); } catch(Exception e) {}
                br_err.close();
              catch (IOException ioe) {
                System.out.println("Exception caught printing process error.");
                ioe.printStackTrace();
              finally {
                try {
                  br_err.close();
                } catch (Exception ex) {}
          }).start();
        catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
      public static boolean isWindows() {
        if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
          return true;
        else
          return false;
    Where does Java Progarm reside? On the database server filesystem OR within the Database itslef. within the Database itslef.
    Edited by: HGDBA on Mar 11, 2011 1:50 PM

  • About running host command

    Hi,
    Suppose that I need to run 'zip' in the mean time when running Java, what should I use for calling such host command from O/S?
    Thks & Bst Rgds,
    Huamin

    Runtime.exec()

  • Run Host Command on UNIX

    Hi,
    We use JAVA source in Oracle to execute some unix commands directly from within stored procedures in Oracle.
    Our Java source looks like this :
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "HOST" AS
    import java.lang.*;
    import java.io.*;
    public class Host
    public static void executeCommand (String command, String etype) throws IOException
    String[] wFullCommand = {"C:\\winnt\\system32\\cmd.exe", "/y", "/c", command};
    String[] uFullCommand = {"/bin/sh", "-c", command};
    if (etype.toUpperCase().equals("W"))
    Runtime.getRuntime().exec(wFullCommand);
    else if(etype.toUpperCase().equals("U+"))
    Runtime.getRuntime().exec(uFullCommand);
    else if(etype.toUpperCase().equals("U"))
    Runtime.getRuntime().exec(command);
    CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2, p_etype IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String, java.lang.String)';
    We call one unix shell script and discover that some UNIX commands from this shell script are executed and others not. A cp & touch command don't give problems whilst cat & unix2dos commands don't function.
    Can anybody help me on this subject?
    Thanks !
    Kris

    Hi Avi, thanks for your reaction. Got it to work with the unix scripts, the problem was a syntax error in the script itself.
    However I don't get it to function when I try to run a unix command directly. Normally the parameter U+ should decide to start it in a shell for scripts and otherwise it should run the command directly. (whithout the /bin/sh in front of it).
    I already adapted my source to try to execute the command in a new shell but without success :
    String[] uFullCommand = {"/bin/sh", "-c", "\'cp /export/home/caluwaek/test/bestand2 /export/home/caluwaek/test/bestand8\'"};
    I tried to put the whole command in one string, in 3 strings, to just call the cp command without bothering the shell. Nothing seems to work.
    In unix both the following work :
    cp /export/home/caluwaek/test/bestand2 /export/home/caluwaek/test/bestand8
    and
    /bin/sh -c 'cp /export/home/caluwaek/test/bestand2 /export/home/caluwaek/test/bestand8'
    Thanks for your help!
    Kris

Maybe you are looking for

  • How to restart a java process in Oracle AS 10g

    Hi In Oracle AS 10g, the java process consumes 50% cpu resource due to the report invoked by a user. Now I need to restart the java back ground process?, please reply me with the syntax or with examples. ps -eaf CPU PROCESS 50% /ORACLE_HOME/jdk/jre/b

  • What is the easiest way to edit song info in iTunes?

    I had Windows Media Player as my default for ever on my computer. iTunes doesn't let you right-click to edit songs like WMP and I'm trying to get all my stuff off "Unknown album/title" etc. since for some reason when I imported everything it couldn't

  • Sony Bravia 2006 will not recognize AppleTV

    I cannot seem to successfully connect my Apple TV to my Sony Bravia KDL40S2000. I've followed all the suggestions I can find online: I have connected the AppleTV to the Sony Bravia with multiple HDMI cables. The HDMI port is active, and works with ot

  • Scratch Disk Location ticked on F: Drive but still on C: Drive? (PLEASE HELP!!!)

    When I first got Photoshop CS6 it loaded up very, very quickly. Then some time later it started loading up very slowly. I looked and whenever I started up photoshop it was taking GIGABYTES off of my C: Drive, not loading until it took up "x" amount o

  • Trouble with Editing Photos! PLEASE HELP!!

    I enhanced a few pictures and after I was finished editing all of my pictures I tried to pull up the ones I had enhanced. It just had a triangle with an "!" in the middle. Only if I pressed edit would it let me see the picture and if I looked at all