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 Kumar
Hi 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
Similar Messages
-
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 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 -
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 -
How to call Java API from BSP?
I have a requirement to call Java API from BSP application.
I have checked the forum and found that it is possible by using some ABAP codes.
However there is no pointer on how this is done.
Can someone explain the details on how to call Java API from BSP is done?
I found class CL_EJB_JAVA_OBJECT_METHODS to call a method in EJB but can't find function or SAP class to call Java API.
Actually is there any BSP extention which can used to call Java API?
Thanks,
Hendricheck out these weblogs, it should give you an idea how to go about it.
/people/ignacio.hernndez/blog/2006/12/04/speech-synthesis-listen-the-application-server-is-talking-to-you
/people/puru.govind/blog/2006/12/20/let-abap-speak
Regards
Raja -
Java API from ABAP program.
Hi
I have a requirement to call a Java API from ABAP program.
We are using a third party component for encrypting the files
using Java API The component consist of ".jar" files. I need to
know exactly where we need to copy the ".jar" files on application server,
so that I can call the API methods in my ABAP code and process the file in SAP,
and how to establish a connect with there server for the encryption.
Thanks
Regards
LalithLInk is:
/people/puru.govind/blog/2006/12/20/let-abap-speak?page=last&x-maxdepth=0 -
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 -
Calling java APIs from a function module
Hi,
Can someone tell me whether it is possible to call Java APIs from a function module in SAP system?
Thanks in advance,
VineethaHi,
I guess you have changed the properties of screen only.
I assume you have made a Ztransaction Code.
When you define a transaction code, you need to specify a screen number for radio option program and screen and you need to specify a screen and not subscreen.( I think so!!)
You changed only the code without changing the transaction code properties.
Therefore, i think u r getting a dump.
If you want to call your subscreen, call it in some screen and then call that screen using your transaction code properties.
To include a subscreen screen in the subscreen area of the main screen and call its PBO flow logic, use the following statement in the PBO event of the main screen:
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN <area> INCLUDING <prog> <dynp>.
To call the PAI flow logic of the subscreen screen, use the following statement in the PAI flow logic of the main screen:
PROCESS AFTER INPUT.
CALL SUBSCREEN <area>.
Refer:
http://help.sap.com/saphelp_webas630/helpdata/en/9f/dbabfe35c111d1829f0000e829fbfe/content.htm
Regards,
Tanveer.
Please mark helpful answers.
Message was edited by: Tanveer Shaikh
Message was edited by: Tanveer Shaikh -
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,
Siddharthahello 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 -
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 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 -
Calling external Java from ABAP using JCo?
Does anyone know if one can use JCo to write a server application that can be called from ABAP.
We are presently using JCo to communicate from Java to SAP.
But we need to call an external Java program from within ABAP.
Is this possible?
Thanks for any input.
FredHi Gregor,
I was hoping you would reply to this -- these posted messages had been here for quite sometime now.
Anyway, here's the case. Our Basis team is installing the JCo in our SAP development server. This is our first time to implement this technology, so no one has a clue at all.
Got a couple of questions for you...
1. What do we need the JDK for? Is it mainly for editing, running, and compiling java files (e.g. Example5.java)?
2. Does the JDK need to be installed at the SAP server as well? Or it doesn't matter, as long as the java files will be accessible from where it was installed at?
Thanks for any response! -
Calling Java APIs from Adobe AIR Front End
HI ,
I have developed an desktop application entirely in java.
Currently it is console based, but i am planning to have a UI for the same in Adobe Flex.
I wanted to know how do I communicate between the two, ie call methods that are defined in my java classes from AIR and return results to Adobe AIR.
There is no server involved.
I want to keep Adobe AIR as front end and Java as back end which will take care of the business logic .
Thanks and Regards,
SantoshiThe best way is probably to use the NativeProcess APIs available in AIR 2 (now in Beta).
Next, would be to use sockets to communicate between the two processes. In AIR 1.5, it is difficult to guarantee that both processes are running, at least when controlling thins from the AIR side rather than the Java side. In AIR 2, you can start other processes, so this is also easier.
There are some 3rd party tools, like Merapi, that help you pass objects between Java and AIR, too. -
Hi guys,
I’m trying to use Java API to update ASO cube from Planning forms. So there are several steps:
1. Planning form passes variables to HBR
2. HBR passes variables and calls Java CDF
3. CDF performs some operations and uses JAPI classes to update ASO cube.
When I run CDF as runtime command or from JDeveloper/Netbeans if works fine. When I run CDF from HBR but do not use JAVA API methods it works too. But when I call CDF from HBR AND use JAPI methods it doesn’t execute JAPI methods. I do not receive any error; methods that use JAPI methods are simply not executed.
Any ideas why it happens?
Thanks,
DmitryHi,
Have you tried running it from an essbase calc script first and run the essbase server in the foreground (not as a service if you are on windows) then if you have any System.out.prints on errors or in your code they should be outputted to the window.
It usually easier to get it running from a calc script first because you sometimes get better messaging than business rules.
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
Converting Relational Tables to Object Views
We have extra information stored for each field in a table. We call these Vertical Tables: rowid primary key - ties to normal tab column_name "" - ties to column in "" text_value the value if text reliability rating for level of accuracy... date of e
-
Creative Suite 5.5 Master Collection.. HELP
I have the disks for Creative Suite 5.5 and the key, however the new computer I have does not have a DVD/CD drive on it, How can I download this suite to my new computer?? It does have a spot for Flash drive and Memory Card, Am I allowed to download
-
Dear Experts, We have a mail form with Survey URL, we tested it via TEST SEND functionality. However when we send the mail form in french we get MIG generated in the mail, but when we select dutch language while TEST SEND , there is no MIG and hence
-
Hi I'm currently setting out to convert a multimedia file I developed in Flash to something that can be viewed on ipad......an exercise that seems to be more painful than I was expecting. It involves videos and slides that come together to create a t
-
Apple: Please update the iOS and fix the battery issue. My brand new iphone5 went from lasting 3 days to lasting 18 hours or standby. You've introduced a battery bug in there as you tried to fix the Wifi issue. thanks.