cancel
Showing results for 
Search instead for 
Did you mean: 

Connection between JCo and XI

Former Member
0 Kudos

Hello,

I want to establish a connection between an external java program which uses JCo to XI. However, it doesn't work. I'm not able to get a connection between java program and XI.

Can anybody help me in this case?

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

Hi Sabrina,

If I understood it correctly, you want to send data from your java appication to the XI, but I am not able to understand, why do you need to use RFC.

You have two option :

1. Use java proxies to send data from your application to XI directly

2. Code java program to send an http request with the payload for your message.

Regards,

Naresh

Former Member
0 Kudos

Hello all,

We don't want to send IDocs to XI, we want to send any data to XI from an external NON-SAP server, which executes an Java program.

Right now, we have an working connection, however, we are not able to send any data to XI neither to SXMB_MONI nor WE05.

The socket solution is due to security reasons not quite a good solution.

Thanks and regards.

Sabrina

Former Member
0 Kudos

might give some good information to you..

also , I wonder what exactly you are trying to do...If you are posting an IDoc to XI directly , it means that the IDoc processing would be done by the XI ABAP stack and to the best of my knowledge , the middleware capabilities of XI do not come into picture anywhere..if your intention is to post the IDoc to a target system from your Java program then you could very well do that directly. No need of XI in between. And if you must use XI, then simply create an xml file which XI would pick up and let XI post the IDoc into target R/3

Former Member
0 Kudos

Hey,

If you want to send any data to XI ,

You can directly send the xml payload , to the XI server, using socket programming in Java,

I Guess ..tht JCO is not necessary here...

...JCO is commonly used in UDFs..for accesing R/3 data via RFC...

Hope this helps ,

Regards ,

Sushil Hadge

Former Member
0 Kudos

Hello,

Thanks for your answer.

However, I'm looking for a solution to send messages from an external non-SAP system to XI, directly into SXMB_MONI. Without any RFC's on XI.

Right now, we have a working connection, but not able to send messages to XI.

Can anybody help me?

Thanks and regards.

Sabrina

Former Member
0 Kudos

Hi Sabrina,

if you want to use IDocs then your non sap system has to call on XI the function module IDOC_INBOUND_ASYNCRONOUS to create an IDOC, and you will see it in SXMB_MONI and it will be threated as a normal idoc incoming from an SAP system.

Kind Regards,

Sergio

Former Member
0 Kudos

Hi all,

I´m the colleague of Sabrina who wanted to send some data to her XI system. Like Sabrina said we created already the connection.

I tried then to create a simple JCO.Function(String name) with name "IDOC_INBOUND_ASYNCRONOUS" in my JCO client program and then executed it :

mConnection.execute(function);

It didn't work and returned "RFC_ERROR_SYSTEM_FAILURE: JCO.Server could not find server function 'IDOC_INBOUND_ASYNCRONOUS".

Then I tried to query the function via JCO.Repository like following:

mRepository = new JCO.Repository("IDOC_INBOUND_ASYNCRONOUS", mConnection);

JCO.Function function = mRepository.getFunctionTemplate("IDOC_INBOUND_ASYNCRONOUS").getFunction();

It returned again an error "JCO_ERROR_INTERNAL: Wrong repository version = 0 encountered".

Any idea why ??

@Sergio : in case i could call the function successfully, which parameters (JCO.ParameterList) should I send (maybe an IDoc which this function will convert to Idoc and forward to SXMB_MONI) ? I mean here the parameter name. Is there any other way to send an object to XI ?

Anyways, thanks alot

Regards,

Khoa

Former Member
0 Kudos

Hi Dinh,

Here is a sample code I used to test the communication calling function module THPOPUP.


client = JCO.createClient( ...);      

// Open the connection
client.connect();

// Get the attributes of the connection 
JCO.Attributes attributes = client.getAttributes();

