Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Configuration Programming

Exercise

Chapter: Configuration
Theme: Creating a configurable component

At the end of this Exercise, you will be able to:


 Create a configuration controller
 Use the configuration context
 Create component and application configurations

1 Development Objectives
This exercise has the following objectives:
Decide via a configuration whether an empty result table is displayed or a sepate view
displaying a text of your choice.

2 Result

In this exercise, you will use the


configuration controller and its context to
offer the possibility either

 to display an empty table

 or instead to display a view with a


text of your choice.

1
Configuration Programming
Exercise
Template Solution:
Web Dynpro Component: WD_13S_CONFIGURATION
Application: WD_13S_CONFIGURATION

Starting Point of this exercise:


Web Dynpro Component: WD_13T_CONFIGURATION

Group number: ## stands for the two-digit group number

3 Developing

3-1 Copy Web Dynpro Component


Copy the template component WD_13T_CONFIGURATION to name
ZWD_##_CONFIGURATION.

3-2 Create a configuration controller


As a first step create a custom controller and set it as configuration
controller by right clicking on the controllers name.
In the custom controller create a context node SETTINGS and in this node
an attribute EMPTY_TABLE_TEXT of type string.

3-3 Use the configuration controller’s context


In the context tab of the SEARCH view create a controller usage for the
above configuration controller. Then create a mapping in the SEARCH
view’s context to the configuration context node SETTINGS. Do the same
for the NOTHING_FOUND view and bind the TEXT_VIEW_1
UI element to the EMPTY_TABLE_TEXT attribute.
Modify the ONACTIONGO event handler of the SEARCH view to read
the configuration controller’s context EMPTY_TABLE_TEXT attribute
using the code wizard.
When the result table is empty and the EMPTY_TABLE_TEXT attribute
contains some text then fire the plug to the NOTHING_FOUND view
otherwise to the RESULT view.

2
Configuration Programming
Exercise
3-4 Create an application configuration and a component configuration
Next, right click on the application's name and create a configuration. As
a result the browser pops up and displays the configuration editor. In the
configuration editor, change the application configuration’s name to e.g.
WD_##_APP_CONF1 and click create.

In the next step you need to create a component configuration for your
comp WD_##_CONFIGURATION. Enter a name in the field
Configuration name e.g. WD_##_COMP_CONF1 and press the change
button on the ‘Component Configuration’ group. Then you see a tab with
the component controller's context as you have defined it. Choose
SETTINGS, enter a text in EMPTY_TABLE_TEXT field, click again on
settings and then on the save button.

You should see the message 'Data successfully saved'. Refresh the se80
navigation tree and you should see an entry for the component
configuration and for the application configuration when you expand the
application node. Then right click on the newly created application
3
Configuration Programming
Exercise
configuration and test it. The application comes up in the browser and
when you enter a selection set so that the result is empty, the
NOTHING_FOUND view is displayed. Create another two
configurations, one where the EMPTY_TABLE_TEXT contains just
another text and one with no text at all. In this case you should see an
empty table displayed.

4
Configuration Programming
Exercise

You might also like