cancel
Showing results for 
Search instead for 
Did you mean: 

Is it mandatory to have a SAP user account when creating a JCO Server?

Former Member
0 Kudos

Hello Gurus,

I am trying to creat a JCO Server but I got stuck and need your help.

Before creating a JCO Server, I need to know the sap gateway ip, gateway port, the technical program name as well as a repository. The Repository object cannot be null, otherwise the ABAP program cannot find the function name in JAVA.

However the Repository can only be created if the JCO server has a connection to the SAP system. That means I have to have a SAP username/password and create a client connection to the SAP. This is weird to me. Because I believe it is called a JCO server and connections must come from the SAP, not the other way.

So my question is it is necessary for my JCO Server program to establish a client connection to SAP first, so that I could serve the user from the SAP abap environment. If not, please let me know how!

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jack,

There is no need to have a client RFC connection for retrieving repository data from SAP. It is usually convenient, but if you want to have a standalone RFC server that just registers at the gateway as you described without pulling repository information from SAP. you should provide a JCoCustomRepository.

Check out the utility class JCo, where you can use method createCustomRepository() to create a repository, which you can then set as the repository for your server via the JCoServer method setRepository(). Note that you will have to "manually" add all the required meta data, for which the custom repository provides methods addRecordMetaDataToCache() and addFunctionTemplateToCache().

The corresponding meta data again can be generated by starting off with the utility methods JCo.createRecordMetaData() and JCo.createFunctionTemplate(). Please check out the JCo connector documentation as I left out all the required parameters for those methods.

Cheers, harald

Former Member
0 Kudos

Thank you very much Harald. You gave me very useful hint.

I guess you must use JCO version 3.0 because the version I am using (2.1.8) doesn't have such a method "JCoCustomRepository". However I think I can extend the JCO.BasicRepository to build my own repository according to your suggestion. Anyways, I will try it first.

Thank you again.

Former Member
0 Kudos

Yeah, I was kind of assuming that nowadays everybody's using JCo3, especially when creating new programs. One of the main reasons to switch for me was the much cleaner API and also the better implementation, which gives me much less out of memory errors (I had some client programs handling lots of data)...

Former Member
0 Kudos

Sorry to bother again.

The BasicRepository class in v2.1.8 only has a method called addFunctionInterfaceToCache(java.lang.String key, IMetaData meta). It only accepts MetaData as the parameter, not for FunctionTemplate. In this case, I cannot register the function module of my own. It is really annoying.

Former Member
0 Kudos

Well, you actually can. You just need to utilize the constructor JCO.MetaData("FunctionName") and then invoke the method addInfo() to define the function module parameters. Tried to quickly search for an example for you, I think [this link|http://93.186.177.167/mirror/beaweblogic8.1/0672324873_ch32lev1sec7.html] seems reasonable. I'd say the Java API help for the JCo is a bit confusing, because they named the parameter rec_name, though you actually specify a name of the function module in your case.

Former Member
0 Kudos

Thanks Harald,

now my jco server is working and can response to the abap request.

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Jack

I'm sorry... It seems I missed the point of the thread - I thought the question was about Java JCo RFC Provider service in Visual Admin/NWA.

BR, Siarhei

Answers (1)

Answers (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Jack Xiong

>is it is necessary for my JCO Server program to establish a client connection to SAP first

Yes, it's required. The ABAP repository connection settings are mandatory. In fact the JCO server has two possible states Stopped & Started. During a start the JCO server will connect to ABAP repository. If it's failed to connect the JCO server will not start.

BR, Siarhei