Getting output from an OS command from an ABAP program

Hi Folks!
I have a requirement, is it possible to call an operating system command, and also get its output back to the ABAP program that has called it?
For example, from an ABAP program calling the "dir" command from Windows and getting back (as a string) the directory listing to the ABAP program?
Thanx in advance!
Juan.

This is will help you
<< Moderator message - links removed >>
Please do not post a list of links. This simply encourages laziness. The OP could have found these with a little work.
Edited by: Rob Burbank on Dec 13, 2010 9:19 AM

Similar Messages

  • How to get a parameter from BPC and use it in ABAP program

    Hello gurus!
    I got a problem...
    SAP BPC will send parameters such as year, division, category, company code and so on via script logic to SAP BW.
    I need to get these parameters from BPC and use them in a ABAP program as a filter.
    This ABAP program will do several routines and return new values to BPC. It must be made on ABAP and I need to filter data to avoid performance issues.
    Does anybody knows how to do it? or have a example of it?
    Thank you in advance.
    Regards,
    Rubens Kumori

    Hello, I'm looking for a suggest.
    I need to pass two parameters (users can input them in a data manager package in bpc) to a BAdI.
    In this BAdI I write a code that store those parameters in a InfoObject.
    The problem is:
    - one parameter is for CATEGORY value. CATEGORY is a dimension of the application and I read the value with a code like this:
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = 'C_CATEGORY'.
    - other parameter is a generic DATE. this parameter is not a dimension of the application and I don't know how I can retrieve this value in BAdI.
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = '.....'.
    The data manager dynamic script is:
    PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%")
    PROMPT(TEXT,%SELECTED_DAY%,"Write the date (format YYYYMMDD)",)
    I also have a dynamic constant that assign the name %CATEGORY_DIM% to "C_CATEGORY" value.
    Can anyone help me?
    thanks a lot
    Edited by: Luca Novali on Feb 13, 2012 3:49 PM

  • Deleting data from an Infocube in BW using ABAP program?

    Hi Everybody,
                       I have to create a ABAP program in SE38 which, on execution will delete selected data from a Cube in BW module. How to achieve it. Is there any function module that can do so? Eagerly waiting for your suggestions.
    Regards,
    Pulokesh

    Dear Ravi,
                  Other than two parameters I_INFOCUBE, I_SHOW_REPORT do i need to pass any value to the table I_T_SELTAB.
    Regards,
    Pulokesh

  • Deleting selected data from an Infocube in BW using ABAP program?

    Hi Everybody,
                       I have to create a ABAP program in SE38 which, on execution will delete selected data from a Cube in BW module. How to achieve it. Is there any function module that can do so? Eagerly waiting for your suggestions.
    Regards,
    Pulokesh

    select the records from the cube or  ods and put in to one internal table.
    and then u can delete the records

  • How to add a new output type in sales order header via ABAP program

    Hi All,
    I have to add new output type (ex Z001) in sales order header via an ABAP program. please let me know how to do this.
    Thank you all in advance.

    Hi,
    You can use the FM ..RV_MESSAGE_UPDATE..
    Thanks
    Naren

  • How to get the output of a single command from multiple servers using power shell

    Hi All,
    I have a requirement in my project, wherein I have to find the database list on each server which has autoshrink option is enabled.
    Below is the query which I'm using and I want to automate it in such a way that, I can give the input to powershell script with list of all servers and I need output in csv format which should be giving the database names for which autoshrink option is enabled.
    select name from sys.databases where
    is_auto_shrink_on=1
    Thanks in Advance, Kranthi

    foreach($instance in $instances){
        Invoke-SqlCmd $query -ServerInstance $instance
    https://msdn.microsoft.com/en-us/library/cc281720.aspx
    ¯\_(ツ)_/¯

  • How to copy a file from one PC to another in ABAP program

    Hello Friends,
    I have a requirement where I have to copy a file from a central location ( central servers like
    inblr102 or
    dwdf ) and save it on local PC in ABAP code. Also, while saving it should ask for the path on PC. Can any of you please help me in this?
    Thanks in advance!
    Divya

    Hi,
    Check out this link. This deletes file,  probally you will get some hint to copy.:
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/deleting%252bfile%252bfrom%252bwindows
    Thanks,
    Krishna

  • Is thr are any other events apart from PAI,PBO,POV,POH in ABAP Programming

    Gayathri

    Hi,
    PBO,PAI,POV and POH these are the only events available in  Module pool programming.
    <b>Below i give you the Classical  Report Events.</b>
    Initialization.
    at selection-screen.
    at selection-screen on value Request.
    Start-of-selection
    end-of-selection.
    Top-of-page
    End-of-page.
    <b>Events in Interactive Reports</b>.
    Addition to the Classical Report Events below Events are used in Interactive Reports.
    at line-selection.
    top-of-page During line selection.
    Reward Ponts if Helpful.
    Thanks & Regards,
    Ashok.

  • How do I get the Batch Search Strategy Type in an ABAP program?

    Hi Experts,
    I have a requirement to filter the Batch Search Strategy Type in a BADI. For example, I have a Strategy Type ZD01 which is a Customer/Material combination. This has been created and checking VCH3 confirms that.
    For example, I am implementing BADI VB_BD_SELECTION~PRESELECT_BATCHES and will put the filtering in there. For example, I go to transaction VL01n then create outbound delivery with order reference, in the PRESELECT_BATCHES portion, I will do a filtering that if Batch Search Strategy Type = ZD01, then do some code.
    My problem is, I don't know how to retrieve the Strategy Type. I can use the parameters I_KOMKH-KUNNR (Customer) and I_KOMPH-MATNR (Material) of method PRESELECT_BATCHES to retrieve the Strategy Type but I don't know how.
    Any tips?

    Hi Experts,
    I have a requirement to filter the Batch Search Strategy Type in a BADI. For example, I have a Strategy Type ZD01 which is a Customer/Material combination. This has been created and checking VCH3 confirms that.
    For example, I am implementing BADI VB_BD_SELECTION~PRESELECT_BATCHES and will put the filtering in there. For example, I go to transaction VL01n then create outbound delivery with order reference, in the PRESELECT_BATCHES portion, I will do a filtering that if Batch Search Strategy Type = ZD01, then do some code.
    My problem is, I don't know how to retrieve the Strategy Type. I can use the parameters I_KOMKH-KUNNR (Customer) and I_KOMPH-MATNR (Material) of method PRESELECT_BATCHES to retrieve the Strategy Type but I don't know how.
    Any tips?

  • ODI - Error when Executing a Scenario from an OS Command

    I am developing a project with ODI on Oracle 10g, but I have had some troubles with it.
    Problem:
    I have a scenario that I run from the Designer and it works correctly.
    But, the problem is when I want to run it from a terminal command from an Operating System (OS).
    For this, I did the following steps:
    1.-Configure file odiparams.bat file from the path C: \ OraHome_1 \ oracledi \bin as follows:
    set ODI_SECU_DRIVER=oracle.jdbc.driver.OracleDriver
    set ODI_SECU_URL=jdbc:oracle:thin:@192.168.1.114:1521:orcle
    set ODI_SECU_USER=ODI_REPMSTR
    set ODI_SECU_ENCODED_PASS=eyfpRSdWr9N5rARKkCmCNMVrEp
    set ODI_SECU_WORK_REP=ODI_REPWORK
    set ODI_USER=SUPERVISOR
    set ODI_ENCODED_PASS=LELKIELGLJMDLKMGHEHJDBGBGFDGGH
    2.- Launching a Listener Agent
    Start\All programs\Oracle\Oracle Data Integrator\Agent
    3.- Run the next command:
    startscen ACT_ETL_CGA 001 GLOBAL -NAME=AGENT_1 "-v=5"
    But, at the end of the execution, it shows one list like that
    FirstDate:2010-03-01 17:10:24.0
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    IntJavaName:com.sunopsis.dwg.dbobj.SnpState
    IObjects:4700
    LastDate:2010-03-01 17:10:24.0
    LastUser:SUNOPSIS_INSTALL
    ObjName:OBJ_SNPSTATE_4700
    SecuPos:570, ExtVersion:null
    And last:
    java.lang.NullPointerException
    DwgJv.main: Salida. Código de retorno:-1
    Can you please help.
    Thanks.
    Arturo Rubio

    Hello,
    Try to remove and recreate your package and scenario, I had the same issue and solved doing it.
    It seems for me that the package cannot update its contents, for example, if you change something in your interface, you must recreate your package and scenario to update the changes.
    What ODI version do you use? If you use an old version, try to update to ODI 10.1.3.5
    Regards,
    Wallace Galvão
    São Paulo - Brazil

  • Trigger a waiting ABAP program from a User Exit of CO01

    Hi all,
       We would like to launch a ABAP program from a User Exit (EXIT_SAPLCOZV_001) of CO01, this ABAP program has a special characteristic: using Function Module RFC_PING_AND_WAIT, so this program will be existing until terminating event coming.
        Our purpose is terminate CO01 normally before finishing of ABAP program. We don't know if it's possible?
        Actually:
           1. when we use SUBMIT ..., the process will stop CO01 (stop not normally) and then launch ABAP program. => This is not suitable for our purpose.
           2. when we use SUBMIT ... and RETURN, CO01 will wait for finishing of ABAP program => This is not suitable for our purpose too, because we wish CO01 terminated normally when ABAP program is still existing and waiting for its terminating event.
    Do you have a solution that is suitable for our purpose, could you please help us?
    (The context is below:
    Time:  Begin-->CO finished> ABAP finished-->    
       Launch CO01 --> Call User Exit --> Call ABAP program for waiting --> CO01 saved normally.
    > ABAP program still waiting ---> waiting for terminating event       
    Thanks a lot,
    Vinh Vo

    Hi,
         Try with the function module BP_EVENT_RAISE, it takes eventid, and eventparm as import parameters in the User exit.
    1) With Eventid, you create a background job of the ABAP program and schedule it. Eventparm can be the Production order number.
    2) So when ever the Event is triggered the FM gets triggered and which in turn run the ABAP program, so the foreground the CO01 transaction runs without waiting for the ABAP program to complete.
    Regards
    Bala Krishna

  • Call ABAP program from Unix script passing dynamic filename

    Hi,
    Does anyone know if it is possible to call an ABAP program from a Unix script passing a dynamic filename to the ABAP program?
    We are receiving a file from an external company and on receipt of the file want to call an ABAP program passing the filename.  The filename is made up of File ID, Date and Time which we need to read in the ABAP program.  We usually use Events to trigger a program which is fine when the filename if static however since this filename will be dynamic we cannot do this.  In addition we cannot just rename the file to a static name in the Unix script as we need to know the value of the date and time from the file ID in the ABAP program.  I can change the ABAP program to check our /in directory for a Filename that starts with the fixed File ID however I thought there must be a better way of doing this.  We want the external company to put this information in a file header record but they don't want to change the file contents.  Any ideas would be appreciated.
    Thanks,
    Sinead.

    You could follow the following method
    1.Let the external file reside in the SAP application layer in a defined path e.g. /usr/sap/tmp/interface/working/
    2.Write an ABAP program which will include the following steps:-
       i) read all files in the file path using function module EPS_GET_DIRECTORY_LISTING
      ii) Read the data from files existing in the directory using OPEN_DATASET statement
    iii) After the files have been read move the files to another directory e.g. /usr/sap/tmp/interface/backup/ or you can delete the file.
    3.Schedule this program to be executed depending on the frequency of the external file being generated.

  • How to create crystal reports from ecc abap program?

    Hi all,
    I am new to sap ecc to bo report!!
    I heard that abap program cannot be directly connected to crystal reports,
    So created a function module which is equivalent to the abap program!!
    And happened to connect the same in crystal !!
    Can anyone let me know how to proceed !!
    will be there any performance issue ?
    can anyone guide me how to do reporting from ecc function module to crystal reports directly?
    Thanks

    Hi Pooja,
    From what I know, not all ABAP programs can be accessed in Crystal Reports. The program should return rows and columns, otherwise, CR would not be able to report off it.
    I'm not sure if there are any performance issues if we follow your path. Do you experience any?
    And, do you need help in creating a report on the function module, I mean do you also have any design related queries?
    -Abhilash

  • 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

  • Running ls command from Java stroed procedure no output

    Hi ,
    I am trying to run ls command from java stored procedure in oracle
    Process p = Runtime.getRuntime().exec("ls");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("output of the command run:\n");
    while ((s = stdInput.readLine()) != null) {
    System.out.println(s);
    from java stored procedure in oracle.
    i get output of println statments but it does not go into while loop to print from stdInput.
    Result of running Java stored procedure is -
    output of the command run:
    Call completed.
    when i run the program on client side it works fine.
    Has anybody tried this from java stroed procedure.
    Thanks,
    Jag

    Jag,
    Actually, the question of whether it works for me seems to depend on the version of the OS (or Oracle). On RedHat Linux (Oracle 8.1.6) it didn't work at all, but on Solaris (Oracle 9.0.2) it did. Here's the output from that run:
    SQL> /
    output of the command run:
    init.ora
    initDBPart9i.DBPSun01.ora
    initdw.ora
    lkDBPART9I
    orapw
    orapwDBPart9i
    spfileDBPart9i.ora
    Done
    PL/SQL procedure successfully completed.
    But, I did need to change a line of your code to this:
    Process p = Runtime.getRuntime().exec("/usr/bin/ls");
    your original was:
    Process p = Runtime.getRuntime().exec("ls");
    You might consider, if possible, use of some of the Java File classes instead of ls, as this might make things more predictable for you. There were some examples in oramag.com a few months ago, but they were pretty simple (you might not need them).
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

Maybe you are looking for

  • PROBLEM IN T-CODE F-02 & FBL3N

    I am facing some problem while giving authorizations for a T-CODE FBL3N & F-02 the problem is there are 4 BUSINESS AREA to be defined out of which only 2 Business area are to be given in a particular USER ID the authoirzation object for business area

  • Excise amt split on profit center basis

    Hi SAP Gurus, I have the following billing line item for revenue sale of goods Conversion charges Fixing charges TOTAL Excise Here all three revenue items go to a different profit center. The excise is calcultaed on the total of the three revenue. Cl

  • Is it possibe to have non numeric measures in cube??

    Hi is it possible to have non numeric measures in a cube?? As i get an error during deployment of mapping of this cube if i have non numeric measures in a cube ....

  • Where are downloaded materials on my iPad?

    I downloaded a free book from iTunes onto my iPad, but now I can't find it. Where are downloads placed on an iPad?

  • Blackberry Siezing with certain functions

    Hello, this may have already been covered in the forum, I have had a look but have not discovered it, so please fogive if i am repeating.  My blackberry has seized at the moment with facebook notificiations - it says I have 2 messages (on the notific