cancel
Showing results for 
Search instead for 
Did you mean: 

Connect a web service to ERP

odysseas_spyroglou
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member214651
Active Contributor
0 Kudos

Hi,

If u are using CE NWDS, u can develop a composite application to import a BAPI and achieve the functionality.

Regards,

Poojith MV

odysseas_spyroglou
Participant
0 Kudos

We have found that we must use SAP Java Connector but we cannot import the com.sap.nw.jco to the java class that we have created as web service using NW Developer Studio!

We can develop a Web dynpro project and create a model that will use the Function module but how can we call this project by the java class of the web service?

odysseas_spyroglou
Participant
0 Kudos

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.

former_member214651
Active Contributor
0 Kudos

Hi,

Check if the SLD is configured with the system u want to connect? If the ECC system is not configured in the SLD, the JCo will not be able to connect

Regards,

Poojith MV

odysseas_spyroglou
Participant
0 Kudos

Hi,

If we execute the above code with the NetBeans IDE the program runs succesfully.

The problem is when we use the NW Developer Studio. We must use the NW Developer Studio to deploy the code to the EP.

We tried to commend one by one the commands to find the spot that the program gives us the erroe

and we found that we get the error on the command:

"IFunctionTemplate functionTemplate = repository.getFunctionTemplate("function_module");"

How can we check if the SLD is configured with the system we want to connect to?

former_member214651
Active Contributor
0 Kudos

http://<hostname>:<portnumber>/sld

log in with administrator credentials and check under the "Systems" ,link.

Regards,

Poojith MV

odysseas_spyroglou
Participant
0 Kudos

We checked it and our destination system is in SLD.

We have created and an JCO Destination with the name function_module but the error insists.

Thanks

odysseas_spyroglou
Participant
0 Kudos

We think that the problem is in the following statement.

Repository repository = new JCO.Repository("SAP", client);

Does anyone knows what do we have to put in the "SAP" place?

Thanks in advanced.