cancel
Showing results for 
Search instead for 
Did you mean: 

how to use two BAPIs in webdynpro Applicaiton?

former_member445109
Active Participant
0 Kudos

Hi All,

I'm developing one webdynpro application which is using BAPI_FLIGHT_GETLIST for gettting list of flights and then using an other bapi BAPI_FLIGHT_GETDETAIL for getting details of particular flight which is selected from getlist bapi.

how can use these two BAPI in single application? How to get the flight details after selecting the one row in getlist view?

please provide me the procedure.

Regards

Srikanth

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi

First create two models Bapi_flight_getlist, Bapi_flight_getDetails.

Add these models in your component.

Do the model binding on Component Controller.

Comp.Controller>apply template>servicecontroller>flightlist>choose

Airlineid

Maxrows

Expand Output node.

select Flight_List node.

ServiceController will automatically generate the method,choose ok.

Repeat the same for second bapi also.

choose

Airlineid

Connectionid

Flightdate

and select Flightdata

(you can find it by expanding output node).

after completion of all these steps u will have Getdetilas and getlist bapi details in comp.Controller.

To avoid overloading in selecting particular node specify different name for node.(eg:output-->output1)

Contextmapping.

you do the contextmapping between Comp.Controller and view by choosing appropriate details from comp.controller.

now you will have GetDetail and GetList nodes data.

do the view binding.

Apply template-->select Airlineid

Maxrows from getlist node.

again do the

Apply template-->select Flightdata from getdetailnode.

onleadselect of table you call the execute methods from comp.controller generated by service Controller.

Layouttab>table>properties-->onleadselect Event

create action for it.

in onleadselect<actionname>

{

wdThis.wdGetFirstCompController().executeBapi_Flight_Getdetail_Input();

wdThis.wdGetFirstCompController().executeBapi_Flight_Getlistl_Input();

}

in the output Getlist table will be displayed.

by clicking on table row,onLeadselectaction will be called.

you will get the flightdetails.

i hope this will solve your problem.

Regards

sowmya

vmadhuvarshi_
Contributor
0 Kudos

Hello,

Having two models for same backend is not a good approach as this would mean creation of separate connection pools unless preventive measures are taken. Go with single model to prevent unnecessary load on resources.

Regards,

Vishwas.

vmadhuvarshi_
Contributor
0 Kudos

Srikanth,

Get both BAPIs in a single model. Import and use them. You should use Supply function to get data for selected line and maybe Dispose function as well if you need that. For information on supply and dispose functions, please follow [this|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60086bd5-9301-2b10-6f97-a14366a5602b] e-book.

Hope this helps.

Vishwas.

PradeepBondla
Active Contributor
0 Kudos

Hi srikanth,

Its as simple as you work with one BAPI. there is no change.

if you use two bapi's you will get node for each bapi under your context ( after mapping).

and when you select the row in table i.e. result of BAPI_FLIGHT_GETLIST, those row(s) will be input to the BAPI_FLIGHT_GETDETAIL bapi.

get the selected row of the BAPI_FLIGHT_GETLIST by wdcontext.current<table node>.getXXattribute();

like this forward all the input attributes to the second bapi.

find the tutorials for adaptive rfc (for importing bapis) and if the BAPI_FLIGHT_GETDETAIL needs multiple rows as input, that also you can do it.

let me know if you need more clarification.

PradeeP

former_member445109
Active Participant
0 Kudos

Hi Pradeep,

Do I need to use one component for multiple components?

please provide me the link or doc for same type of application.

Regards

Srikanth

PradeepBondla
Active Contributor
0 Kudos

Hi,

only one component is enough.....

under your component context you will find two bapi nodes.....

presentation on adaptive RFC's https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/707f9632-74db-2910-9d95-e8d9fbbd...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a00f7103-6790-2a10-ac9c-fcac7c5b...

/thread/735077 [original link is broken]

/thread/466588 [original link is broken]

can provide more..... or just search in SDN you will find many more.....

dont go for supply functions and make your first application complex... its just simple web dypro...

take selected row (onSelect / onLeadSelect) method of the table just pass that parameters to another bapi. Its simple.....

PradeeP

Edited by: pradeep bondla on Aug 4, 2008 3:52 PM