on ‎2011 Jun 07 10:00 AM
Hi folks,
my first goal is to achieve a remote function call from Java to SAP or the other way.
My first attempt is a Java application which does a RFC to a SAP ABAP function that returns me some database data, but more about that later.
The first thing where i already fail is to build up a simple connection between Java and SAP.
I tried it with JCo v2.1.x and JCo v3.x (Which version should i prefer? are there advantages, disadvantages?)
Here are the two approaches:
{JCO v2.1.x}:
JCO.Client myConnection = JCO.createClient("001",
"***",
"****",
"DE",
"***",
"00");
myConnection.connect();
...
...I get a "(103) RFC_ERROR_LOGON_FAILURE: Userid or password incorrect". I put in my normal SAP GUI account. Its not an admin account but i can create reports etc in the ABAP Editor.
I checked the spelling several time and it should be ok. Why does it say incorrect user or password?
Is this possible because of insufficient rights?
{JCo v3.x}:
I just tried the "StepByStepClient" example included in the sapjco3 download and i saw that every connect function begins with a "JCoDestination destination = JCoDestinationManager.getDestination(String);" line.
But what exactly does this getDestination function do? What string do i pass there? In the example is it JCoDestinationManager.getDestination("ABAP_AS_WITHOUT_POOL"); but then i get the error: ""(106) JCO_ERROR_RESOURCE: Destination ABAP_AS_WITHOUT_POOL could not be created:"..
Can anyone explain me how this works?
Thanks in advance!
Request clarification before answering.
Well as far as calling a RFC from java is concerned....below is code that worked fine for me.
JCO.Client connClient = null;
IRepository mRepository;
connClient = JCO.createClient("<SAP Client>","<UserId>","<Password>","EN","<Application server host name>","<system number>");
try {
connClient.connect();
} catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}
mRepository = new JCO.Repository("Hell", connClient);
JCO.Function strHELLO = mRepository.getFunctionTemplate("ZSAU_FM_ASSIGNMENT").getFunction();
JCO.ParameterList importParam = strHELLO.getImportParameterList();
importParam.setValue(val,"ZMATNR");
try {
connClient.execute(strHELLO);
}catch (JCO.AbapException ex)
{
}Make sure you have followed procedure mentioned under:
http://help.sap.com/saphelp_nw04/helpdata/en/47/80f671ee6e4b41b63c0fe46bd6e4f8/content.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.