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 Member
0 Kudos

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

odysseas_spyroglou
Participant
0 Kudos

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

Former Member
0 Kudos

>For the second solution that your are mentioning in your post, can we call a web service from another web service?

Of course, you can. This is widely used to create composite web services when you want to change the granularity of the calls.

Regards,

Olivier

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.

odysseas_spyroglou
Participant
0 Kudos

We can build a web dynpro applications that use RFC model. The model can call the function module that we need.

Is it possible to call (trigger) this web dynprio application by our web service and pass all the required variables?

Thanks

Edited by: Odysseas Spyroglou on Jun 11, 2010 1:04 PM

Former Member
0 Kudos

Hi,

>Is it possible to call (trigger) this web dynprio application by our web service and pass all the required variables?

I don't think so. A web dynpro application needs a web browser... And performance wise it would be bad.

Regards,

Olivier

odysseas_spyroglou
Participant
0 Kudos

Hi,

We followed the steps and we have created a web service for the function module.

How can we call this web service from our web service?

thanks.

Former Member
0 Kudos

Hi,

Aren't you're the one supposed to be the developper and knowing how to program ?

I am an admin : I don't code.

Regards,

Olivier