on 02-14-2008 1:05 PM
Hi, experts.
In XI, can I use JCo to call a java program in another server?
If yes, how to do this?
Does anybody have a example?
Hi Paulo !
By definition:
SAPs new Java middleware, the SAP Java Connector (JCO) allows customers and partners to easily build SAP-enabled components in Java. JCO supports both inbound (Java calls ABAP) and outbound (ABAP calls Java) calls in desktop and server applications.
I have some ideas:
create a JCO Server program that is called from an ABAP program (could be abap mapping or just an RFC called from XI)
http://help.sap.com/saphelp_nw04/helpdata/en/09/c88442a07b0e53e10000000a155106/content.htm
expose your java functionality as webservice and then call it using SOAP from XI.
Also check SAP Java Resource Adapter
http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5caa85b11d6b28500508b5d5211/content.htm
Regards,
Matias
ps: please award points if helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Paulo,
Below is the example for JCo lookup from XI server.
In the below example i am having a Internal table with name "MATNR" in the function Module.
V_Matnr and VStorage_Location are the fields in the Internal TBALE "MATNR".
where ---> tabMatnrUsed.setValue(Matnr, "V_MATNR");
matnr is the value passed as input to function module
JCO.Repository mRepository;
JCO.Client mConnection = JCO.createClient("<Client>", // SAP client
"<USERID>", // userid
"<PASSWORD>", // password
"<LNG>", // language
"<HOSTNAME>", // host name
"<SYSNO>"); // system number
try {
mConnection.connect();
} catch (Exception e) {
// e.printStackTrace();
}
mRepository = new JCO.Repository("SAPLookup", mConnection);
IFunctionTemplate ft =
mRepository.getFunctionTemplate("<FM NAME>");
JCO.Function function = ft.getFunction();
JCO.ParameterList allTables = function.getTableParameterList();
JCO.Table tabMatnrUsed = allTables.getTable("MATNR");
tabMatnrUsed.setValue(Matnr, "V_MATNR");
mConnection.execute(function);
allTables = function.getTableParameterList();
tabBnkUsed = allTables.getTable("tabMatnrUsed");
for (int i = 0; i < tabMatnrUsed.getNumRows(); i++) {
tabBnkUsed.setRow(i);
String storageLocation =
(String) tabBnkUsed.getValue("VStorage_Location");
}
mConnection.disconnect();
In this case i used the Internal Table "MATNR" for both input and output and
"MATNR" and "Storage_Location" are the fields
appreciate if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.