Sunday, December 19, 2010

Using Supply Function method in Web Dynpro

Summary:

Supply function method are used for populating the context attributes of the context node elements. Here we are going to Display booking details for selected flights using supply function.

Create a Web Dynpro Component called ZZ_DEMO_SUPPLYFUNCTION

Create a service call to access the BAPI

Click continue.

Select the Function module option & specify the function module name.

Select the required parameter & continue

Complete the process

Now your Component Controller Context looks like this


Now create a Node under FLIGHT_LIST called BOOKINGS refers to SBOOK Dictionary Structure and give the Supply Function called GET_BOOKINGS.

Now click Add Attribute from structure.

Select these from the list and click ok.

Now you can see the BOOKING node under the FLIGHT_LIST

Now create a view called FLIGHTLISTVIEW

Now on the context tab of the FLIGHTLISTVIEW drag and drop the nodes from the component controller.

Now Design the Layout as shown below

Create a button called SEARCH and action is GET_FLIGHTS

Create two table called TABLE1 and TABLE2.

Bind the Table

  • TABLE1 with FLIGHT_LIST

  • TABLE2 with BOOKINGS

Now write the code in the GET_BOOKINGS in the COMPONENTCONTROLLER.

METHOD GET_BOOKINGS .
  DATA: ITAB_BOOKINGS TYPE IF_COMPONENTCONTROLLER=>ELEMENTS_BOOKINGS,
STRU_BOOKINGS LIKE LINE OF ITAB_BOOKINGS,
STRU_FLIGHTLIST TYPE IF_COMPONENTCONTROLLER=>ELEMENT_FLIGHT_LIST.
  PARENT_ELEMENT->GET_STATIC_ATTRIBUTES(
IMPORTING STATIC_ATTRIBUTES = STRU_FLIGHTLIST ).
  ITAB_BOOKINGS = ZCL_WDABAP_FLIGHT_MODEL=>GET_BOOKINGS(
CARRID = STRU_FLIGHTLIST-AIRLINEID
CONNID = STRU_FLIGHTLIST-CONNECTID
FLDATE = STRU_FLIGHTLIST-FLIGHTDATE ).
  NODE->BIND_TABLE( ITAB_BOOKINGS ).
ENDMETHOD.
Now write the code in the ONACTIONGET_FLIGHTS  Event Handler in the FLIGHTLISTVIEW.
method ONACTIONGET_FLIGHTS .
WD_COMP_CONTROLLER->EXECUTE_BAPI_FLIGHT_GETLIST( ).
endmethod.

Now Create a Web Dynpro Application and save and activate all.

Output:




No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites