cancel
Showing results for 
Search instead for 
Did you mean: 

Call java from ABAP

Former Member
0 Kudos

Hello,

the JCo Tutorial says that

"...both inbound (Java calls ABAP) and outbound (ABAP calls Java) calls are possible..."

But I didn`t find any informationen about calling Java functions from ABAP.

Does anyone found some information about this topic and / or can give me an example how to call Java from ABAP?

Kind regards,

José

Accepted Solutions (0)

Answers (5)

Answers (5)

ahabashi
Explorer
0 Kudos

hi gregor,

I know its been quite long since u have posted this article, Can you please send me some examples.

or if anyone has implemented this type of connection with examples. habashi.akram@gmail,com

Best Regards

Former Member
0 Kudos

Hello,

I use

srv[0] = new Server("localhost","sapgw00","JCOSERVER01",repository);

but return error message:

ERROR partner not reached (host localhost, service 3300)

Can anyone help me?

Best Regards

gregorw
Active Contributor
0 Kudos

Hello,

is your SAP Application Server running on your local machine?

Regards

Gregor

Former Member
0 Kudos

Thanks , yes it is my mistake. I change the "localhost" to SAP AS ip,and it works now.

Thanks a lot!

With best regards.

gregorw
Active Contributor
0 Kudos

Hello,

have a look at the Example5.java and Example7.java files coming with the SAP Java Connector. They are implementing a JCo Server which registers to your SAP System and could be called like a RFC enabled function module.

Regards

Gregor

Former Member
0 Kudos

Hi there,

can someone help to configure the destination with sm59 in the R/3? Which type must I choose?

Do any ABAP codings exist for the examples 5 & 7?

It seems to me, that the documentation in the topic "Outbound RFC Calls" is not quite precise.

Kind regards,

Henric

gregorw
Active Contributor
0 Kudos

Hello Henric,

you find the answers in this <a href="/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection">Weblog</a> I've just posted.

Regards

Gregor

0 Kudos

Hello,

is it possible to connect directly to application server.

I would like to test jco.server on my local was installation.

Which connection string do i need for?

Thank you in advance

Andrei

0 Kudos

Got It

should use

srv[0] = new Server(String[][] param,repository);

instead of

srv[0] = new Server("gateway","sapgw00","JCOSERVER01",repository);

gregorw
Active Contributor
0 Kudos

Hello Andrei,

I think you should use that:

srv[0] = new Server("localhost","sapgw00","JCOSERVER01",repository);

or what is the system Number of the local Web AS?

Regards

Gregor

Former Member
0 Kudos

Hi Gregor,

I have tried your weblog regarding example 5 and it works.

However, when I try to modify the ABAP program to use transactional RFC, I won't get a response from the Java application.

I wrote something like:

CALL FUNCTION 'STFC_CONNECTION'

in background task

DESTINATION 'JCO'

as separate unit

EXPORTING

requtext = requtext.

This is because I need the Java application to process the required task asynchronously from the SAP system.

Or is transcational RFC not supported for calling an external system?

Best Regards,

Junwen

Former Member
0 Kudos

Hi!

I'm a keen Java-Programmer and also not authorized to access this page (http://service.sap.com/connectors), for what I wanted to ask the question if somebody else is be able to provide me the SAP-Java Connector.

(Also against payment!)

Friendly Regards

gregorw
Active Contributor
0 Kudos

Hello Hüseyin,

AFAIK only as a SAP Partner or Customer you are permitted to download the JCo.

Regards

Gregor

Former Member
0 Kudos

hi gregor,

i know its been quite long since u have posted this article. but i am not able to get the import parameters in my java program (listener on the server). the return value gets sent properly.

i have program which passes parameters to the function module . niether i am able to get values from import parameter nor from table values. i have trying for quite some time now

REPORT ZTEST_KUMAR.

DATA : W_RET TYPE char255.

DATA : w_val TYPE char255,

itab TYPE TABLE OF ZTEST_PDF,

wa TYPE ZTEST_PDF.

wa-CUST1I = 'TESTS'.

wa-TEMP = 'ALLLL'.

append wa to itab.

w_ret = 'skasnask'.

w_val = 'djsdjsdsd'.

CALL FUNCTION 'ZTEST_PDF_CREATE' DESTINATION 'GNJ2EEGCD'

EXPORTING

TEST = w_val

IMPORTING

RETURNVAL1 = w_ret

TABLES

TEST_TABLE = itab.

WRITE W_VAL.

WRITE W_RET.

--


java program handle request--

protected void handleRequest(JCO.Function function)

{

if (function.getName().equals("ZTEST_PDF_CREATE")) {

try{

JCO.ParameterList input = function.getImportParameterList();

JCO.ParameterList output = function.getExportParameterList();

JCO.ParameterList tables = function.getTableParameterList();

JCO.Table table1 = tables.getTable(0);

System.out.println(input.getValue("TEST"));

//String importval = input.getValue("INPUT").toString();

output.setValue("KUMAR212", "RETURNVAL1");

justin_thomas
Explorer
0 Kudos

Hi there - I know this is a bit late, but I have such a document! If you'd like to send me an email, I'll reply with it as an attachment:

justin.thomas@sap.com

Former Member
0 Kudos

Hi Thomas,

I am trying to call JAVA program from ABAP.Could you please share the document you have on email  my id rcpatil18@gmail.com.

Thanks,

Reshma Patil.

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

For short I can explain what the trick is:

You need a connection that is already up. For this purpose there is a service in the Engine that can bring up and keep such a connection. Then you have to use an ABAP program that is a RFC to call such connection.

Please watch our docs at http://help.sap.com