on 06-10-2010 11:40 AM
Hi,
We have created a Web service from a java class using SAP Neatweaver developer studio. The web service works fine. It takes some inputs and makes changes to a java table stored on our SAP Enterprise Portal.
We would like to add the following functionality to the web service. We want the web service to connect to our ERP system and store some values there. Our ERP has an abap function module that can accept values and make the necessary changes.
Is there a way to do so?
Thanks in advanced
Hi,
You have to add code in you java web service to either call the abap function module thru a JCO connection or to call the function module published as a web service.
Regards,
Olivier
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
We have found that we must write the following code to our web service:
Client client = JCO.createClient("200", "user", "password", "EL", "servername", "01");
client.connect();
Repository repository = new JCO.Repository("SAP", client);
IFunctionTemplate functionTemplate = repository.getFunctionTemplate("function_module");
Function function = functionTemplate.getFunction();
ParameterList parameterList = function.getImportParameterList();
parameterList.setValue("Value1", "Variable1");
parameterList.setValue("Value2", "Variable2");
parameterList.setValue("Value3", "Variable3");
parameterList.setValue("Value4", "Variable4");
client.execute(function);
But this requires that we have to import the following packages:
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.JCO.Client;
import com.sap.mw.jco.JCO.Function;
import com.sap.mw.jco.JCO.ParameterList;
import com.sap.mw.jco.JCO.Repository;
The problem is that we can not make the import. It doesn't understand the package com.sap.mw.jco.
Any idea how can we make the import?
For the second solution that your are mentioning in your post, can we call a web service from another web service?
Thanks in advanced.
Edited by: Odysseas Spyroglou on Jun 10, 2010 3:18 PM
Hi,
we managed to import the com.sap.jco packages and we wrote the following code in our class (web service) :
Client client = JCO.createClient("200", "user", "password", "EL", "servername", "01");
client.connect();
Repository repository = new JCO.Repository("SAP", client);
IFunctionTemplate functionTemplate = repository.getFunctionTemplate("function_module");
Function function = functionTemplate.getFunction();
ParameterList parameterList = function.getImportParameterList();
parameterList.setValue("Value1", "Variable1");
parameterList.setValue("Value2", "Variable2");
parameterList.setValue("Value3", "Variable3");
parameterList.setValue("Value4", "Variable4");
client.execute(function);
The problem now is that we get the following message when we test the web service:
"An error has occurred. Maybe the request is not accepted by the server:
com/sap/mw/jco/JCO$BasicRepository"
Can anyone help us find the problem?
Thnaks in advanced.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.