Context Programming
Exercise
Chapter: Context at Runtime
Theme: Setting a default value for a context
attribute
At the end of this Exercise, you will be able to:
Navigate to a context node
Get context node element at lead selection
Set a value for an attribute
1 Development Objectives
This exercise has the following objectives:
Setting “AA” (American Airline) as default value for the input field “Airline”.
2 Result
In this exercise, you will use the
WDDOINIT method of the view
controller to set “AA” as default value
for the input field “Airline”.
Template Solution:
Web Dynpro Component: WD_05S_DEFAULT_VALUE
Application: WD_05S_DEFAULT_VALUE
Starting Point of this exercise:
1
Context Programming
Exercise
Web Dynpro Component: ZWD_##_SIMPLE_APPLICATION
or the template solution
Web Dynpro Component: WD_03S_SIMPLE_APPLICATION
Group number: ## stands for the two-digit group number
3 Developing
3-1 Copy Web Dynpro Component
Copy your Web Dynpro Component ZWD_##_SIMPLE_APPLICATION
or the template solution WD_03S_SIMPLE_APPLICATION to name
ZWD_##_DEFAULT_VALUE.
3-2 Create Default Value
Navigate to the Methods tab of view INPUT_VIEW and double-click on
the method name WDDOINIT.
Insert source code for doing the following:
- Navigate to context node FLIGHTINFO
- Get element at lead selection for context node FLIGHTINFO
- Set “AA” as default value for attribute CARRID.
3-3 Create Web Dynpro Application
Right mouse click on the component node and select Create -> Web
Dynpro Anwendung (Web Dynpro Application) from the context menu.
Create the application having the following attributes:
Name: (accept default)
Decription: Default Value
Accept all default settings and press Save and run your application.
2
Context Programming
Exercise