Execute Exe Program from SAP

Hi SAP gurus,
I have  a requirement where in we have a DOS exe Program but Dont have source code of it. The Program takes some input values, Calculates and Gives the output result. We need that Program to be called from SAP so that we can pass the input values from SAP and get the results back into SAP.
It would be great if you can help me out in this. Answers will be rewarded.
Thanks,

Check FM WS_EXECUTE.
REPORT ZEXAMPLE.
DATA:       V_PGM(100) VALUE 'C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\WINWORD.EXE',
V_FNAME     LIKE RLGRAP-FILENAME VALUE 'C:\DOCUMENT.DOC'.
CALL FUNCTION 'WS_EXECUTE'
     EXPORTING
          COMMANDLINE          = V_FNAME
          PROGRAM        = V_PGM
     EXCEPTIONS
          FRONTEND_ERROR      = 1
          NO_BATCH            = 2
          PROG_NOT_FOUND      = 3
          ILLEGAL_OPTION      = 4
          GUI_REFUSE_EXECUTE  = 5
          OTHERS        = 6.
IF SY-SUBRC NE 0.
  WRITE:/ V_FNAME, 'NOT OPENED WITH', V_PGM.
ELSE.
  WRITE:/ 'EXTERNAL APPLICATION CALLED SUCCESSFULLY'.
ENDIF.

