• No results found

NET313_CUSTOMER_S6_AC1

Exercise Objectives

NET313_CUSTOMER_S6_AC1

4. Take a look at the component controller methods of component ZNET313_##_CUSTOMER_S1.

Solution 1: Create Package and copy template Components

Task 1:

Create a package that will contain all the Repository objects you are going to develop.

1. Create the package ZNET313_## (replace ## by your group number).

Assign the application component BC-WD, the software component HOME, and a short description.

A transport request has been created by your trainer.

a) Perform this step like you (hopefully) have done often before.

Task 2:

Copy the template components. Store the copies in your package.

1. Copy the template component NET313_BOOKING_T. Name the copy ZNET313_##_BOOKING_S1. Assign the package ZNET313_## and a description (e.g. Cancel bookings) to your component. Activate your component.

a) Perform this step like you (hopefully) have done often before.

Hint: The template component is stored in package NET313.

Copying a WD component is conducted by selecting the item Copy... from the component's context menu.

2. Copy the template component NET313_CUSTOMER_T. Name the copy ZNET313_##_CUSTOMER_S1. Assign the package ZNET313_## and a description (e.g. Display / change customer) to your component.

a) Perform this step like you (hopefully) have done often before.

Hint: The template component is stored in package NET313.

Copying a WD component is conducted by selecting the item Copy... from the component's context menu.

Continued on next page

Task 3:

Implement the interface IF_FPM_UI_BUILDING_BLOCK by both components you have created in the last task.

1. Implement the interface IF_FPM_UI_BUILDING_BLOCK by your component ZNET313_##_BOOKING_S1.

a) Display your component ZNET313_##_BOOKING_S1 by double clicking on the component's name in the object tree. Switch to the edit mode.

b) Click on the tab labeled Implemented Interfaces.

c) Enter the interface name in the column labeled Name and confirm your input.

d) Click the button labeled Reimplement which is displayed right of the interface name. This will implement the interface methods.

2. Implement the interface IF_FPM_UI_BUILDING_BLOCK by your component ZNET313_##_CUSTOMER_S1.

a) Repeat the last step for component ZNET313_##_CUSTOMER_S1.

Task 4:

Activate your components.

1. Activate the components ZNET313_##_BOOKING_S1 and ZNET313_##_CUSTOMER_S1.

a) Perform this step like you (hopefully) have done often before.

Task 5:

Start the template solutions to find out what you should develop in this class.

Check out the architecture of your components to identify the coding sections needed to implement this solution.

1. Start the template solution for the booking scenario. Start the

application NET313_BOOKING_S5 using the application configuration NET313_BOOKING_S5_AC1.

a) In the object tree of the Object Navigator, display the package NET313.

b) Open the branch Web Dynpro –> Web Dynpro Applicat..

2. Take a look at the component controller methods of your component ZNET313_##_BOOKING_S1. In addition check out the method ONACTIONGET_CUSTOMER( ) of view CUSTOMER_VIEW.

a) CANCEL_BOOKINGS( ) will be used to cancel selected bookings on the data base table SBOOK.

CHECK_BOOKINGS_SELECTED( ) will be used to find out how many bookings are selected by the user.

DEFINE_CUSTOMER_VS( ) is called from the method WDDOINIT( ).

It is used to define a fixed value list related to customers.

GET_BOOKINGS( ) will be used to read all bookings for selected flights and a given customer.

GET_CUSTOMER( ) is called from the method WDDOINIT( ). It is used to read customer details for a given customer number. At startup the customer number equals '1' since the default value of the context attribute CUSTOMER.ID is set accordingly.

GET_FLIGHTS( ) will be used to read all flights a given customer has booked on.

GET_SELECTED_BOOKINGS( ) will be used to read all bookings selected by the user from one context node and store these bookings in another node.

SET_INTRO_TEXT( ) is called from the method WDDOINIT( ). It is used to get a SAP Script text from the data base and display it on the view INTRO_VIEW.

WDDOINIT( ) encapsulates to calls of the methods DEFINE_CUSTOMER_VS( ), SET_INTRO_TEXT( ), and GET_CUSTOMER( ).

ONACTIONGET_CUSTOMER( ). This view controller method is processed if a new customer is selected via the drop down box defined in the layout of this view. As a result, the component controller method GET_CUSTOMER( ) is called to actualize the customer data.

Hint: All other methods of all other controllers do not contain any code.

Continued on next page

3. Start the template solution for the booking scenario. Start the application NET313_CUSTOMER_S6 using the application configuration

NET313_CUSTOMER_S6_AC1.

a) In the object tree of the Object Navigator, display the package NET313.

b) Open the branch Web Dynpro –> Web Dynpro Applicat..

c) Open the branch related to the application NET313_CUSTOMER_S6 until the application configuration is displayed.

d) From the context menu of the application configuration choose Test.

4. Take a look at the component controller methods of component ZNET313_##_CUSTOMER_S1.

a) GET_BOOKINGS( ) will be used to read all bookings for a given customer. Two internal tables containing cancelled bookings and non-cancelled bookings are defined and bound to the context nodes BOOKINGS_C and BOOKINGS_N, respectively.

GET_CUSTOMER( ) will be used to read customer details for a given customer number. The default value of the context attribute CUSTOMER_ID.ID is set to '1'.

SET_INTRO_TEXT( ) is called from the method WDDOINIT( ). It is used to get a SAP Script text from the data base and display it on the view INTRO_VIEW.

TOGGLE_EDIT_MODE( ) will be used to toggle the editability of form fields for the form displaying customer details.

UPDATE_CUSTOMER( ) will be used to store the changes of customer details on the data base.

WDDOINIT( ) encapsulated to call of the method SET_INTRO_TEXT(

). In addition, the controller attribute GO_CONTEXT is set. This reference to the context object is used to access the context change log.

This log file contains all changes of context attribute values resulting from a user input. This will be used to find out, if data needs to be updated on the data base.

Hint: All other methods of all other controllers do not contain any code.

Lesson Summary

You should now be able to:

• Describe what floorplans are

• List the advantages of developing Web Dynpro ABAP applications using the FPM framework