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
Similar Messages
-
Calling Java API from ABAP using JCo
I need to call Java API from ABAP & BSP also. For this I have got useful information related to JCo from following blog:
/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
But, I am facing one problem. On executing Java program myExample5.java (recommended by Gregor Wolf) from command line I get following error message:
Server JCOSERVER01 changed state from [ STOPPED ] to [ STARTED ]
Exception in server JCOSERVER01:
com.sap.mw.jco.JCO$Exception: (129) JCO_ERROR_SERVER_STARTUP: Server startup failed at Thu Apr 26 13:46:32 IST 2007.
This is caused by either a) erroneous server settings, b) the backend system has
been shutdown, c) network problems. Will try next startup in 1 seconds.
Connect to SAP gateway failed
Connect_PM TPNAME=JCOSERVER01, GWHOST=gateway, GWSERV=3300
LOCATION CPIC (TCP/IP) on local host
ERROR hostname 'gateway' unknown
TIME Thu Apr 26 13:46:32 2007
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -2
MODULE ninti.c
LINE 336
DETAIL NiPGetHostByName2: hostname 'gateway' not found
SYSTEM CALL gethostbyname_r
COUNTER 1.
Can anyone please help me out. Do I need to do any setting?
I'll surely reward points.
Thanks & Regards,
Nilesh KumarHi Nilesh,
From the error i think that the error is with the hostname.
Please enter the the Application Server IP/Hostname.
If you are loggin to SAP System "XX1" from SAP GUI. Then click the change Item tab and see Application server name/IP let say "XX2" for hostname or "xx.xx.xx.xx" for IP.
Replace <i>srv[0] = new Server("gateway","sapgw00","JCOSERVER01",repository);</i>
with <i>srv[0] = new Server("XX2","sapgw00","JCOSERVER01",repository);</i>
If App Server is IP then replace with
<i>srv[0] = new Server("xx.xx.xx.xx","sapgw00","JCOSERVER01",repository);</i>
Let me know if it is throwing any error.
Thanks,
Prashil -
Calling Java API from ABAP using JCo (Part 2)
Hello,
This is an additional question to thread Calling Java API from ABAP using JCo
Has anyone managed to get the input parameter value
input.getString("REQUTEXT")
that is being passed from ABAP?
If yes, what kind of setting you need to do? Because when I execute, it has no value.
Thus, the below ECHOTEXT parameter returns blank value:
output.setValue(input.getString("REQUTEXT"),"ECHOTEXT");
When I debug by printing the below line, the input XML is indeed without value:
System.out.println(input.toXML());
Anybody knows how to pass input variable from ABAP to JAVA using JCo?
rgs,
hiroshiHallo Hiroshi,
as far as I can see, you are doing it the right way. The problem might be that the ABAP program does not fill in this parameter because something went wrong in the SAP System.
Have you tried setting a breakpoint (an HTTP session - remote breakpoint) and tried checking step by step if the value is being processed and put into the REQUTEXT field?
Bye,
Sameer -
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 -
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
PrincePabi,
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 -
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
pabiPabi,
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 -
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... -
Call Java function from multithreaded VC++ application
Friends, I want to call Java function from two threads of a single VC++ application. I can call it from single thread but when I call it from another thread also, JNI_CreateJavaVM() replies with an error.
Please......help meYour posting is ambiguous. My impression is that you have two threads, both trying to create a java VM?
-
Call Java Program from ABAP Program
Dear all,
In our scenario, we need to let ABAP call services provided by a standalone Java program. From online help I found some overview introduction and I'd make the called program a registered program in a RFC with type "T" (TCP/IP Connection). Can anybody give some concrete documentation? A step-by-step guide would be greatly appreciated.
Best Regards
Jeromecheck this thread
Re: Calling Java API from ABAP using JCo -
Calling java functions from c++
I want to start my program from visual c++ then, call java functions and then calling c++ function. How can i do this?
Yet another cross-poster: [Calling java functions from c++|http://www.java-forums.org/new-java/12597-calling-java-functions-c.html]
-
Calling java class from abap function moduile
Is it possible to call java class from function module.
i am a java guy. my need is to call a java class from a function module in the backend. which in turn performs certain functions.
i would be highly obliged if someone could let me know if this is possible.
regards
Srikumar VHi Srikumar ,
you can call a java webservice in ABAP .
u can call the webservice and via that u can trigger the java class..
Regards
Renu -
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 -
How to call java function from PL/sql in oracle applications
I am trying to call a java function from plsql procedure. Can any one explain how to call java function, and in which directory I have to store my java function in oracle applications. Do I need to register that java function from Application developer.
Thanks
Kranthihttp://www.oracle.com/technology/tech/java/jsp/index.html
Good Luck,
Avi. -
Newbie Help: Calling Java function from XSLT
Hi everyone!
I am trying to call a java function from my XSL file. like...
<xsl:stylesheet version="1.0"
xmlns:java="http://xml.apache.org/xslt/java"
xmlns:fn="http://www.my.com/xslt"
exclude-result-prefixes="java fn">
<xsl:variable name="embeddedpic"
select="formData/instance/EmployeePicture" />
<xsl:variable name="pic" select="fn:com.my.utils.ConversionUtils.base64DecodeString($embeddedpic)"/>I am getting this exception in calling the above java function from my XSLT (XalanXPathException: The function number 'http://xml.apache.org/xslt/java:com.my.utils.ConversionUtils.base64DecodeString' is not available.)I have the function lib file in my classpath but still i am getting this error. Any info is highly appreciated.
ThanksTry this.
<?xml version="1.0" ?>
<xsl:transform version="1.0" xmlns:fn="com.my.utils" >
<xsl:variable name="pic" select="fn:ConversionUtils.base64DecodeString($embeddedpic)"/>
etc.
as long as your code is in the classpath it should find it.
Henock.
Maybe you are looking for
-
How can I distinguish multiple computers with home sharing?
I have 2 computers which have Home Sharing turned on. When I use Apple TV it shows both computers and can play videos from both without any problems. What I cannot work out is how to change the names of the shares. They both have the same name which
-
Hello from sunny middle Tennessee. I have an iMac 400 DV SE 10-99 build, slot loader with an upgrade 60Gb hard drive and one gig of memory. I love my baby and have lots of USB and Firewire toys for her to play with. However she has lately been turnin
-
GP and WD with Adobe Interactive form question - need some guidance.
Hello experts, FYI, I'm running ECC 5.0 Support Stack 9, EP 7.0 SPS 11, NWDS 2.0.9_15 with Adobe Livecyle Designer. I am slightly stuck with what I'm trying to do. I have created a web dynpro application that has an Adobe interactive form. I'm trying
-
No sound, probably due to IDT Audio Codec
There i s no sound at my laptop. The loudspeakers are on, Windows says they are working fine. All the volumes are high, sound is not muted etc. But I have no sound anywhere. I uninstalled the drivers on IDT Audio Codec, reset the values in my bios to
-
Prepare my Wireless network for use with Windows 8
Hello My wireless network has the following: (2) Wireless ACS 5.2 (upgrading to 5.3 soon) (1) Wireless Control System 7.0.172.0 (10) Wireless Controllers AIR-CT5508-K9 7.0.116.0 (Lic level: base) Most of the (150+) AP's are i3502 with