on 2006 May 02 11:09 AM
Hi!
I need to develop a Java Client for SAP with access to the SAP database. Is there a way to do this directly in Java (the db access) or do I have to use some ABAP logic in between to get the information to the java client? If so, are there any existing ABAP functions to read AND write db tables? Or do I have to create my own wrappers for each table I need to read and write?
Thanks,
Konrad
HI
GOOD
GO THROUGH THE FOLLOWING LINKS.
https://www.sdn.sap.com/irj/sdn/developerareas/java?rid=/webcontent/uuid/f66c5494-0901-0010-fbbf-ad8... [original link is broken]
http://www.persistentsys.com/presentation/Java_SAP_Integration.pdf
THANKS
MRUTYUN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Thanks so far...
The second link is a pdf about JCO... but I cannot see how to access the SAP db in there. I know how to run BAPIs but I do not know how to access the db. I need something like SQL...
The first link shows more about this stuff but I think this is some different technology than JCO, isn't it? If so, how can I develop a java client using this technology for a SAP R3 system?
Hi Konrad,
Did you get any solution on accessing SAP database schema from a java client. We too have a similar requirement. Please do let me me know if you have any identified any solution.
Regards
Vinay Rane
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Konrad,
Usually there is no way round using RFC wrappers.
SAP uses some layer above the database for caching and locking so if you want to avoid inconsistencies better go the official way.
These tables you have to access: I guess they exist for some purpose. Isn't there business functionality that you could simply reuse?
If there is no functionality on top of these tables of course you can simply access the tables directly using e.g. plain JDBC.
Regards
Markus
Well it all depends on the logic behind the tables and the way they interact with the regular SAP application. If the tables do not interact at all but are just supplements and you are writing a maintenance application you just [might] get away with directly accessing them through JDBC.
However in view of where they reside and how the logic interacts with the rest of SAP you would surely be better off writing your own BAPIs to interact with the additional tables in an object coherent manner.
Enjoy
hi,
i am sending code .i think it will help u
try {
// Add a connection pool to the specified system
// The pool will be saved in the pool list to be used
// from other threads by JCO.getClient(SID).
// The pool must be explicitely removed by JCO.removeClientPool(SID)
this.objClient = JCO.createClient(strClient, // SAP client
strUserID, // userid
strPwd, // password
strLang, // language
strHost, // host name
strSysNr);
this.objClient.connect();
// Create a new repository
// The repository caches the function and structure definitions
// to be used for all calls to the system SID. The creation of
// redundant instances cause performance and memory waste.
this.objIRepository =
JCO.createRepository("MYRepository", this.objClient);
} catch (JCO.Exception ex) {
System.out.println("Caught an exception: \n" + ex);
}
JCO.Function objFunction =
this
.objIRepository
.getFunctionTemplate("BAPI_MATERIAL_AVAILABILITY")
.getFunction();
objFunction.getImportParameterList().setValue(strPlant, "PLANT");
objFunction.getImportParameterList().setValue(strMaterial, "MATERIAL");
objFunction.getImportParameterList().setValue(strQuantity, "UNIT");
this.objClient.execute(objFunction);
JCO.Structure ret =
objFunction.getExportParameterList().getStructure("RETURN");
String strRetMsg = ret.getString("MESSAGE");
if (strRetMsg.equals("Unit is not created in language")) {
arrResult.add("error");
return arrResult;
} else {
String strQty1 =
objFunction.getExportParameterList().getString("AV_QTY_PLT");
if (strQty1.equals("0"))
result = "no";
else
result = "yes";
arrResult.add(result);
return arrResult;
}
}
/**
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
IF you are referring to DB Tables then JCO is not the right solution , since JCO is used for accessing Function Module /BAPI written in ABAP .
Let me take certain consideration :
1)If you requirement is that you have to access the SAP data directly then through java you can directly access it using JDBC Connectors
2) If you want to use ABAP specific FM which do this processing( fetching data from SAP specific database tables ) then JCO is the right option.
All depends on ur spefic requirement .Can you please be more specific about your requirements ?
hope this solves your confusion, Please do not forget to reward points .
regards
rajesh kr
Hi!
My requirements are:
- the software should run as external java client (should be triggered/started out of SAP)
- it must be able to access database tables of SAP (read and write access)
- it must be able to create SAP objects like documents, material masters
If it is possible, I would like to access the database directly via SQL (all tables involved are customer created tables and not SAP tables) and create the SAP objects using JCo.
Tell me more about this jdbc connector. Is it possible to access tables directly with it also if the tables are in the abap schema or only if they are created in s special java schema?
Thanks,
Konrad
Hi Konard,
I think for that anyway you will have to use JCO as the middleware to connect to SAP R/3.
So what you can to do is to write three RFCs and call them through JCO from your JAVA application.
1. First BAPI for reading the dictionary information about an SAP table.
2. Second to read data from the table.
3. And, third to write data to that table.
But if you want to edit any table (and not a specific table) then your program will become even more complex since then you will have to pass the table name and information dynamically to the BAPIs.
Best regards,
Guru.
Dou you mean 3 RFCs for all tables or for each table. We are talking about 40 tables here. My plan was to create one function for each table and pass the db table as "tables" parameter to the java application. Another import parameter specifies the action in the RFC. Can be either "Insert", "Update", "Read" or "Delete" and within the java code I can modify the table, add, update or delete rows...
I would realy like to use ONE RFC for all tables but I don't know how...
Thanks,
Konrad
Hi Konrad,
I think you would have to create wrappers..
I dont think there SAP database tables are remotely accessible..
Its possible only in case of Internet Prive Configurator(IPC) in SAP-CRMm where the database tables are accessible via java programs..
For JCO, you would have to call BAPI's or remotely enabled function moudules...
Regards,
Tanveer.
Please mark helpful answers..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
13 | |
11 | |
10 | |
9 | |
9 | |
6 | |
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.