Similar Messages

  • JCO.Server Error while trying to execute a RFC program from SAP

    Hi,
    We are connecting to an external registered server program from SAP via Web Methods.
    The external server program is registered with the SAP Gateway. We have created a TCP/IP RFC destination and are able to connect to the destination successfully via SM59.
    An RFC function is created in SAP and is called using the syntax CALL FUNCTION "/NGN/BAPI_STRE_SEARCH_PROCESS" DESTINATION 'PRDB2B'. We have also handled the COMM_FALIURE and SYSTEM_FALIURE exceptions in the function call.
    We are monitoring the gateway via SMGW and see a connection log to the RFC destination as below
    Number - 10
    LUname - dev01
    TPName - sapgw00
    User - KRAORANE
    Status - CONNECTED
    Symbolic - PRDB2B
    Conversation - 86520353
    Prot - REG
    SAP return code - 0
    CPIC rtn code - 0
    The external program returns results as expected.
    However sometimes the RFC fails and returns the message “JCO.Server could not create server function /NGN/BAPI_STRE_SEARCH_PROCESS”.
    We are not able to figure what exactly is causing this error. Any help will be highly appreciated.
    -Kiran

    Hi,
    Please see the below links..
    JCO.Server Error while trying to execute a RFC program from SAP
    Re: JCO.Servcer could not find server function
    Re: JCO.Server could not find server function 'SET_SLD_DATA'
    /people/kathirvel.balakrishnan2/blog/2005/07/26/remote-enable-your-rfchosttoip-to-return-host-ip-to-jco
    Re: interfacing SAP with an existing java applications
    http://help.sap.com/saphelp_nw04/helpdata/en/47/80f671ee6e4b41b63c0fe46bd6e4f8/content.htm
    http://www.sapgenie.com/faq/jco.htm
    Regards
    Chilla..

  • Calling Non SAP programe from SAP program

    Hi Experts...
    Can we cal Non SAP programs Like Windows EXE programs from ABAP programs ?
    If yes Then How .....
    Regards ...
    ..Ashish

    Hi Ashish ,
    Ya we can call a non SAP program from SAP program.
    For example we can call a EXE program from the SAP program using the RFC connection created in SM59.
    In Sm 59 you can create a TCP/IP connection and give the path of the executable there.

  • How does execute PHP Script from SAP?

    I've already installed SAPRFC and run SAP Function from PHP successfully. But failed when tried execute PHP script from SAP (SM59). Anyone can help me for a clear instruction for this problem?
    Thanks

    Hi Max,
    here is the Source:
    [code]
    #!/usr/bin/php -q
    <?php
    // SAPRFC - Server example
    // PHP server function RFC_READ_REPORT
    // Require: CGI version PHP, RFC destination defined in SAP R/3 (SM59)
    // http://saprfc.sourceforge.net
    // Interface definiton for RFC_READ_REPORT
    // (generated by saprfc.php - option Generate PHP)
       $DEF_RFC_READ_REPORT = array (
                             array (
                                     "name"=>"SYSTEM",
                                     "type"=>"EXPORT",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"","abap"=>"C","len"=>8,"dec"=>0)
                             array (
                                     "name"=>"TRDIR",
                                     "type"=>"EXPORT",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"NAME","abap"=>"C","len"=>40,"dec"=>0),
                                             array ("name"=>"SQLX","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"EDTX","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"VARCL","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"DBAPL","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"DBNA","abap"=>"C","len"=>2,"dec"=>0),
                                             array ("name"=>"CLAS","abap"=>"C","len"=>4,"dec"=>0),
                                             array ("name"=>"TYPE","abap"=>"C","len"=>3,"dec"=>0),
                                             array ("name"=>"OCCURS","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SUBC","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"APPL","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SECU","abap"=>"C","len"=>8,"dec"=>0),
                                             array ("name"=>"CNAM","abap"=>"C","len"=>12,"dec"=>0),
                                             array ("name"=>"CDAT","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"UNAM","abap"=>"C","len"=>12,"dec"=>0),
                                             array ("name"=>"UDAT","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"VERN","abap"=>"C","len"=>6,"dec"=>0),
                                             array ("name"=>"LEVL","abap"=>"C","len"=>4,"dec"=>0),
                                             array ("name"=>"RSTAT","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"RMAND","abap"=>"C","len"=>3,"dec"=>0),
                                             array ("name"=>"RLOAD","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"FIXPT","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SSET","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SDATE","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"STIME","abap"=>"C","len"=>6,"dec"=>0),
                                             array ("name"=>"IDATE","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"ITIME","abap"=>"C","len"=>6,"dec"=>0),
                                             array ("name"=>"LDBNAME","abap"=>"C","len"=>20,"dec"=>0)
                             array (
                                     "name"=>"PROGRAM",
                                     "type"=>"IMPORT",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"","abap"=>"C","len"=>40,"dec"=>0)
                             array (
                                     "name"=>"QTAB",
                                     "type"=>"TABLE",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"LINE","abap"=>"C","len"=>72,"dec"=>0)
    // Create list of PHP server functions
       $GLOBAL_FCE_LIST[RFC_READ_REPORT] = saprfc_function_define(0,"RFC_READ_REPORT",$DEF_RFC_READ_REPORT);
    // PHP server function
       function RFC_READ_REPORT ($fce)
           $REPORT = saprfc_server_import ($fce,"PROGRAM");
           saprfc_table_init ($fce,"QTAB");
           $fd = fopen ($REPORT,"r");
           if (!$fd)
               return ("NOTFOUND");     // raise exception "NOTFOUND"
           while (!feof($fd))
               $LINE = fgets ($fd,73);
               saprfc_table_append ($fce,"QTAB",array("LINE"=>$LINE));
           fclose ($fd);
           saprfc_server_export ($fce,"SYSTEM","PHP");
           return (true);
    // Call script with: ./server.php -a phpgw -g hostname -x sapgw00
       $rfc = saprfc_server_accept ($argv);
    // Dispatch one function call
       $rc = saprfc_server_dispatch ($rfc,$GLOBAL_FCE_LIST);
       saprfc_close ($rfc);
    ?>
    [/code]
    Regards
    Gregor
    Message was edited by: Gregor Wolf

  • Executing Sabrix Reports from SAP CPS

    Does anyone know if we can executing Sabrix Reports from SAP CPS?
    Thanks,
    Bhushan

    No. That was the first option I could think of. Executing it with ABAP Program.
    I dont have much information about Sabrix System but what I understand is that automated tax reporting solution which runs batch processes in background during
    night and email report with desired data in an excel spreadsheet format. Sabrix doesn’t have a custom solution to generate reports. They have suggested leveraging 3rd party tools for such requirement.

  • Reg : Executing .exe file from application server

    Dear Experts,
                        i have a requirement to execute an .exe file from application server,i tried with method CL_GUI_FRONTEND_SERVICES=>EXECUTE but it executes .exe file from presentation server only.can
    anyone kindly clarify to execute .exe file from application server?
    Thanks in advance,
    Sujay

    Hi,
    Did you search before posting?
    Re: Execute a .exe file present in the Application Server
    Vikranth

  • Execute DOS command from SAP

    hi experts ,
    i need to execute DOS command from SAP .
    earlier we have 'GUI_EXEC' WS_EXECUTE , 'WS_DOWNLOAD' etc which are Obsolete now.
    as we are using ECC6.0. kindly guide how to do this.
    best regards,
    Rahul

    Try out...
    DSVAS_DOC_WS_EXECUTE_50
    or
    CL_GUI_FRONTEND_SERVICES=>EXECUTE
    <b><REMOVED BY MODERATOR></b>
    Thanks & Regards
    ilesh 24x7
    Message was edited by:
            Alvaro Tejada Galindo

  • How to execute  a program  from another

    Hi, expert
    Sorry for this question, but how can I do to execute a program from another with no parameter.
    I will thanks an answer, it's urgent...
    Regardss,
    mgg
    P.D. Points rewarded.

    Simple,  use the SUBMIT statement.
    SUBMIT zreport and return.
    Regards,
    RIch HEilman

  • How to find program from SAP Quick Viewer

    Hi Experts,
    Actually report had generated from SAP Quick Viewer. Now i need to trace the SAP QUERY through the program.
    Please suggest your solutions or steps to find the program from SAP Quick Viewer.
    Another clarification, is it possibe to add new fields in selection-screen through SAP Quick viewer.
    Please suggest steps to do
    Best Regards,
    Bharat

    Hi,
    I need clarification in the programming name convention.
    Report name: AQZZZPS=========Z_PSPAYMENT===
    Can you define what is SAP Query and Report program?

  • Unable supplying parameter like 'PASSWORD' in external program from SAP

    HI GURUS,
    I am unable supplying parameter like 'PASSWORD' in external program from SAP.
    Is it possible to achieve this? IF it is then how could we suplly Password information to External Program for loging in.
    Thanks
    SANKU.

    Which way you are supplying password ?
    Programtically  ? or ?
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Jul 17, 2009 3:26 PM

  • Executing exe files from java program

    Hi,
    I need to execute exe files and pass arguments to them from my java code.
    Can you give me guidelines to do that as i haven't done that before.
    Thanks.

    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    getRuntime() method.
    exec() method.

  • Executing  .exe program

    I've tried to write code like this :
    r.exec("c:\my documents\Ccode.exe");
    where r is an instance of Runtime class, but then
    nothing happen and my DOS - Promt became hang.
    I wrote the Ccode in C.
    Anyone could help me how to run .exe program form java?
    thanks you very much in advance for your kindess
    regards,
    agus

    Thank you very much for your answer. But unfortunately my java program still unable to execute my C code. The C code is only simply write 'this c code will be called from java program' and then waiting for user keystoke ( by getch() code). There is no hang but an error message appear. What should I do ?
    best regards,
    agus

  • Executing Excel Macros from SAP

    Hi all Experts,
    I have created a program which tranfers data from different internal tables into Different Worksheets of a single workbook.
    Now, Can some one please tell me how to Execute macros from SAP.
    Regards,
    AJ

    To execute an Excel macro follow these steps.
    1. Create macro inside Excel Workbook where you transferred your information.
    2. Use following instruction to execute the desired macro you create:
        DATA: EXCEL TYPE OLE2_OBJECT.
        CREATE OBJECT EXCEL 'Excel.Application'.
        CALL METHOD OF EXCEL 'Run' EXPORTING #1 = 'WRITE_SHEET_CELL'
                                                                            #2 = 'VALUE1'
                                                                            #3 = 'VALUE2'
                                                                            #4 = 'VALUE3'.
    In previous example, macro WRITE_SHEET_CELL was created first. The macro name must be in uppercase.
    Regards.
    Rafael Rojas.

  • How to execute Excel Marco from SAP using Office Integration Classes

    Is there a way to trigger Excel Macro from SAP? I tried using method CALL METHOD document->execute_macro
    of i_oi_document_proxy  but it does not work.
    Thanks
    Vivek

    Try this:
    If you are using OLE to populate the Excel Sheet then, then yes you can run a macro.
      CALL METHOD OF OBJ_EX_APP 'Run'
           EXPORTING #1 = MACROSTR.
    Adding a Field Exit
    To add a field exit first find the data element that is linked to the screen field- the screen number and program
    Run program RSMODPRF. You will need to create two function modules one FIELD_EXIT_MEPO_VENDOR and
    FIELD_EXIT_MEPO_VENDOR_A
    FIELD_EXIT_MEPO_VENDOR should have code simply of input = ouput.
    FIELD_EXIT_MEPO_VENDOR_A should have the code for whatever the functionality is required
    Go back to RSMODPRF and run the program without parameters. Use the push buttons to assign the screen, 'A' and program. Use the drop down to activate the field list.
    This should now work, but there is no way of debugging. For further information look at OSS 29377
    program zzdirlist.
    for AIX this method also works.
    DATA: BEGIN OF TABL OCCURS 0,
          TEXT(80) TYPE C,
          END OF TABL.
    DATA: COMMAND(256) TYPE C.
    COMMAND = 'ls'.
    CALL FUNCTION 'RFC_REMOTE_PIPE' DESTINATION 'SERVER_EXEC'
    EXPORTING COMMAND = COMMAND
    READ = 'X'
    TABLES PIPEDATA = TABL.
    LOOP AT TABL.
       WRITE:/ TABL-text.
    ENDLOOP.

  • Executing external programs from PL/SQL?

    Hi All,
    Is it possible to execute external
    programs (i.e. shell scripts, or
    perl scripts) from a stored procedure
    or trigger?
    I know that typically it is the other
    way around, but hey try telling that
    to my boss.
    Thanks

    you cant execute any operating system commands from plsql
    procedures. but you can achieve result by using either java
    stored procedure or pro*C program .
    Suresh Vemulapalli

Maybe you are looking for

  • Error when editing region of the placeholder

    I defined a placeholder using the following documentation http://www.oracle.com/technology/products/content-management/ucm/sitestudio10gr4tutorials/AddingContent/addingcontent_viewlet_swf.html To summarize, following are the steps that I followed 1.

  • My location....

    How can I change my location to my accurate location! Not my neighbors house?

  • G/L Movement Types for Fixed Assets

    Dear All, for the key figures displayed in report "Schedule of Fixed Assets"  I need the corresponding G/L Movement Types. I found it for the posting types in  attached screenshot already, but for the following key figures I would it need urgently fo

  • How may I exclude one add-on from checking for updates, while allowing all others to be able to check for updates?

    I have an add-on that I do not wish to update; as I am satisfied with the version I am using, and I am dissatisfied with the updated version.

  • Configure new user role

    Hello, I'm new in town so, please forgive me all misteakes I will make. I try to do my best. I would like to modyfie a user role in SAP CRM 7.0. My point is, I want to add a button ( assing a user to the respossible employee). In my current role I ha