cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI call throw Web Service

Former Member
0 Kudos

Hi, I have some problem to call web service generated from BAPI on WAS 6.20. My Scenario is the following:

I took the famous BAPI_FLIGHT_GETLIST, generate Web Service on WAS 6.20, and consume it throw Web Dynpro Web Service model on WAS 6.40.

Now, I want to pass parameters to my web service.

I successfully passed all tables and my web service worked, the problem starts when I try to set data to one of the input structures namely DESTINATION_FROM. It looks like WS simply ignores the data I set there, so I am unable to pass the filter to the BAPI.

I also want to mention that I can call the same web service from Web Service navigator on my WAS 6.40. If I do it from there it works as required which means the problem in Web Dypro Side.

In addition I tried to set this structures with context mapping, without context mapping and directly to the model. It didn't work.

Any ideas?

Victor.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Victor,

Do one thing write following code in init method of your controller where u mapped your model for BAPI_FLIGHT_GETLIST.

Bapi_Flight_Getlist_Input model = new Bapi_Flight_Getlist_Input();

model.setDestination_From(new Bapisfldst());

model.setDestination_To(new Bapisfldst());

IPublicFlight_details.IBapi_Flight_Getlist_InputElement ele = wdContext.nodeBapi_Flight_Getlist_Input().createBapi_Flight_Getlist_InputElement(model);

wdContext.nodeBapi_Flight_Getlist_Input().bind(ele);

This code will create all required instances for input parameters.

Then you can execute it whenever u want.

It will work. Let me know the status.

Regards,

Bahvik

For -> David Fryda

You have written code for initialization of model. But you forgot to make an instace for two Input parameters. So, your data is not going to R/3 properly.

Do it and let me know.

Regards,

Bhavik

david_fryda2
Participant
0 Kudos

Hi Brahik,

In the case of a web service I do not know how to initialize the 2 input parameters.

My object req has a method called setParameters wich accepts only a ComplexType_BAPI_FLIGHT_GETLIST object type.

By the way, in an old WebDynPro that model is a the same BAPI (the BAPI_FLIGHT_GETLIST ), I do not initialize the input parameters and I get all the flights.

Thanks for your help.

Former Member
0 Kudos

Hi,

Web Dynpro runtime on 6.40 SP 11 has a bug in a Web Service model which is confirmed by SAP. The workaround they advised to me (and it worked) is to initialize all the field the following way:

ComplexType_BAPISFLDST dest_from = new ComplexType_BAPISFLDST();

params.<b>getOriginalBean()</b>.setDESTINATION_FROM(

dest_from.<b>getOriginalBean()</b>);

However, please remember that this is workaround and not proper way to do things.

Best Regard

Victor

david_fryda2
Participant
0 Kudos

Hi Victor,

Thanks for the help.

1) What is "params" ?

2) Do I need to change something in the URL of the PortType in the Logical Ports ?

Thanks a lot.

Former Member
0 Kudos

How do you get the wsdls of the webservice for the Flightlist BAPI´s ?

Former Member
0 Kudos

Hallo @ all:-)

is there a opportunity to get webservices, which gives me functionality of BusinessObjects like CATS or others?

Former Member
0 Kudos

Hello,

I just got the same problem and worked this out with Victor's workaround. Thanks!

By the way I am now on NetWeaver Developer Studio SP14 and server NW04 SP15.

My thread is

Kind Regards,

Vitaliano

david_fryda2
Participant
0 Kudos

Hi,

I have problems executing this BAPI through the Web Service.

I don't get any exception but I get an empty result table.

In the LogicalPort, I did define a "Stateless Communication".

1) Should I do this ?

2) I choosed a Basic(username/password) HTTP authentication. Should I do it ?

However, I removed these choices and it didn't work.

In the component controller, I wrote :

public void wdDoInit()

{

//@@begin wdDoInit()

Request_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST req =

new Request_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST();

wdContext.nodeRequest_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST().bind(req);

//@@end

}

public void execute_BAPI( )

{

//@@begin execute_BAPI()

try {

wdContext.currentRequest_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLISTElement()

.modelObject().execute();

// wdContext.nodeResponse().invalidate();

wdContext.nodeRequest_BAPI_FLIGHT_GETLISTPortType_BAPI_FLIGHT_GETLIST().nodeResponse().invalidate();

} catch(Exception e) {

}

//@@end

}

Is it OK ?

When my model is a SAP/R3 system, I was creating a Custom Controller and I wasn't using the Component Controller.

Is anyone can help...Thanks in advance.

Bye

htammen
Active Contributor
0 Kudos

Hi,

you have to create an instance of the DESTINATION_FROM structure directly and add it to your model.

You probably tried to add your data to the mapped context nodes. This does not work. The data is not appended automatically to the model. This for me is an error in Web Dynpro.

Regards

Helmut

Former Member
0 Kudos

Hi, thanks for the answer,

However it also dosn't work.

Best Regards.

Victor.

nol_hendrikx
Active Contributor
0 Kudos

Hi Victor,

Maybe there is a short dump on R/3. You can check it with transaction sm21 or st22.

Cheers and best wishes,

Noel