on 2003 Nov 10 4:55 PM
Hi all,
I'm in search of a tutorial explaning how to use the SAP Java Connector for developing server functions in Java. I want to call Java methods from within an ABAP program. What are the prerequisites for this scenario?
Reading the JCo description, this should be possible somehow, but I couldn't find any documentation on this topic. <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/sap%20java%20connector%20-%20jco%20-%20client%20programming">Thomas Schuessler's JCo course</a> ist very useful, but deals only with client programming.
Regards,
Klaus Hummel
Hi Klaus,
the docs for JCO are available on help.sap.com. Unfortunately I could not find the docs for thius purpose there and it may be that it is not available yet.
Regards,
Benny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Klaus:
Here's an overview of calling a Java program from ABAP:
The Java program can have as many IMPORTING / EXPORTING parameters as you like, but they must all be of type CHAR[255].
Define your Java server system RFC destination via transaction SM59. Define the Jco server in JCOServers.xml. Define the java classes to be called in JCOCommands.xml, mapping the java class to the ABAP function module.
The ABAP function module is an RFC-enabled function module that really just acts as a pipeline to the java class for the parameters; sample code is below:
FUNCTION Z_CALL_JAVA_CLASS.
*"----
-
""Local interface:
*" IMPORTING
*" VALUE(IV_PARAMETER1) LIKE SY-LISEL
*" VALUE(IV_PARAMETER2) LIKE SY-LISEL
*" VALUE(IV_PARAMETER3) LIKE SY-LISEL
*? ?????
*" EXPORTING
*" VALUE(EV_PARAMETER1) LIKE SY-LISEL
*" VALUE(EV_PARAMETER2) LIKE SY-LISEL
*"----
-
Does nothing! Acts as a pipeline.
ENDFUNCTION.
Then in your main code, call the function module passing and receiving the appropriate parameters. Specify the SM59 system as the destination (in this example the system is "JCOSERVER". The function module will potentially return exceptions for communication failure or other system error. Any other errors returned from the java class must be passed via parameters. Sample code is below:
call function 'Z_CALL_JAVA_CLASS'
destination 'JCOSERVER'
exporting
iv_parameter1 = p1
iv_parameter2 = p2
iv_parameter3 = p3
???..
importing
ev_parameter1 = r1
ev_parameter2 = r2
exceptions
communication_failure = 1
system_failure = 2
others = 3.
Regards,
D.
User | Count |
---|---|
67 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.