How to execute some code in command line, and read its output?

I'v found here http://www.sap-advisor.com/abap-coding/how-to-execute-operating-system-commands-from-within-sap/ that I can execute commands from the windows command line for example inside SAP.
But I want to take it one step further and read its output. is it possible?

Hi RagnaRock,
one possible approach can be outputting the results of the command into a text file (i.e. "command >result.txt"), and then read this file from SAP/ABAP.
I hope this helps. Kind regards,
Alvaro

Similar Messages

  • How do I execute some code when a line of a table control is selected?

    Hi,
    I would like to execute some code when a line of a table control is selected.  At the moment I have to select one or multiple rows and then press enter, this forces a screen refresh and my code is executed but I would like the code to be executed as soon as any line is selected.
    I've done something like this using ALV grids and object orientated code but is there a way of doing this in a normal non-OO table control?
    Thanks in advance.
    Gill

    Hi,
    U need to declare a char1 field for marking (mark field).  This will reflect with value 'X' in your tcontrol internal table for all the selected rows. 
    Now u need to handle the okcode for enter in your PAI.
    There u need to loop through the table for all marked fields.
    There after u can do what ever u want.
    Venkat.

  • How to execute IDC services from command line

    Hey Guys,
    is there some way we can execute IDC Services from command prompt.
    your any pointers will be highly appriciated.
    regards,
    sapan
    Edited by: sapan on Mar 9, 2009 7:26 AM

    Hey sapan,
    You can use IdcCommand to execute services from the command line. The process is as follows:
    1. Create a text file with the services calls you want to make, the definitions are in hda format:
    @Properties LocalData
    IdcService=UPDATE_DOCINFO
    dID=1
    dDocName=000001
    dDocType=MyType
    dSecurityGroup=Public
    dRevLabel=1
    dDocAuthor=sysadmin
    dDocTitle=My Title
    @end
    <<EOD>>
    (Note: for multiple entries in the file <<EOD>> is very important)
    2. Execute IdcCommand from the <content server install>/bin directory:
    IdcCommand -f image_update.hda -u sysadmin -l c:\idccommand.log
    Options:
    -f = file with service definitions
    -u = user to run as
    -l (lowercase L) = location for log of execution
    More detailed documentation can be found in the Idc Command Reference (idc_command_reference_10en.pdf).
    Hope that helps,
    Andy Weaver - Software Consultant
    Fishbowl Solutions < http://www.fishbowlsolutions.com?WT.mc_id=L_Oracle_Consulting_amw >

  • How to execute ODI scenarios from command line in Unix

    Hi Friends,
    I am using ODI 11g.
    I want to execute ODI senarios using the command line argument in Unix.
    Please let me know how to proceed with this.
    Thanks,
    Lony

    Hi,
    unser the /your_ODI_HOME/agent/bin folder.
    Excute this
    sh startscen.sh REFRESH_ID 001 GLOBAL 5 -NAME=agent_ODI
    REFRESH_ID=Your Scenario name
    001:Version
    GLOBAL:Context name
    5=Log Level
    agent_ODI=Your agent name
    Regards

  • Why not all jars picked up by ojdeloy and how to generate build.xml from command line and not JDEV GUI - quick question

    Hi All
    We have 11.1.1.7 ojdeploy to compile our app.
    We notice in the log that not all jars are used in classpath arguments when we explicitly set them up for compilation.
    eg:
      <path id="classpath">
        <pathelement location="../../Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/commons-el.jar"/>
        <pathelement location="../../Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/jsp-el-api.jar"/>
        <pathelement location="../../Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/oracle-el.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/a.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/b.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/c.jar"/>
        <pathelement location="interface/public_html/WEB-INF/lib/d.jar"/>
    </path>
    Log Output -
    [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/bin/javac
    [ora:ojdeploy] -g
      [ora:ojdeploy] -Xlint:all
      [ora:ojdeploy] -Xlint:-cast
    [ora:ojdeploy] -Xlint:-empty
      [ora:ojdeploy] -Xlint:-fallthrough
      [ora:ojdeploy] -Xlint:-path
      [ora:ojdeploy] -Xlint:-serial
      [ora:ojdeploy] -Xlint:-unchecked
      [ora:ojdeploy] -source 1.6
      [ora:ojdeploy] -target 1.6
      [ora:ojdeploy] -verbose
      [ora:ojdeploy] -encoding Cp1252
      [ora:ojdeploy] -classpath
    [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/jre/lib/resources.jar:
    [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/jre/lib/rt.jar:
      [ora:ojdeploy] /path/to/Oracle/Middleware/jdk160_24/jre/lib/jsse.jar:
        [ora:ojdeploy] /path/to/interface/public_html/WEB-INF/lib/a.jar"/>
        [ora:ojdeploy] /path/to/interface/public_html/WEB-INF/lib/c.jar"/>
    1- Is it because it depends on how jpr or jws are configured ?
    2- How can we automatically generate a build file of the application from command-line (as opposed to using Jdev IDE to click to generate a build.xml) ?

    The first  warning is happening because you're stating drivers for input devices without need. You haven't disabled hotplug so evdev gets used instead of kbd. This is normal, and you should change the driver line from kbd to evdev so that whatever options (if any) you've specified for the keyboard get parsed.
    The second warning is about you not installing acpid.
    The third I have no idea about, but look at the synaptics wiki. None of the (WW) are related to your video card.
    And every card that has 2 or more output ports show up as "two cards". You also don't need to specify the pci port in xorg.conf. edit: this is the general case with laptops, might be different for desktops.
    When I do lspci -v I get:
    00:02.0 VGA compatible controller: Intel Corporation Mobile 945GME Express Integrated Graphics Controller (rev 03) (prog-if 00 [VGA controller])
    Subsystem: Micro-Star International Co., Ltd. Device 0110
    Flags: bus master, fast devsel, latency 0, IRQ 16
    Memory at dfe80000 (32-bit, non-prefetchable) [size=512K]
    I/O ports at d0f0 [size=8]
    Memory at c0000000 (32-bit, prefetchable) [size=256M]
    Memory at dff00000 (32-bit, non-prefetchable) [size=256K]
    Expansion ROM at <unassigned> [disabled]
    Capabilities: <access denied>
    00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
    Subsystem: Micro-Star International Co., Ltd. Device 0110
    Flags: bus master, fast devsel, latency 0
    Memory at dfe00000 (32-bit, non-prefetchable) [size=512K]
    Capabilities: <access denied>
    And it doesn't matter if it errs in trying to sli up with it self. That's just not a possibility.
    Last edited by gog (2009-10-15 23:59:49)

  • Executing jar file on command line [windows]

    Hi,
    I am trying to run .jar file "senthil.jar" . It catures systems screenshot.
    http://sensaran.wordpress.com/2010/06/04/screen-shot-utility-using-air-2-0/
    I am using it in AIR application. I want to execute this file from  command line. I am not sure how to pass command line arguments.
    Currently i am trying to do it like :  java -jar senthil.jar
    I need to provide a parameter as "Print Screen"
    Its corresponding Flex Code is :
                var arg:Vector.<String> = new Vector.<String>;
                arg.push("-jar");
                arg.push(File.applicationDirectory.resolvePath("senthil.jar").nativePath);
                 var file:File = new File();
                file = file.resolvePath(javaPath.replace(/\//g, File.separator));
                var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
                npInfo.executable = file;
                npInfo.arguments = arg;
                nativeProcess = new NativeProcess();
                nativeProcess.start(npInfo);
                nativeProcess.standardInput.writeMultiByte("Print Screen" + "\n", "utf-8");
    Thanks

    Did you give the -jar option with javaw? And the "%1"? See the file associations of some other extensions for example of how to do this
    For example on my machine,
    W:\>assoc .mp3
    .mp3=Winamp.File
    W:\>ftype Winamp.File
    Winamp.File="C:\Program Files\Winamp\Winamp.exe" "%1"Now I can
    start song.mp3Or doubleclick on mp3 file in explorer to open it in winamp.

  • JDev 10.1.3 how to invoke oc4j_remote_deploy.jar from command line?

    Hi, does anyone know how to invoke the JDev 10.1.3 oc4j_remote_deploy.jar from the command line? We have it working for 10.1.2, for automated deployment scripts.
    If I try the same thing for 10.1.3, I get an error.
    See below my command line and the output.
    I think the error is in the Oc4jDcmServlet URL, the format seems to have changed from 10.1.2 to 10.1.3.
    I tried to reverse-engineer by using an HTTP tracer, but that did not help.
    Any help would be much appreciated.
    Regards, Maarten Brugman
    ======================== command line: ==================
    "C:\j2sdk1.4.2_09\bin\java.exe" -Djava.protocol.handler.pkgs=HTTPClient -jar C:\jdev-work\ebrp-new\ear\target\installer\oc4j_remote_deploy.jar http://lnvx0027:29805/Oc4jDcmServletAPI/ oc4jadmin ***** listApplications /oracle/oaedv03/oracle/oas/10.1.3/ontwj2e1013 UNDEFINED UNDEFINED OC4J_OEBRP
    ============ output: ====================================
    Initializing log
    Servlet interface for OC4J DCM commands
    Command timeout defined at 600 seconds
    Executing DCM command...
    Executing command listApplications /oracle/oaedv03/oracle/oas/10.1.3/ontwj2e1013
    UNDEFINED UNDEFINED OC4J_OEBRP
    Command = LISTAPPLICATIONS
    Opening connection to Oc4jDcmServlet
    Setting userName to oc4jadmin
    Sending command to DCM servlet
    **** Could not check HTTP response code
    ** Thread[main,5,main] ** Fri May 11 17:18:13 CEST 2007 ** ** EXCEPTION: java.
    net.SocketException: Unexpected end of file from server
    java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:822)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:711)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:820)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:711)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:635)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmClient.isHttpResponseOk(Unknow
    n Source)
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmClient.sendCommand(Unknown Sou
    rce)
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmCommand.execute(Unknown Source
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmCommand.listApplications(Unkno
    wn Source)
    at oracle.j2ee.tools.remote_deploy.Oc4jDcmMain.main(Oc4jDcmMain.java:71)
    #### HTTP response is NOT ok
    Closing connection to Oc4jDcmServlet
    #### DCM command did not complete successfully (-1)
    #### HTTP return code was -1
    ============ end output =================================

    In my opinion, you will succeed in handling linefeeds in output texts by using an <tt><af:outputFormatted></tt> tag in conjuction with a JSF converter that replaces the linefeeds with a <tt>&lt;br></tt> tag in the text. You will have to implement a custom converter class (this is quite simple, see below) and to set it to the <tt>converter</tt> attribute of the <tt><af:outputFormatted></tt>. The converter class should look like:
    public class MyLinefeedConverter implements javax.faces.convert.Converter
      public MyLinefeedConverter() {
      public Object getAsObject(FacesContext context, UIComponent component, String value) {
        return value;
      public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (value==null) return "";
        if (value instanceof String) return ((String)value).replace("\n", "<br>");
        return value.toString();
    }In this way the linefeeds in your text values will be replaced by <tt>&lt;br></tt>, which will be rendered by the corresponding <af:outputFormatted> tag as line breaks.

  • How to execute a "real" VBS command in DIAdem script?

    Hello,
    I've some troubles to execute specific "real" VBS command lines in DIAdem script: 
    e.g.: 
    Workbooks.OpenText filname, DataType:=xlDelimited, tab:=True, DecimalSeparator:=",", ThousandsSeparator:="."  
    Using other writings as
    Workbooks.OpenText(filname, DataType:=xlDelimited, tab:=True, DecimalSeparator:=",", ThousandsSeparator:=".")Workbooks.OpenText filname, "DataType:=xlDelimited", "tab:=True", "DecimalSeparator:=','", "ThousandsSeparator:='.'"  
    don't help, I always get error messages. It seams, that DIAdem has problems with recognition of  := .
    How can I include such kind of VBS command line in a DIAdem script without getting problems?
    Sven

    Hi,
    thanks for answer, but unfortunately its not over yet.
    I tryed the following possibilities:
    Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,xlDelimited,,,True,,,,,,,,".",",",,True)Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,xlDelimited,,,1,,,,,,,,".",",",,1) Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,"xlDelimited",,,True,,,,,,,,".",",",,True)  Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,"xlDelimited",,,1,,,,,,,,".",",",,1)  Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,1,,,True,,,,,,,,".",",",,True)Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,1,,,1,,,,,,,,".",",",,1)but always I get some error messages. I assume, that there is just a format error in the command line, may you help me out with some hints, how to do it right?
    Regards
    Sven

  • Dynpro application: how to perform some  code when user click window close

    Hello,
    I'm developing dynpro application. This application needs to perform some code when exiting.
    I can do that with MODULE xxxxx AT EXIT-COMMAND. But this code can't be performed when user of application click on button closing window (classic R/3 window, not pop-up).
    Does anybody know how to bind some code to clicking on button closing window?
    Best regards,
    Josef Motl

    As far as the prompt that you get when you close the last window is coming from the counter that SAP maintains regarding the number of open sessions(windows). When this counter reaches 1, I guess they have a check to issue a prompt. There was a discussion in this forum a long time back regarding how we can know that session id like SM04. There was no conclusion reached then. Theoritically, let us know you know this id for the session in which the user opened a particular page, then you can see if that session is deleted and then take the necessary action. There are some TH_* function modules that seem to be promising, but I was not able to conclusively achieve the control over a particular session.
    See if you can look at SM04 and get an idea. Please do let us know if you find the solution.
    Srinivas

  • Executing Preview from a command line

    Colleagues,
    I have multi-page PDF documents (created with R [R-project.org]) from which I convert a single page to TIFF. Is there some means to execute this from a command line? Presumably, I would need arguments for (at least) input file name, output format, and pages.
    Any help would be appreciated.
    Dennis

    I've used it extract pict bitmaps from pdf screen shots in 10.3.9:
    <pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 60ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">sips -s format pict picture.pdf -o picture.pct</pre>
    But in my case I think the pict is embedded in the pdf.
    Cole

  • How can i install snow leopard on my mac G5 using a command line and booting from an external usb rom, since my disk i have is not a bootable media

    How can i install snow leopard on my mac G5 using a command line and booting from an external usb rom, since my disk i have is not a bootable media

    Hi.
    You simply can't. Snow Leopard is compiled in Intel binary only.
    Good Luck.

  • How to change fcalias www via command line & particular port performance status

    how to change fcalias www via command line & particular port performance status

    how to change fcalias www via command line & particular port performance status

  • Execute script from AfterFX command line

    Hello all
    I'm trying to run a script from the AfterFX.exe command line and I get a message: "Unable to execute script at line 1. Syntax error"
    If I run the same script file from the AE Script Editor, it works perfectly
    Here is the command line I'm using:
    "C:\Program Files\Adobe\Adobe After Effects CS6\Support Files\AfterFX.exe" -noui -s "D:\Product\Watermark\Rendering\WatermarkedSecuritySample.jsx"
    Anyone have an idea of what can cause this error? I've tried running the script directly in the command line like
    "C:\Program Files\Adobe\Adobe After Effects CS6\Support Files\AfterFX.exe" -noui -s "alert('1')"
    and it works fine for short script but mine is way to big to do that
    As you can probably guess with the "Watermark" and "Security" in the filename, I cannot post the script file here, all I can say is that the line 1 is:
    var projectName = "D:\\Product\\WatermarkTemplate.aep";
    I've tried to replace the entire script with "alert('1');" and it cause the same error when running it from the command line
    Also, if anyone know where I can find the AfterFX.exe command line arguments description, I would be very happy.. everybody talks about aerender.exe but I need thoses options for AfterFX.exe
    Thanks for your help

    Have you tried to use "-r" instead of "-s"?
    (argument for "-s" is a script; and argument for "-r" is a path to script)

  • UCCE - How to manage Agent & skillgroup in command line

    Hi,
    First thanks for your time to read this.
    I'm looking for a way to manage in custom application the associations between agents and skillgroups. From what I've looked there isn't any API.
    I was wondering if there is a command line bulk tool for this purpose.
    Could anybody give me some lights up on this?
    Thanks in advance.
    RB

    There used to be bulk load config tools, but they didn't do proper error checking as the GUI tools do.
    I don't think there were ever bulk "change" (i.e. skill group member), or delete command-line tools.

  • How to configure Team explorer 2010 command-line tool in Mac x os. configure shell or system path to include the folder to which (TF client) unzipped archive available.

    How to configure Team explorer 2010 command-line tool in Mac x os.
    Hot to configure shell or system path to include the folder to which (TF client) unzipped archive available. I am new to Mac X OS. Please help.

    Dmitry,
    Thanks for the great writeup!
    I think I've got my universal instant client libraries built correctly.
    I too am using MacBook Pro but I'm getting stuck at building the 32 bit oci8.so
    First problem is my pecl download (ver 1.4.1) did not contain a "configure" file so ./configure failed.
    I used configure from /sw/....... to try to continue.
    Second problem. Using existing configure from /sw/.... I used an appropriate variation of your example command
    (./configure --with-oci8=instantclient,/usr/local/oracle/instantclient_10_2 && make).
    Things look like everything ran OK but The output does NOT include an oci8.so file
    So I guess my question is: Which "configure" should I be using? And if it is not the one on the system under /sw/...
    where would I get it since it doesn't come in the pecl download?

Maybe you are looking for