I want to execute UNIX COMMAND in ABAP

Hi All,
I want to execute a UNIX XOMMAND sh <scriptname> <filename> to replace divsion codes.in ABAP.
But, I came to know that we can't (2) or try the following program but unfortunately the command CALL SYSTEM is not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
REPORT ZUNIXCOM .
DATA: U_COMMAND(200).
Table for system messages
DATA: BEGIN OF RT OCCURS 100 ,
LINE(100) ,
END OF RT .
START-OF-SELECTION .
MOVE 'unix command' to U_COMMAND .
REFRESH RT.
CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
ID 'TAB' FIELD RT-SYS .
LOOP AT RT.
WRITE : / RT-LINE .
ENDLOOP. 
So please can u help me how to call a unix command from ABAP. it is very urgent. I want complete details and all possible solutions
<removed_by_moderator>
Thanks,
gyanaraj
Edited by: Julius Bussche on Aug 26, 2008 11:29 AM

Selvaraj Gyanaraj wrote:>
> So please can u help me how to call a unix command from ABAP.
I was about to help you.
>it is very urgent.
I changed my mind.
>I want complete details and all possible solutions
I'm glad I changed my mind.
>Points are surely rewarded.
Too late.

Similar Messages

  • Execute unix command in abap code

    Hi, I have a request to execute a script command in a remote unix server, should i use 'call function ...destination'?
    Thanks.
    Legend.

    Use like this :
    data: begin of t_tabl occurs 0,
    line(132),
    end of t_tabl,
    data: lc_command(100) type c.
    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.
    Do not look for sy-subrc ,here sy-subrc will not work.
    Thanks
    Seshu

  • Unix commands in ABAP

    Hi,
       I need to call the following unix command in ABAP to encrypt a file on the app server .
    crypt password <org filename> new_filename
    1 But when i run it using call 'SYSTEM' .. i get message security risk , command not executed ..
    2 I also created the command in SM69 and tries to run it but same error.
    3 I also created a shell script , but i get another message when i try to run sh ...
      Please help to find out a way to make it work ..
    Kunal

    Hi kunal,
    1. probably ur basis team might be able to help u.
    2. even if we have authorisations thru sap
       to run external os command,
       the actual OS user on application server
       must have the right for it
       and access/write/read/modify
       for the files (provided thru the command)
       in question.
    3. Due to this , the systems gives the message
       of SECURITY RISK.
    regards,
    amit m.

  • How to execute unix command line from cocoa?

    how to execute unix command line from cocoa?
    for example, if I want to call "ping" from cocoa, how should I do it? and how can I obtain the return value?
    thank you.
    Power G5 Quad Mac OS X (10.4.3)

    The following article may also help:
    http://cocoadevcentral.com/articles/000025.php
    Mihalis.
    Dual G5 @ 2GHz   Mac OS X (10.4.6)  

  • UNIX command in ABAP code

    Hi All,
    I need to use unix command (MOVE) in ABAP code for transfering a file from one directory to another directory.
    Can any one help with how to used unix commands in ABAP?
    Thanks in advance.
    Regards,
    Hemendra

    The recommended approach always used to be to use transaction SM69 to define a "soft" command name to the operating system command so that it could be configured to work across Windows, Unix etc.  For example:
    Command name       OS         Type             OS command                                 Parameters for operating system command 
    Z_FILE_MOVE        SunOS      Customer    mv                                                 ? ?   
    You can then call function module SXPG_COMMAND_EXECUTE (quite well documented) to actually perform the command passing in the appropriate number of parameters.
    Jonathan

  • How to execute unix command through odi and store the result in table

    I have to reconcile  if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not,  Please assist me how to make package/interface/procedure to  execute unix command and store result in oracle table.
    Thanks in Advance

    Use ODI OS command tool in the ODI package.
    create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target

  • Executing Unix Commands

    Hi
    I realise there is a Runtime class to help execute Unix commands from within Java code, but how would this work if the command required a password.
    For example, were I to try to execute:
    ssh -Y myserver.domain.com -u Myself -p
    How would this work with supplying the password (which is prompted for after the command is sent to the shell)?
    Thanks
    Dave

    from the ssh man page under "environment variables":     SSH_ASKPASS
                  If ssh needs a passphrase, it will read the passphrase from the
                  current terminal if it was run from a terminal.  If ssh does not
                  have a terminal associated with it but DISPLAY and SSH_ASKPASS
                  are set, it will execute the program specified by SSH_ASKPASS
                  and open an X11 window to read the passphrase.  This is particu-
                  larly useful when calling ssh from a .xsession or related
                  script.  (Note that on some machines it may be necessary to
                  redirect the input from /dev/null to make this work.)

  • JSP executing UNIX command

    Hi,
    I'm new to JSP. I'm just curious whether is there a utility in Java that we can use to execute unix command?
    thanks.

    Hi,
    You can try this,
    import java.io.*;
    public class test
    public static void main(String args[]) {
    try {
    Process ps = Runtime.getRuntime().exec("ls -al");
    BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(ps.getOutputStream()));
    bw.write("1");
    bw.flush();
    String line;
    while ((line = br.readLine()) != null) {
    System.out.println(line);
    br.close();
    bw.close();
    System.out.println(ps.exitValue());
    catch(Exception e) {
    System.out.println(e);
    Hope that helps.
    Regards,
    Senthil Babu
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • How to execute unix command from the Java program running on Windows

    Hello,
    I need to
    1. Execute a unix shell script from a Java program running on the Windows.
    2. I also need to capture the output of this shell script in my program.
    Please suggest me how to achieve this.
    Thanks in Advance.

    Hi...
    Something is missing here
    If you want to execute a shell script in windows that not posible unless you find or develop a unix shell script parser for windows.
    But if you are trying the execute a unix shell script on a remote unix computer from your java program running on a windows platform you can do that by logging on to the UNIX terminal which is running on port 23 I think.
    You can test this using telnet tool on windows
    just type on command prompt
    telnet <ip of the unix pc> <port number this case 23>
    you should get the unix terminal. If that works you can do the same through java or you can directly conect to port 23 of that pc using sockets that way your program will be platform independant

  • Execute Unix command on login

    Hello, is it possible to execute a unix command on user login?
    I want that every time a user login on a mac at my company, a unix command be executed.
    Is this case, this is the command: defaults write com.apple.mail NSPreferredMailCharset "UTF-8"
    thks in advance

    {quote}Loginwindow Scripts
    Another way to run applications at login time is to launch them using a custom shell script. Mac OS X provides two options for launching scripts when the user logs in. When creating your script file, keep the following in mind:
    * The permissions for your script file should include execute privileges for the appropriate users.
    * Scripts launched by loginwindow are run as root. Therefore, you should thoroughly test your scripts before deploying them to make sure they do not adversely affect the user's system.
    *In your script, the variable $1 returns the short name of the user who is logging in.
    * Other login actions wait until your hook finishes executing. Therefore, have your script do what it needs to do quickly and then exit. {quote}
    I want the script to be run as the current user that does the login, and not as the root. I think that if its run as root, it changes nothing in the user. Does this root issue apllies to the Zerwas method?
    It depends on how Zerwas was thinking you'd implement it. If you added it to each user's login items, it should run as the user. If you create a startup item to run it, it will run as root. I'm assuming Zerwas was suggesting the former because there would be no point in wrapping the shell script in an AppleScript if you are going to turn it into a startup item.
    What you might be able to do - at least with the loginwindow script - would be to explicitly run the command as the user by making use of the fact that the user name is passed to the loginwindow script as $1. I've never used loginwindow scripts but it seems as though it should work.
    Another possibility would be to use a LaunchAgent. These are really intended to manage background processes, though, and it seems an unnecessary use of resources to load one which will only ever be run at startup.
    Can I ask why you wish to run the script every time a user logs in? Is the concern that the default will get set to something else and needs to be reset regularly?
    - cfr

  • How to execute unix command from ODI Procedure

    Hi,
    I am trying to execute below unix command from ODI Procedure (Command on Target tab) but I am getting the error "java.io.IOException: Cannot run program "cd": error=2, No such file or directory" but when I try to execute the same command using OdiOSCommand, it is executing successfully. I don't want to use shell script to execute this command. Is there any specific syntax am I missing to execute this command from ODI procedure?
    cd /project3/tmt/;ls *.dmp > dmplist.lst
    Please help me on this...
    Thanks
    MT

    Hi nahlikh,
    Thank you for the reply.
    I used below command in Procedure but still getting the same error as "java.io.IOException: Cannot run program "OdiOSCommand": error=2, No such file or directory".
    OdiOSCommand "-COMMAND=cd /project3/tmt/;ls *.dmp > dmplist.lst"
    as I mentioned earlier if I use the command cd /project3/tmt/;ls *.dmp > dmplist.lst in OdiOSCommand tool it is executing successfully without any issues.
    any thoughts appreciated to get a solution for this issue.
    Thanks
    MT

  • Execute unix commands from Java

    Hi,
    I have a client application running on windows. This client should connect to a unix server and check for the existence of a file and display the result as "File found/File not found". In order to connect from windows to the unix server, I used the sockets and the connection is successfully established. The second part is to check for the presence of the file in unix server. I searched in google.com and the option I found to execute a unix command from java is the "Runtime.exec()". Runtime.exec is considered as the less effective (not a favorable) one.
    Is there any other option available (other than the Runtime) to execute the unix command from java? Can you please let me know.
    Thanks a lot
    Aishu

    So, please let me know how I can execute the above unix commands without Runtime.exec()You have a client and a server.
    You want something to run on the server, not the client.
    That means that something must in fact being running on the server before the client does anything at all.
    For example telnet. Or a J2EE server application.
    So is something like that running?
    If not then there absolutely no way to do what you want, even with Runtime.exec().
    If yes then what you do depends on what is running. So Runtime.exec() would be pointless if a J2EE server was running.

  • How  to execute os command from ABAP program?

    I want to execute some window commands from ABAP. What is the way to do it?

    Hi,
    See ht e coding below, I have used these Fm to connect to FTP server and get the Files..
    *types for the ftp command result internal table
    TYPES : BEGIN OF ty_result,
            text TYPE char512,
            END OF ty_result.
    data it_result type standard table of ty_result.
    *Connect to the FTP server
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = lv_user           " user name pass word to connect
          password        = l_v_pwd
          host            = 'dev.eu.pm.com' " Host name here
          rfc_destination = 'SAPFTPA'   "destination name
    *Ask your functional people for the above data
        IMPORTING
          handle          = v_handle
        EXCEPTIONS
          not_connected   = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *Changing directory
      CONCATENATE 'cd' '<file path>' INTO l_v_cmd SEPARATED BY space.
    you can also ser 'DIR in l_v_cmd which opens the directory and all the folders *get into it_result table..
    *Execute the FTP Command
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = v_handle
          command       = l_v_cmd
        TABLES
          data          = it_result
        EXCEPTIONS
          tcpip_error   = 1
          command_error = 2
          data_error    = 3
          OTHERS        = 4.
      IF sy-subrc <> 0.
      ENDIF.
    rewards if useful,
    regards,
    nazeer

  • How does one execute unix commands from within an applet?

    Greetings Folks,
    I've written a simple java applet that runs a unix command and then displays some information. The applet compiles fine, and runs perfectly from the command line on my unix system.
    However, when I point a browser at the applet from my desktop PC I get the following error as taken from the java console:
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
    This is of course the first line in a long line of error messages. It appears that I am not able to execute a command on the unix system through my applet. I know the problem is with trying to execute a unix command since commenting it causes no error in the web browser. This is the command I'm using in java to execute the unix command:
    p = Runtime.getRuntime().exec("ps");
    Here's the html file on the unix system:
    <html>
    <head></head>
    <body>
    <appletcode=G.class height="250" width="400">
    Your browser does not support the applet tag.
    </applet>
    </body>
    </html>
    I won't list the java code since it is compiling and working on the command line. But, if you want to see it I'll provide it.
    I've done quite a bit of research on this and it seems that a great number of people have similar problems reading or executing files through java. I have yet to find a solution to this problem.
    Here are some details about my setup:
    Server:
    HP9000 running HP/UX 11.23
    Apache Web Server 2.0.35
    Java 1.5
    Desktop PC:
    Win2K Pro
    Internet Explorer 6
    Java 1.6
    If you have a solution I would be very grateful! This problem is keeping me from writing my application!
    thanks!
    kev

    Multi-posted.
    Already answered here http://forum.java.sun.com/thread.jspa?threadID=5225314&messageID=9916327#9916327
    Please don't multipost again!

  • Re: Executing UNIX commands from PC Client

    Hello,
    You can run FTP on the client and connect to your unix server to
    transfer the files across.
    As far as running UNIX commands goes you can transfer the command
    set to a service object deployed on the server and run them from there.
    Hope this helps.
    Greetings,
    I have a file which needs to be FTP'd to a remote sever. The file is
    created on the PC Client tier of the application. In addition, I have a
    few unix scripts which I would like the client to execute. Is there a way
    to execute unix (or server) based commands from a Forte Service Object.
    Any help would be greatly appreciated. Thanks.
    Craig Balliet
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    >
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi,
    If the problem is only to copy a file from one system to an other, you
    should use only Forte. Here is an abstract from the on line help :
    Copying a Set of Files Between Partitions
    To copy a set of files using the FileSystem class:
    1 In the local partition, instantiate a FileSystem object using the
    "new" operator.
    In this example, we use the name "localFileSystem" for this FileSystem
    object.
    2 Invoke a method that will execute on the remote partition, either on a
    service object or any distributed reference to an object in the remote
    partition.
    3 In this method, instantiate a FileSystem object and return it to the
    local partition.
    For this example, we will use the name "remoteFileSystem" to refer to
    this FileSystem object. Note that you do not need to set the IsAnchored
    attribute on FileSystem objects that are to be returned as distributed
    references. These objects are automatically created as anchored objects,
    so references to them in other partitions are always returned as
    distributed references.
    4 In the local partition, invoke the SetRemoteFS method on the
    localFileSystem object, using the distributed reference to
    remoteFileSystem as the remoteFS parameter.
    5 Invoke the SetRemoteFS method on the remoteFileSystem distributed
    reference, passing the localFileSystem object as the remoteFS parameter.
    6 Invoke the SetLocalDir and SetRemoteDir methods to set the working
    directory on the local and remote systems, respectively.
    7 Construct one or more file names in portable operating system format
    (see Naming Files in FileSystem Methods ) that represent the file, or
    files, that are to be copied between systems.
    8 Put the files names you constructed into TextData objects and insert
    them into an array of TextData objects.
    9 Invoke the PushFiles method on localFileSystem, using the array of
    TextData objects containing the file names, to move files from the local
    system to the remote system. If you want to move files from the remote
    system to the local system, invoke the PullFiles method instead..
    Further Information:
    Using FileSystem
    Naming Files in FileSystem Methods
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Steven Arijs wrote:
    >
    To accomplish the FTP to the remote server , you can implement this by using
    the FileSystem Class. You will find all information you need in the Forte
    help.
    To run operating system commands (f.i. unix command and scripts) from within a
    forte application , you can use the RunCommand method on
    task.part.OperatingSystem. (See the forte help).
    You can let your client call a method on a service object that resides on the
    server and then this method will run the script using the above method.
    Hope this helps,
    Steven Arijs
    Craig_D_Balliet%[email protected] wrote:
    Greetings,
    I have a file which needs to be FTP'd to a remote sever. The file is
    created on the PC Client tier of the application. In addition, I have a
    few unix scripts which I would like the client to execute. Is there a way
    to execute unix (or server) based commands from a Forte Service Object.
    Any help would be greatly appreciated. Thanks.
    Craig Balliet
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

Maybe you are looking for

  • Publish just one site at a time?

    I have two sites I'm working on, but when I go to publish just the one it republishes both? Can I just publish one at a time? If not, can I delete one site from the list but have it saved else where on the computer and not have it DELETED completly?

  • Flash XML file help

    I am trying to add multiple flash files to my website...the only way these seem to work is if the swf and corresponding xml file are all on the root of the website directory. I would have liked to organize them into files to sort. My problem is that

  • Adobe interactive active form not rendering

    Hi All, I am trying to create a Adobe Interactive form application. I have created the form and have integrated into a ABAP WebDynpro as well . How ever when i try to test the application it crashes without rendering with the following message. Error

  • I can´t open files with number after update, last week.

    Last week I upgraded Mavericks, Pages, Keynote and Numbers .. that's OK, then I could not open these programs. When I try, a window appears: "To open this spreadsheet must use a later version of Numbers.  You can download the latest version of Number

  • Macbook Pro Charger Not Working in USA

    Hi guys, I have a 2009 Macbook Pro 2.6Ghz (15") with a 85W MegaSafe Power Adaptor (UK). I'm using a plug convertor and it doesn't charge within the USA. Am I assuming that my particular version doesn't deal with 100v and I need to buy a USA version?