boolean is_backend_unicode = attributes.getPartnerCodepage().equals("4102") ||
                                   attributes.getPartnerCodepage().equals("4103");

// Create metadata definition of the input parameter list
JCO.MetaData input_md = new JCO.MetaData("INPUT");
input_md.addInfo("CLIENT", JCO.TYPE_CHAR, 255, 255 * (is_backend_unicode? 2 : 1 ),-1, 0, null, null, 0, null, null);
input_md.addInfo("USER", JCO.TYPE_CHAR, 255, 255 * (is_backend_unicode? 2 : 1 ),-1, 0, null, null, 0, null, null);
input_md.addInfo("MESSAGE", JCO.TYPE_CHAR, 255, 255 * (is_backend_unicode? 2 : 1 ),-1, 0, null, null, 0, null, null);

// Create the input parameter list from the metadata object
JCO.ParameterList input = JCO.createParameterList(input_md);

// Set the first (and only) input parameter
input.setValue("020", "CLIENT");
input.setValue("USERNAME", "USER");
input.setValue("TEST MESSAGE", "MESSAGE");

// Create metadata definition of the output parameter list
JCO.MetaData output_md = new JCO.MetaData("OUTPUT");

// Create the output parameter list from the metadata object
JCO.ParameterList output = JCO.createParameterList(output_md);

// Call the function
client.execute("TH_POPUP", input, output);

I suggest you to have a look at the sample code named Example1 that is delivered with jco library.

Probably there are also higher level functionality to send the idoc via jco (that hide you the call to that function module), using something like IDOC.create() or IDOC.send() but I have never used them because when I worked in this kind of scenario I had to call a RFC, not to send and idoc, via jco.

Instead I sent Idoc to XI from a non sap system that was built on RFC sdk (similar to jco) and we posted IDOCs to XI via function module IDOC_INBOUND_ASYNCRONOUS.

Dinh, the reason why the Idoc will be sent to the application layer of XI (SXMB_MONI) and not to the below ALE layer (WE05) is that in XI any call to the function module IDOC_INBOUND_ASYNCRONOUS is catched by the application layer.

Consider that when an SAP system has to send an IDoc to another SAP system it calls as well that function module (IDOC_INBOUND_ASYNCRONOUS) to send the IDoc

So once you call that function module the idoc is created in XI and is a normal XI IDoc scenario.

Hope it clarify your doubts,

Kind Regards,

Sergio

Former Member
0 Kudos

Hello,

Thanks for your help. We are now able to establish a connection between the external system an XI. However, I receive no message on XI. My colleague tries to send a message via JCo.Idocument (I hope, this is correctly explained, I have no experience in JCo).

Can you help me here again?

Thanks and regards.

Sabrina

Former Member
0 Kudos

Hi !!

In my opinion (I am an XI beginner), to connect JCO to XI, the scenario should be:

JAVA connects to a SAP or XI host that has an RFC created. Then via JCO your java program should call that RFC, send the import parameters and execute it. That RFC should send its response to XI RFC Adapter.

Check this blog or any other with an RFC-XI connection (RFC as sender!)

/people/shabarish.vijayakumar/blog/2006/03/23/rfc--xi--webservice--a-complete-walkthrough-part-1

Hope it helps

Matias.

Former Member
0 Kudos

Hi Sabrina,

Could you explain your scenario a little better?

cheers,

Prashanth

Former Member
0 Kudos

Try reading this recommendation:

http://searchsap.techtarget.com/tip/1,289483,sid21_gci805674,00.html

THere's some Java code available in the above link...

You need to download some JCo dlls from here: http://service.sap.com/~form/sapnet?_SHORTKEY=01100035870000463654&;

Former Member
0 Kudos

Hi Sabrina,

you should create a client using JCO.createClient(XI host,XI sap gateway, program id);

Then create an RFC adapter of type sender and use the same program id as defined in jco.

In this way via JCO you can directly call to an RFC communicational channel.

Hope it helps,

Regards,

Sergio