Calling a JAVA program from an RFC in SAP ABAP

Hi All,
I have an RFC for a specific purpose in which I need to call a JAVA program whose path is given to me. Please suggest a possible process to do the same .
Your's <removed by moderator> responce is highly appreciated.
Thank you.
Edited by: Thomas Zloch on Nov 26, 2010 1:33 PM - priority normalised

Hi Priyanth,
  I am not sure but check this out
  If you are using any commands , check if that command is configured in SM69

Similar Messages

  • CALL A JAVA PROGRAM FROM ABAP -- NEED HELP

    Hi all,
    Can somebody tell me how to call a java xml code from an ABAP program? First let me know if at all, is it possible to call a java program from SAP that is from an ABAP executable progam?
    Please suggest me in this. All your inputs in this is valuable to me and highly appreciated.
    Thanks in advance,
    Vaishnavi Varadarajan

    Hi,
    Previous explanation i gave is not correct.
    ABAP web services expose the function modules outside R/3, so that other technologies like Java can consume that webservice and read the data in R/3 using the function module.
    For your requirement, create a Java web service to read the XML. Consume this webservice in ABAP. This way you can read the XML from ABAP.
    Regards
    Srikanth KV.

  • Calling a java program from a perl CGI

    The perl program takes form data, does stuff with it, writes it to a file, and then calls a java program to encrypt it, and email it.
    When I telnet to the server, I can run the java program using:
    java CryptoMail.class [email protected] data.txt
    The java program uses jar files which are defined in the Classpath in an .sh script in the etc/profile.d/ directory.
    When I run the perl cgi from the web, it doesn't work. I figured that it wasn't getting the classpath defined because the user wasn't actually logging in so I tried it with java -classpath etc...
    Any ideas???
    I tried the following:
    ==================
    $cmdtorun='/usr/j2sdk1.4.0_02/bin/java CryptoMail $email $file';
    system($cmdtorun);
    ==================
    and also tried variations of the following:
    ==================
    /usr/j2sdk1.4.0_02/bin/java -classpath .:/home/sites/site1/web/cgi-bin/activation.jar:/home/sites/site1/web/cgi-bin/mail.jar /home/sites/site1/web/cgi-bin/CryptoMail [email protected] /home/sites/site1/web/cgi-bin/wellsfargo.txt
    ==================

    >
    Any ideas???Write a script file that explicitly paths everything.
    Test it by setting the class path and path to nothing in the environment and seeing if it works.
    Redirect errors from everything to a log file.
    Then run the script from your perl program. Verify that it did not return any errors. Verify there are no errors in the log file.

  • Calling a Java Program from another

    Hi,
    I am putting together a Java program which will launch other Java programs.
    I was thinking of doing this by calling unix scripts from my java program by getting an instance of the Runtime object and then calling the exec method with the script name.
    I am just wondering what is the best practice when doing this? i.e., dealing with timeout issues, and errors in the scripts etc.
    I have read this article, which is quite good: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=1
    Is there any code available on the web that deals with all of the basic error scenarios?
    Is it good practice to use a java program to call another java program? Or is there a better way of doing this?
    The main reason I am using java is because I am most familiar with it and I need to connect to a database as well and do some manipulation of results returned.
    Any thoughts or suggestions would be much appreciated.
    Message was edited by:
    LondonJavaDev

    Thanks Prometheuzz
    Is the main difference between your suggestion and
    using the Runtime.getRuntime().exec(cmd) way of doing
    things is that in the former both eill run as the
    same process (Thread) but in the second scenario the
    .getRuntime().exec(cmd) will start a separate new
    thread?
    Many ThanksCorrect. But you can create a sort of wrapper class for A which implements Runnable and stuff it in it's own thread. If you're dealing with Java code only, I advise you to create threads yourself instead of letting your OS handle them.
    Here's a demo:
    class Foo {
        public static void main(String[] args) {
            (new Thread(new ARunner())).start();
            B.main(null);
    class ARunner implements Runnable {
        public void run() {
            A.main(null);
    class A {
        public static void main(String[] args) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) { /* ... */ }
            System.out.println("A");
    class B {
        public static void main(String[] args) {
            System.out.println("B");
    }Of course, you can create a wrapper for B as well.

  • Calling one java program from another

    Hello,
    How can I start another java program from one? Lets
    say I want Second.java to start by calling it from
    First.java. How do I do it? The two programs are given
    below. Any help is appreciated.
    Thanks,
    Amanda
    First.java
    import java.io.*;
    import java.lang.reflect.*;
    public class  First
         public static void main(String[] args)
              Process theProcess=null;
              System.out.println("Hello World from First.java!");
              String second=new String("Second.java");
              //System.load(second);
              //Runtime.getRuntime().load(second);
              try
                   theProcess=Runtime.getRuntime().exec( "Second.java"
                   System.out.println("after exec");
              catch (IOException ioe)
                   System.out.println(">>IOException thrown in
    First.java while calling
    Second.java."+ioe.getMessage());
    Second.java
    public class  Second
         public static void main(String[] args)
              System.out.println("Hello World from Second.java!");
    }

    Thanks, warnerja
    What if Second.java is on a remote machine i.e.
    First.java and second.java are on different machines?
    Will I have to use RMI?Well, you'd have to do some kind of remote invocation. Depends on what kinds of apps house the classes. There are all kinds of ways - web services, servlets, RMI, (maybe others...)
    That's a totally different question than what you originally posted, and would have been very relevant to say so in the first place.

  • Requesting an overview of how to call a Java program from EBS.

    Hi,
    I am an experienced Java developer in the middle of an implementation of EBS 12g. I am very new to EBS and I'm not sure where to start on this. I need to provide users the ability to call a Java program that prints a report from EBS. I would be grateful if somebody would outline the general approach that should be used. Links to documentation/tutorials are appreciated also.
    Thanks,
    Mike

    Hi,
    I need to provide users the ability to call a Java program that prints a report from EBS. Are you referring to Java concurrent programs? If yes, please see the documents referenced in this thread.
    Java Concurrent Programs
    Java Concurrent Programs
    Regards,
    Hussein

  • Can I call a Java program from a SQL Server Trigger?

    Hello,
    I want to encrypt some data in a database column in SQL Server. Today I am using java code to encrypt the value and store it in the database using JDBC.
    Now I want to use a VB client to store the encrypted value in the SQL Server DB. Since the encryption is handled by a java class, can I write a trigger in SQL Server that while inserting the raw data, calls the java class for encrypting the value and then inserts the encrypted value into the column?
    In general, is it possible to call a java class from a SQL Server trigger?
    Thanks
    Bipin

    Here are 3 examples of code for insert, update and delete:
    CREATE TRIGGER [PLI_INSERT_TRIGGER] ON [dbo].[PLI]
    FOR INSERT
    AS
    Declare @cmd sysname, @code sysname, @list sysname
         Select @code = PLI_K_COD, @list = PLI_K_LISTINO from inserted
         Set @cmd = 'java mirrorDb.Copy PLI INSERT ' + @code + ' ' + @list
         EXEC master..xp_cmdshell @cmd
    CREATE TRIGGER [PLI_UPDATE_TRIGGER] ON [dbo].[PLI]
    FOR UPDATE
    AS
    Declare @cmd sysname, @code sysname, @list sysname
         Select @code = PLI_K_COD, @list = PLI_K_LISTINO from inserted
         Set @cmd = 'java mirrorDb.Copy PLI UPDATE ' + @code + ' ' + @list
         EXEC master..xp_cmdshell @cmd
    CREATE TRIGGER [PLI_DELETE_TRIGGER] ON [dbo].[PLI]
    FOR DELETE
    AS
    Declare @cmd sysname, @code sysname, @list sysname
         Select @code = PLI_K_COD, @list = PLI_K_LISTINO from deleted
         Set @cmd = 'java mirrorDb.Copy PLI DELETE ' + @code + ' ' + @list
         EXEC master..xp_cmdshell @cmd
    you must go "sql server entreprise manager" right click on the table you want to add triggers and select: all activities, manage triggers.
    You have 3 examples: for an insert, for an update and for a delete
    ON [dbo].[PLI] specify the table on which you want to setup trigger.
    FOR DELETE, INSERT, UPDATE specify the event.
    The Declare statement create the variables in which I want to put some values to pass to the java program, for example which table, which event, which key fields.
    the "Select @code = PLI_K_COD, @list = PLI_K_LISTINO from inserted" set the variables with the value of the columns of the table I am interested to read from my java program, for example the variable @code receive the value of the column pli_k_kod (is the key) of the table PLI.
    The "Set @cmd = 'java mirrorDb.Copy PLI DELETE ' + @code + ' ' + @list " prepared the variable @cmd with the java command followed by the package.classname and parameters.
    The EXEC launch the command to the operating system.
    Daniele

  • Calling Java program from ABAP

    Hi All,
    my ABAP program downloads one file to one folder. Then one Java program is running to Encrypt the file.
    Now , they want to call the JAVA program in ABAP, so that they can encrypt the file before downloading.
    Is it possible to call a Java program from ABAP ? If Yes, please give me the detailed procedure.
    Thanks
    pabi

    Pabi,
    Using the RFC connection,we can establish a link between Java and SAP.
    Afterwards,hope we can call Java program from ABAP.
    Below is the sample piece of code to establish RFC connection(link) between Java and SAP.
    DATA: REQUTEXT LIKE SY-LISEL,
          RESPTEXT LIKE SY-LISEL,
          ECHOTEXT LIKE SY-LISEL.
    DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
    DATA: RFC_MESS(128).
    REQUTEXT = 'HELLO WORLD'.
    RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
    CALL FUNCTION 'STFC_CONNECTION'
       DESTINATION RFCDEST
       EXPORTING
         REQUTEXT = REQUTEXT
       IMPORTING
         RESPTEXT = RESPTEXT
         ECHOTEXT = ECHOTEXT
       EXCEPTIONS
         SYSTEM_FAILURE        = 1 MESSAGE RFC_MESS
         COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
    IF SY-SUBRC NE 0.
        WRITE: / 'Call STFC_CONNECTION         SY-SUBRC = ', SY-SUBRC.
        WRITE: / RFC_MESS.
    ENDIF.
    Regards,
    Sree

  • How can I call a java class from within my program?

    I was wondering if there's a platform independent way to call a java class from my program.

    Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.

  • How to call java program from javascript

    Hi,
    I have an java program which will transform one xml to another xml using XSLT.
    I want to call this java program from Javascript? Is this possible? Please suggest me.
    Thanks,
    Gopal

    is it not possible?
    do i have to refresh the page and read in the values like...
    <%
    String ename = request.getParameter( "EmployeeName");
         session.setAttribute( "ename", ename);
    %>and then call the class from here?
    looking around ive come across ajax but i dont know how to use it and what you need to install and if its compatable with tomcat and jsp?
    is ajax better or not really worth it?
    i have anything up to 100 fields that need saving at one save click

  • Calling java program from PL/SQL code

    Dear,
    How to develop and call a java program from PL/SQL code?
    What about if this program will call other java programs?

    Perhaps the Java Developer's Guide would be a good place to start
    http://download.oracle.com/docs/cd/B19306_01/java.102/b14187/toc.htm
    Justin

  • Not able to execute one Java program from another one via. exec()

    Hi,
    I am new to this forum, so I might be asking a very trivial quetion.
    My program Ap1 is :
    class Ap1
    public static void main(String a[]) throws Exception
    Runtime rt=Runtime.getRuntime();
    Process p=null;
    p=rt.exec("javac,Pr.java");
    Runtime.getRuntime().exec("javac,Pr.java");
    When I run the above program, I get below error at the line 7(bold one):
    D:\batchwe>javac Ap1.java
    D:\batchwe>java Ap1
    Exception in thread "main" java.io.IOException: CreateProcess: javac,Pr.java err
    or=2
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
    at java.lang.ProcessImpl.start(ProcessImpl.java:30)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
    at java.lang.Runtime.exec(Runtime.java:591)
    at java.lang.Runtime.exec(Runtime.java:429)
    at java.lang.Runtime.exec(Runtime.java:326)
    at Ap1.main(Ap1.java:7)
    Path is set as below(which seems correct):
    D:\batchwe>path
    PATH=C:\Program Files\Java\jdk1.5.0_05\bin
    I am just wondering how to call one Java program from another one?!
    Please help.
    thanks
    Rashmi

    Hi diptaPB,
    Thanks for your suggestion.
    Here is how I tried it again, but not getting the desired output:
    Class Pr looks like below -->
    class Pr
    public static void main(String a[])
    System.out.println("hi from process");
    When I run 'Pr' from command prompt, i get the desired output:
    D:\batchwe>java Pr
    hi from process
    However, when I call 'Pr' from another program Ap2.java, it seems that it does not call 'Pr':
    class Ap2
    public static void main(String a[]) throws Exception
    Runtime rt=Runtime.getRuntime();
    Process p=null;
    String[] cmd=new String[2];
    cmd[0]="javac";
    cmd[1]="Pr.java";
    p=rt.exec("cmd");
    D:\batchwe>javac Ap2.java
    D:\batchwe>java Ap2
    ************* no output appears here***********************
    Looking forward for your help.
    regards
    Rashmi

  • Call a Java file from ABAP

    Hi,
    I would like your help in identifying a mechanism in calling a Java Program from an ABAP program. The requirement is that I need to pass enough parameters(possibly in a single object like a <i>table</i>) and fetch that in a Java Program residing in a jar in the J2EE engine. The possibility of this java file interpreting this incoming object and also be able to return something to ABAP which can eventually be printed on the screen needs to be known.
    I also would like to validate an assumption of mine which is that, the jar(the receipient java file) file needs to be put under the directory
    "\usr\sap\<i>SystemID</i>\<i>instancenumber</i>j2ee\deploying\lib"
    Appreciate your time and effort in helping me with this.
    Regards,
    Sam.

    i am not sure about
    I also would like to validate an assumption of mine which is that, the jar(the receipient java file) file needs to be put under the directory
    "\usr\sap\SystemID\instancenumberj2ee\deploying\lib"
    but for your case what you could do is, on the java side get developed a jsp page which will receive data and use the jar to proces and return the results as xml. once thats done.
    from abap you can use cl_http_client class to call this jsp page to pass parameters and get the processed results from jsp page.
    Raja

  • Error while calling java program from ABAP

    Hi Experts,
    We are trying for RFC inbound scenario.
    We followed the below blog
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    We are working with SAP JCO 3.0.2
    We are getting the error : 'STFC_CONNECTION' could not be found in the server repository.
    After I run the Java server program if I execute the RFC destination directly from SM 59 it is showing successful messages.
    If I stop the java program then this RFC is failing. Based on this we concluded that RFC to Java connection is working fine.
    But as mentioned in blog if we call the RFC Destination from ABAP program it is giving the below error,
    'STFC_CONNECTION' could not be found in the server repository.
    If we test the RFC destination using RFC_TRUSTED_CHECK standard FM we are getting the below error.
    'RFCPING' could not be found in the server repository.
    We create the RFC destination of Type : TCP/IP as exactly mention in the blog.
    Please help us in resolving this issue.
    Thanks
    Prince

    Pabi,
    Using the RFC connection,we can establish a link between Java and SAP.
    Afterwards,hope we can call Java program from ABAP.
    Below is the sample piece of code to establish RFC connection(link) between Java and SAP.
    DATA: REQUTEXT LIKE SY-LISEL,
          RESPTEXT LIKE SY-LISEL,
          ECHOTEXT LIKE SY-LISEL.
    DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
    DATA: RFC_MESS(128).
    REQUTEXT = 'HELLO WORLD'.
    RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
    CALL FUNCTION 'STFC_CONNECTION'
       DESTINATION RFCDEST
       EXPORTING
         REQUTEXT = REQUTEXT
       IMPORTING
         RESPTEXT = RESPTEXT
         ECHOTEXT = ECHOTEXT
       EXCEPTIONS
         SYSTEM_FAILURE        = 1 MESSAGE RFC_MESS
         COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
    IF SY-SUBRC NE 0.
        WRITE: / 'Call STFC_CONNECTION         SY-SUBRC = ', SY-SUBRC.
        WRITE: / RFC_MESS.
    ENDIF.
    Regards,
    Sree

  • How to call  java program from ABAP

    Hi Experts,
         My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
      Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
    DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
    parameter TYPE string VALUE 'D:java MyFirstProgram'.
    CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
    application = command
    parameter = parameter
    OPERATION = 'OPEN'
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    bad_parameter = 3
    file_not_found = 4
    path_not_found = 5
    file_extension_unknown = 6
    error_execute_failed = 7
    OTHERS = 8.
    Thanks.

    This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
    Implement an RFC server in 7.0:
    http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
    Implement an RFC server in 7.1 or higher:
    http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm

Maybe you are looking for

  • See that there is an attachment on a line item report

    Hi I wondered if it was possible to include a field on line item reports to show that a there is an attachment to be viewed.  This would be very helpful to users who would then immediately know that a particular posting has an attachment without havi

  • SQL Loader and table views

    I am having a problem updating a large partitioned table through it's appropriate view. Here is the loader file LOAD DATA                INSERT INTO TABLE test.example                     (      PROGRAM POSITION(1:4) CHAR,           DWING_NUMBER     

  • Passing arrays to methods?

    Hi all, Thanks to most of the main contributors in this forum nearly all of my major hurdles in transitioning from proc-C to Cocoa have been overcome. However, while I was shown how to use NSMutableArray in conjunction with NSDictionary to do pretty

  • Cant edit or delete Songs!

    I can't edit or delete songs. If i delete, nothing happens, At all. If i edit, its just grey. I have unticked my music folder for 'read-only' and then reopened iTunes and ran as administator, nothing. Please help. Vista.

  • OCA Certification Book  for 1Z0-147

    Can anyone suggest me book for "EXAM Program with PL/SQL 1Z0-147" OCA certification Thanks Prav