Call a Java Function From Abap

Hi, I need to call a java function from ABAP,  I have a WAS 640 to deploy the module.
I have found this tutorial...
[ABAP calls Java via RFC|/people/thorsten.franz3/blog/2008/11/21/abap-calls-java-via-rfc-1-introduction]
The problem is that it uses a newer version of WAS and it implements EJB 3.0 wich only works on Java 5, but my WAS has java 1.4.2.
Anyone knows how to adapt this Blog to a WAS 640 version ?
Or Perhaps there is another way of doing this, maybe publishing my function as a web service.
Regards.
Mariano.

Why don't you expose your Java functionality as a Web Service and consume it in ABAP program. That should be much easier and the web service can be used in other places as well.
Best regards,
Ritesh Chopra

Similar Messages

  • JCo Outbound( calling Java Function from ABAP )

    HI,
    I want to call a JAVA function from ABAP.I have installed the JCo toolkit and included the sapjco.jar file in the classpath of my system.
    When i execute the program(Example5.java,provided with sapjco.zip) from the command prompt,it is working fine,the server listens to the calls made from ABAP via RFC destination.
    But if i copy the same program in NWDS in a JAVA project,to run it from there as JAVA application,after including the sapjco.jar file in the project JAVA build path,i get the following error,marked by a red cross ,at the head of the program,even before i run it.
    <b>This compilation unit indirectly references the missing type com.sap.jdsr.writer.DsrIPassport (typically some required class file is referencing a type outside the classpath)</b>
    What changes do i need to make,to run it from NWDS?
    I tried to include the sapjcorfc.dll file along with the sapjco.jar in the java build path,but it doesn't help.
    Please tell how to solve this issue?
    Regards,
    Siddhartha

    hello sid,
    which jco version are you using?
    are you using the same jco lib when running in command
    line and in nwds?
    if you are, try checking the order of the your classpath.
    your jco lib (which you are using in command line) should
    come first in order prior to the default libraries in your project.
    regards
    jo

  • IP - Is it possible to call exit planning function from ABAP Report..

    Hi All,
    Greetings.
    Is it possible to call exit planning function from ABAP Report (t-code SE38) ? Or I mean is not limited only to be called from ABAP Report, perhaps from BSP / Web-Dynpro / Function Module.
    If somebody here has been doing it before, I'm keen to ask to kindly share it. Particularly how to call and transfer data to that exit function.
    Or if somebody has done in BPS, appreciate if it can be shared too .
    Thanks a lot and have a good day,
    Best regards,
    Daniel N.

    Hi.
    You can achive this as suggested by Mattias in your previous post.
    Lets say you have next data structure:
    CostCenter | Amount | PercentForDistibution |
    Create input ready query in this format. Restrict cost center by variable type range.
    Create WAD with analysis item.
    When you run web page you enter range of cost centers (lets say you will enter 101004 to 101010).
    I assume you have data only for 101004 in your cube (lets say 1000).
    You will see only one record in your webpage.
    CostCenter | Amount | PercentForDistibution |
    101004       | 1000     | NOTHING
    When you create WAD in analysis item properties set "NUMBER_OF_NEW_LINES" to lets say 1 (so in WAD you will see always one blank line for entering new data).
    Just add 6 new records:
    CostCenter | Amount   | PercentForDistibution |
    101005       | NOTHING| 10
    101006       | NOTHING| 30
    101007       | NOTHING| 20
    101008       | NOTHING| 25
    101009       | NOTHING| 5
    101010       | NOTHING| 10
    Then run planning FOX function like this:
    FOREACH Z_COST_CENTER.
    IF {Amount, Z_COST_CENTER} <> 0
    Z_AMNT_TO_DISTRIBUTE = {Amount, Z_COST_CENTER}.
    ENDIF.
    ENDFOR.
    FOREACH Z_COST_CENTER.
    IF {PercentForDistibution Z_COST_CENTER} <> 0.
    {Amount, Z_COST_CENTER} = Z_AMNT_TO_DISTRIBUTE * {PercentForDistibution Z_COST_CENTER}.
    ENDIF.
    ENDFOR.
    It is not perfect FOX, but as an idead, it should work.
    Regards.

  • Calling a java function from xquery

    Hello,
    I'm pretty new to ODSI and xquery, so forgive me if what I'm asking is too trivial, but I need to find a way to call a java function from inside xquery. I know xquery can do this through external functions, but can't find any example on how the query prolog declaration should be, nor how the function should look like. Could someone enlighten me?
    Thanks,
    Pedro Ivo

    You can do this 2 ways that I know of (Mike probably has more ideas too)
    1. Register an inversion function:
    [How to use an inversion function|http://download.oracle.com/docs/cd/E13167_01/aldsp/docs32/dsp32wiki/Using%20Inverse%20Functions%20to%20Improve%20Query%20Performance.html]
    2. Create a physical data service based on a java function. I have used this approach for both custom JDBC database operations and straight Java processing, with pretty good results.
    Good luck,
    Jeff
    Edited by: jhoffmanme on Apr 14, 2010 9:57 AM

  • 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 Function from PL/SQL

    Hi,
    I would like to call a Java API from a java class residing on the middle tier ($OA_JAVA)
    from the subscription code of a business event. The business event will have a
    subscription with java rule function as my Java API. And the business event will be
    raised from PL/SQL code using WF_EVENT.RAISE API. I want the Java API to
    executed SYNCHRONOUSLY without deferring the event. Can you please provide
    pointers to this.
    Regards
    Ramesh

    Documentation here: http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref185
    says JPublisher can publish records too.
    But when I change the example given at http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref190 as following:
    PACKAGE "COMPANY" AS
    type emp_rec is record (empno number, ename varchar2(10));
    type emp_list is varray(5) of emp_rec;
    type factory is record (
    name varchar(10),
    emps emp_list
    function get_factory(p_name varchar) return factory;
    END;
    then I see <unknown type or type not found> at sql or java files generated. Any ideas?

  • 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

  • Is it possible to call a java function from plsql?

    I have a plsql script which loads data in to a table. One of the fields is a notes field. I would like to use advance offerings of java to manipulate the data before inserting. Is there away I can pass the data to a java function and have it return the manipulated data?
    Thanks
    Aaron

    You can use java stored procedure to call java function from plsql.
    1. Create a java class with a static function(which will be called from plsql).
    2. Compile and load the class into database using LOADJAVA command.
    3. Create a wrapper stored procedure or function in plsql which calls the above java function.
    4. Access this plsql procedure like normal database procedure. This will invoke underlying java function in which you can do all the processing and return result.
    Refer this url for help on implementing above steps :
    http://otn.oracle.com/tech/java/jsp/pdf/developing_o8i_apps_with_plsql_and_java_twp.pdf
    Samples on java stored procedure :
    http://otn.oracle.com/sample_code/tech/java/jsp/oracle9ijsp.html
    Chandar

  • Type Mismatch error while calling a Java Function from Visual Basic 6.0...

    Hi,
    I'm having a problem in calling the Java Applet's Function from Visual Basic. First, I'm getting the handle of the Java Applet and components of it using "Document.Applets(n)" which is a HTML function. I'm calling this function from Visual Basic. My code is something like this...
    ' // Web1 is IE Browser in my Form.
    Dim Ap,Comp
    Dim Bol as Boolean
    Bol = true
    Ap = Web1.Document.Applets(0).getWindow() ' \\ Gets the Parent Window.
    Ap.setTitle("My Java Applet") ' \\ Sets the Title of the window.
    msgbox Ap.getVisibility() ' \\ This will return a Java boolean ( true or false )
    Ap.setVisibility(Bol) ' \\ Function Syntax is : void setVisibility(boolean b)
    Here in my code , i'm able to call any function that which accepts Integer or String but not boolean. So, i m facing problem with Ap.setVisibility() function. It gives me a "Type mismatch error" while executing it. Can you please tell me a way to do this from Visual Basic !
    I'm using Visual Basic 6.0, Windows 2000 , J2SDK 1.4.2_05.
    Please help me Friends.
    Thanks and Regards,
    Srinivas Annam.

    Hi
    I am not sure about this solution. try this
    Declare a variable as variant and store the boolean value in that variable and then use in ur method.
    Post ur reply in this forum.
    bye for now
    sat

  • Calling a java class from abap/bsp

    Hello,
    I am still learning ABAP. I need to call a java class (a chart drawing library) from ABAP or from a BSP. What is the best way to do that ?
    Basically I would create an object, pass data from a database and then get some binary data from that object (an image).
    Hope you can help me
    Sincerely,
    Olivier Matt

    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    check the above  link and this forum too
    Call Java Class and Methods from ABAP

  • How to call a RFC function from ABAP to external C/C++ system

    Hi
    Can some one describe me what are the steps that needs to be done to call a RFC function in external C++ system and to handle errors.
    Any previous experience,please share

    Hi,
    i think this is the wrong Forum.
    Better use the SAP NetWeaver .NET Technologies Forum on this site.
    Henning

  • Call Java Pgm from ABAP

    Hi All,
    I need to call a Java function from ABAP. Currently i work on client machine and i have a sample java program with me. What do i need to do in order to execute that Java program from ABAP se38 program?
    1. Should i place that java program on server in order to execute?
    2. How to maintain RFC Destination in SM59? what is meant by program id and gateway mentioned in in SM59 under create option.
    Can some one help me with this regard?
    Points will be awarded!!
    Thanks in advance,

    ://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/59ef6011-0d01-0010-bfb0-b51381e00509
    http://www.erpgenie.com/abap/bapi/example.htm
    Reward points if it is useful...

  • 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 object from Web dynpro ABAP application?

    I made Web dynpro ABAP application and posted it to SAP EP.
    For certain business purpose, we need to call external 3rd party java object using 3rd party's java api in Web dynpro application.
    Is there anybody who experienced this kind of java interface issue?
    I know Web dynpro Java environment can fully support this kind of requirement. but regarding Web dynpro ABAP, I couldn't find any clue for this.
    Any comment or suggestion would be greatly appreciated.
    Thanks,
    Raymond, ABAP Consultant

    if you have jco configured, then you can make calls to java api from ABAP .
    check out this weblog.
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    Raja

  • Problem while calling java function from html

    when i tried to call a java function from html i'm getting an error
    object don't support this property.
    what could be the reason.
    This is my html.
    I got this from this forum only.
    My applet is accessing the system property "user.home".
    I ran it in IE
    <DIV id="dvObjectHolder">Applet comes here</DIV>
    <br><br>
    <script>
    if(window.navigator.appName.toLowerCase().indexOf("netscape")!=-1){ // set object for Netscape:
         document.getElementById('dvObjectHolder').innerHTML = " <object ID='appletTest1' classid=\"java:test.class\"" +
    "height=\"0\" width=\"0\" onError=\"changeObject();\"" +
              ">" +
    "<param name=\"mayscript\" value=\"Y\">" +
    "<param name=\"archive\" value=\"sTest.jar\">" +
    "</object>";
    }else if(window.navigator.appName.toLowerCase().indexOf('internet explorer')!=-1){ //set object for IE
         document.getElementById('dvObjectHolder').innerHTML = "<object ID='appletTest1' classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"" +
              " height=\"0\" width=\"0\" >" +
              " <param name=\"code\" value=\"test.class\" />" +
         "<param name=\"archive\" value=\"sTest.jar\">" +
              " </object>"
    </script>
    <LABEL id="lblOutputText">This text will be replaced by the applet</LABEL>
    <BR>
    <input value="Javascript to java" type=button onClick="document.appletTest1.fromJavaScript()">

    I tried this example using the repy given to an earlier post.
    But its not working with me.
    What i did in addition was adding plugin.jar to classpath to import netscape.javascript.*;
    Let me add some more details
    1) I'll add the stack trace
    2) my java progrma
    3) batch file to sign the applet.
    1) This is the stack trace i don't know whether u will undertand this
    load: class test.class not found.
    java.lang.ClassNotFoundException: test.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.FileNotFoundException: C:\FastranJava\AppletObject\bin\test\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Exception in thread "Thread-5" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    2) Java Program
    import netscape.javascript.*;
    import java.applet.*;
    public class test extends Applet
         private JSObject win;
         private JSObject outputLabel;
         private boolean buttonFromJavaClicked=false;
         checkJavaScriptEvent evt=new checkJavaScriptEvent();
         public void init()
              try
                   evt.start();
                   win=JSObject.getWindow(this);
                   outputLabel=(JSObject)win.eval("document.getElementById('lblOutputText')");
                   outputLabel.setMember("innerHTML", "<center><h1>From Init<br>Your Home directory" + System.getProperty("user.home") + "</h1></center>");
              catch(Exception e)
                   e.printStackTrace();
         public void fromJavaScript()
              buttonFromJavaClicked=true;          
         public void fromJavaScript2()
              System.out.println("Started Form JavaScript2");
              try
                   String strLbl="<center><h1>From JavaScript<br>Your Homedir:" + System.getProperty("user.home") + "</h1></center>";
                   outputLabel.setMember("innerHTML", strLbl);
              catch(Exception e)
                   e.printStackTrace();
         class checkJavaScriptEvent extends Thread
              public void run()
                   while(true)
                        if(test.this.buttonFromJavaClicked)
                             System.out.println("OK buttonfromjava is true");
                             test.this.buttonFromJavaClicked=false;
                             fromJavaScript2();
                        try
                             Thread.sleep(3000);
                        catch(Exception e)
                             e.printStackTrace();
    3) Batch file
    del *.cer
    del *.com
    del *.jar
    del *.class
    javac -classpath ".;C:\Program Files\Java\jre1.5.0_06\lib\plugin.jar" test.java
    keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass password -storepass password
    jar cf0 test.jar *.class
    jarsigner -keystore harm.com -storepass password -keypass password -signedjar sTest.jar test.jar harm
    del *.class

Maybe you are looking for

  • Javascript to access a field default value?

    Hi, I'm working on a 'enter' event for text fields such that if the field contents are still on their default value, it will immediate (hence the enter) clear out, but if the contents have already been changed it will let the user simply edit their c

  • POC Weight on basis of Activity Duration

    Hi Experts, I need POC weight to be assigned on the basis of activity duration, can any one tell me which BADI / BAPI should be used for the purpose. Thanks & Regards, Murtaza

  • Messeging to a Group of Contacts

    Hi, It's quite time consuming to send a messege to a large no. of people. How do we send msg to a group of contacts using Nokia PC Suite???

  • Writing an error handler package

    I want to standardize on an error handling package, with a record type declared that is anchored to a table. Some obvious attributes I can think of for the table are the following: 1. Time stamp 2. The package that threw the error 3. The method that

  • How to get the free 6 months xsplit gamecaster

    can anyone help me with that