Professional Documents
Culture Documents
Audience
Developers and consultants who want to create applications
based on the Web Dynpro for ABAP programming model
Prerequisites
ABAP
ABAP Objects
Duration: 2 days
Contents:
The structure of the context
Context mapping
Internal mapping
Encapsulation:
Objects restrict the visibility of their resources (attributes and
methods) to other users. Every object has an interface, which
determines how other objects can interact with it. The
implementation of the object is encapsulated, that is, invisible
outside the object itself.
Classes:
Classes describe objects. From a technical point of view, objects
are runtime instances of a class. In theory, you can create any
number of objects based on a single class. Each instance (object)
of a class has a unique identity and its own set of values for its
attributes.
Object References:
In a program, you identify and address objects using unique
object references. Object references allow you to access the
attributes and methods of an object.
In object-oriented programming, objects usually have the following
properties:
Inheritance:
You can use an existing class to derive a new class. Derived
classes inherit the data and methods of the superclass. However,
they can overwrite existing methods, and also add new ones.
Polymorphism:
Identical (identically-named) methods behave differently in
different classes. In ABAP Objects, polymorphism is
implemented by redefining methods during inheritance and
by using constructs called interfaces.he structure of the
context
Objects:
Objects are instances of classes. They contain data and provides
services. The data forms the attributes of the object. The services
are known as methods (also known as operations or functions).
Typically, methods operate on private data (the attributes, or state
of the object), which is only visible to the methods of the object.
Thus the attributes of an object cannot be changed directly by the
user, but only by the methods of the object. This guarantees the
internal consistency of the object.
Instance methods :
Can use both static and instance components
in their implementation part
Can be called using an instance
Static methods :
Can only use static components in their implementation
Part
Can be called using the class
Instance Attributes:
One per instance
Statement :DATA
Static Attributes:
One per class
Statement: CLASS-DATA
Also known as class attributes
Public Attributes:
Can be viewed and changed by all users and in all
methods
Direct access
Private Attributes:
Can only be viewed and changed from within the class
No direct access from outside the class
Instance methods :
Can use both static and instance components
in their implementation part
Can be called using an instance
Static methods :
Can only use static components in their implementation
Part
Can be called using the class
Component Other WD
Usage Components
Created by explicit declaration or coding Created by the Web Dynpro Framework (WDF)
Node
Attribute
Context Root
Node Context menu on the Context Root
Node
Context Node:
Are arranged hierarchically and are permitted to have children
Children of a node may be entities known as other nodes or attributes
Metadata description declared manually or derived from a Dictionary
Structure
Context Attribute:
Stores runtime data or references to runtime data
Based on DDIC Types
People matter, results count. 27
Context Structure Design Time (2)
Context Metadata
Node Metadata (c=cardinality, s=singleton)
Context Root (c=1..1, s=true)
IF_WD_CONTEXT_NODE_INFO (interface)
FLIGHTS (c=0..n, s=true) Attribute Metadata (data type)
BOOKINGS (c=0..n, s=false) WDR_CONTEXT_ATTRIBUTE_INFO (structure)
BOOKID A node collection
CUSTOMID
CLASS
All context nodes are collections.
PASSNAME
A node collection is composed of
CARRID
elements, where an element is an
CONNID
aggregation of the nodes immediate
FLDATE children (attributes and/or other nodes).
PRICE The cardinality property controls the
number of elements a node collection
may hold at runtime.
Design time
People matter, results count. 28
Context Structure Runtime (1)
All independent nodes are forced to be singletons. This is
because the context root node has one and only one element.
c=1..1, s=true
= Element created by an application at runtime
Default 1 = Element created by the WDF at context initialisation time
Element
c=1..1, s=true
Node collection contains a default
Default 1
Element element.
Can contain a maximum of one
c=0..1, s=true Independent Node element.
1 Node collection is initially empty.
Can contain a maximum of one
element.
Independent Node
c=1..1, s=true
= Element created by an application at runtime
Default 1 = Element created by the WDF at context initialisation time
Element = Element at the lead selection
c=1..n, s=true
Node collection contains a default
..n element.
2
c=0..n, s=true Default 1 Can contain as many elements as
Element required.
..n
2
1 Independent Node
Node collection is initially empty.
Can contain as many elements as
Independent Node required.
People matter, results count. 30
Context Structure Runtime (3) Context Root
Default
The runtime structure of the
Context Metadata Element 0
context if node BOOKINGS is a
non-singleton.
Context Root (c=1..1, s=true)
FLIGHTS (c=0..n, s=true) FLIGHTS
BOOKINGS (c=0..n, s=false) CARRID ..n
CARRID
CONNID
2
BOOKID
CARRID
CONNID 1
CUSTOMID
CONNID
CLASS FLDATE
PASSNAME
BOOKINGS
CARRID
BOOKINGS BOOKID ..n
CONNID BOOKID 2
BOOKINGS CUSTOMID
BOOKID ..n
FLDATE BOOKID
BOOKID 2CUSTOMID
1
BOOKID ..nCUSTOMID
PRICE BOOKID BOOKID
2 1CUSTOMID
CUSTOMID
CUSTOMID
BOOKID 1 CUSTOMID
CUSTOMID
CUSTOMID
CARRID
CONNID
BOOKINGS
FLDATE
BOOKID ..n
PRICE BOOKID 2
CUSTOMID
BOOKID
CUSTOMID
1
CUSTOMID
Advantages:
CLASS CLASS
PASSN PASSN
CARRID CARRID
CONNID CONNID
FLDATE FLDATE
PRICE PRICE
Contents:
Introduction to UI elements
Putting data on the screen: Context binding
Controlling the behaviour of UI elements using context binding
Using a basic composite UI element
Group UI Element
TextView UI Element
Label UI Element
InputField UI Element
People matter, results count. 39
How are UI elements arranged?
All view layouts are composed from a hierarchy of UI elements.
InteractiveForm
BusinessGraphics,
GeoMap
e.g. DateNavigator,
Table, Tree
BI Application Frame
OfficeControl
e.g.
TransparentContainer, MessageArea
Tray
1. Choose
Change from
the context
menu of a
view
People matter, results count. 42
View Editor
2. The Layout view 3a. UI elements can be added by
will be selected drag and drop from the
by default toolbar
1. Choose
Change from
the context
menu of
3b.a In the hierarchical representation - UI 5. Properties of the
view elements can also be added by UI elements can
selecting Insert Element via context
People matter, results count. be changed 43
Context Binding (1)
Context Binding is the association of a UI element property with a node or attribute in a
view controllers context.
The UI element property then uses the context node or attribute as it data source. If the
UI element property can be updated by the user, then new value replaces the value in the
context.
UI Layout
Context
Root Node
Application
Coding
Implementation UI Layout
Standard
Context
Hook
Root Node
Methods
Instance
Methods
Actions
Navigation
Plugs
Implementation UI Layout
Standard
Context
Hook
Root Node
Methods
Instance
Updates
Methods
Actions
Navigation
Plugs
1) Declare
context
People matter, results count. 47
attribute
Putting data on the screen (2)
2) Create UI
element 1) Declare
on layout context
People matter, results count. 48
attribute
Putting data on the screen (3)
3) Bind UI element
to context
2) Create UI
attribute
element 1) Declare
on layout context
People matter, results count. 49
attribute
Putting data on the screen (4)
3) Bind UI element
to context
2) Create UI
attribute
element 1) Declare
on layout context
People matter, results count. 50
attribute
Putting data on the screen (5)
The order of attributes within a node has no influence on the order in which
the data they hold is displayed.
2.The
corresponding
input field will
always be open
for input.
UI element
appearance
Available
Properties
Possible UI Events
Rendered tree
UI element
hierarchical representation of
a Table UI element
People matter, results count. 57
The Table UI element
The Table is an example of a composite UI element.
Composite TableColumn UI
Element.
hierarchical representation of
a Table UI element
People matter, results count. 58
Binding a Table UI element to the context
The UI elements making up a Table
Context Metadata hierarchy require several context
bindings in order to function correctly.
Context Root
FLIGHTS (c=0..n)
BOOKINGS (c=0..n)
BOOKID
CUSTOMID
CLASS
PASSNAME
CARRID
View layout
CONNID
The Table UI element must have its
FLDATE
dataSource property bound to a
PRICE
context node of cardinality 0..n or 1..n
BOOKID
Each context attribute is
CUSTOMID a potential candidate for
CLASS becoming a
TableColumn.
PASSNAME
CARRID
CONNID
PASSNAME
row
Context Root
FLIGHTS (c=0..n) FLIGHTS
BOOKINGS (c=0..n) CARRID ..n
BOOKID CARRID
CONNID
2
CARRID
CONNID 1
CUSTOMID
CONNID
CLASS
FLDATE
PASSNAME
CARRID
Runtime data View layout
CONNID
BOOKID
CUSTOMID
CLASS
PASSNAME
CARRID
View layout
CONNID A nodes selection cardinality controls how
FLDATE many elements may be selected
PRICE simultaneously within the element collection.
0..1 is the default.
Design Time Runtime
People matter, results count. 63
Controller and Context Programming
Contents:
The Context At Runtime
Understand the controller methods that are available to
you for application coding
The Context API
Component Other WD
Usage Components
Created by explicit declaration or coding Created by the Web Dynpro Framework (WDF)
Component Other WD
Usage Components
Created by explicit declaration or coding Created by the Web Dynpro Framework (WDF)
WD_COMP_CONTROLLER
present in any WD controller.
reference to the component controller with access to all public methods
and attributes.
Attribute will automatically assigned to all view controllers when a view
is created.
For all other controller the WD_COMP_CONTROLLER attribute will
be assigned, when the properties of the controller the component
controller is used.
WDDOBEFORENAVIGATION
It is executed before the navigation stack is processed
WDDOPOSTPROCESSING
Data from multiple components can be validated before the next step is
execute
data:
Node_Flights type ref to If_Wd_Context_Node.
data:
Node_Flights type ref to If_Wd_Context_Node,
First_flight_Elem type ref to If_Wd_Context_Element.
CARRID
CONNID
data:
Node_Flights type ref to If_Wd_Context_Node,
First_flight_Elem type ref to If_Wd_Context_Element.
* set attributes
First_flight_Elem->set_attribute( name = 'CARRID' value = 'LH' ).
First_flight_Elem->set_attribute( name = 'CONNID' value = '400' ).
CARRID 1
CONNID
data:
Node_Flights type ref to If_Wd_Context_Node,
First_flight_Elem type ref to If_Wd_Context_Element.
* set attributes
First_flight_Elem->set_attribute( name = 'CARRID' value = 'LH' ).
First_flight_Elem->set_attribute( name = 'CONNID' value = '400' ).
data:
Node_Flights type ref to If_Wd_Context_Node,
Stru_flights type If_Componentcontroller=>Element_flights.
CONNID
data:
Node_Flights type ref to If_Wd_Context_Node,
lt_flights type If_Componentcontroller=>Elements_flights,
Stru_flights like line of lt_flights.
Stru_flights-carrid = 'AA'.
Stru_flights-connid = '017'.
append Stru_flights to lt_flights.
Contents:
Introduction to internationalization
Online Text Repository
Message handling
List of existing
OTR texts
data:
... ...
OTR_text type string.
OTR_text = CL_WD_UTILITIES=>GET_OTR_TEXT_BY_ALIAS(
'SOTR_VOCABULARY_BASIC/MATERIAL_MASTER' ).
... ...
The message are can be moved like a UI element in a view. You find
a UI element (Message Area) in the UI library Pattern. Messages
will be placed in this area, if it is available.
ABAP OO
exceptions can be EXCEPTION ATTRIBUTE Parameter
used
Example
* report message
CALL METHOD l_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = '&V2 is not a valid date'
ELEMENT = Elem_Flights
ATTRIBUTE_NAME = 'FLDATE'
PARAMS = lt_messages.
l_current_controller ?= wd_This->Wd_Get_Api( ).
* report message
CALL METHOD l_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'REPORT_ATTRIBUTE_ERROR_MESSAGE'
ELEMENT = Elem_Flights
ATTRIBUTE_NAME = 'CITYFROM'.
l_current_controller ?= wd_This->Wd_Get_Api( ).
* report message
CALL METHOD l_message_manager->REPORT_T100_MESSAGE
EXPORTING
MSGID = 'E1'
MSGNO = '360'
MSGTY = 'S'
P1 = ' -> REPORT_T100_MESSAGE'.
People matter, results count. 96
Standard Hook Method View controller
Contents:
Value Selector
Populating a DropDownByKey UI element
Value Help
Reuse of existing Value Helps
Object Value Selector (OVS)
Programmer-definable Value Help
DropDownByKey
DropDownByIndex
ItemListBox
RadioButton
separated pop-up
Context attribute
data:
lr_node_info type ref to if_wd_context_node_info,
lt_value_set TYPE wdy_key_value_table,
value_set_item TYPE wdy_key_value.
value_set_item-key = 'X'.
value_set_item-value = 'Charter'.
insert value_set_item into table lt_value_set.
value_set_item-key = 'P'.
value_set_item-value = 'Private'.
insert value_set_item into table lt_value_set.
automatic
frei programmiert
S_CARR_ID
Domain
Date picker
People matter, results count. 106
Arbitrary Search Help
Set Input Help Mode to Dictionary
Value Help
Contents:
Introduction
Modifying the context structure at runtime
Modifying the UI Element hierarchy at runtime
The use of dynamic actions
BOOKID
CUSTOMID
CLASS
PASSNAME
CARRID
CONNID
FLDATE
PRICE
PASSNAME
CARRID
CONNID
FLDATE
PRICE
DDIC Structure
SFLIGHT People matter, results count. 114
Dynamic Node Creation related to a structure
Coding steps:
Obtain a reference to the metadata of the context node that will act as the new
nodes parent.
Call static method create_nodeinfo_from_struct( ) from helper class
cl_wd_dynamic_tool to create from a DDIC structure a node.
of the context node that will act as the new nodes parent BOOKID
PASSNAME
CARRID
CONNID
DATA: dyn_node type ref to if_wd_context_node, StructureFLDATE
SBOOK
dyn_node_info TYPE REF TO if_wd_context_node_info, PRICE
node_name TYPE string value 'FLIGHTS',
. . .
* navigate from <CONTEXT> to <FLIGHTS> via lead selection
dyn_node = wd_Context->get_Child_Node( Name = node_name ).
dyn_node_info = dyn_node->get_node_info( ).
ls_att-name = `TEXT_VISIBILITY`.
ls_att-TYPE_NAME = 'WDUI_VISIBILITY'.
The view is part of the current view assembly and this is the first
time the view is required, or
FLDATE CONNIDLabel
PRICE CONNIDInput
FLDATELabel
FLDATEInput
PRICELabel
PRICEInput
method WDDOMODIFYVIEW .
Declared action
Coding required
for dynamic
assigned action
Contents:
Component Interface
External Mapping
Web Dynpro Component Usage
Event E Event E
Method A Method B
Event E Event E
Event E
Method call, Events raised
Embedding of Interface View
Interface Interface
Interface viewview Controller
Internally M
Visible
Component Interface
Component
Controller
Window M
Window Controller Components
M
People matter, results count. 136
Component Usage from a Component Perspective
Component Interface
Other WD Components
People matter, results count. 137
Component Usage from a Controller Perspective
Other WD Components
People matter, results count. 138
Concepts: Component Interface
Interface
Component Controller Component
Controller
Interface Contr. Window
Context
Component Contr.
View View Controller
Root Node
Context
Root Node
Node 1 Context
Node 1 Root Node
Node 1
Method SET_AIRP.
Node 2
View Controller
Node 3
View View Controller
View
Label
Context
Interface View
method SET_AIRP Label Contexth
Root Node Root Node
Label
Node 1 Node 1
PressAttribut1
Attribut2
Method
ViewSORT_FLIGHT
Controller Node 2
View
Label
Context
Press
Attribut1
Label
Root Node
Attribut2
Node 2
Label1
Node
Node 2
Comp A Comp
Interface Comp B
Controller uses Controller
Context Context
Node Node
View
Model component
contains the
application logic and
Model Comp
data (shop with
Context
shopping basket, self Node
service,...)
Main component
instantiates UI and
model component
Model Layer accesses
Backend Business
backend functionality API (BAPI,
Business
Web Services)
Data
Contents:
ALV integration in Web Dynpro
ALV Configuration Model
Application ALV
Context Context
invalidate()
Local
ITAB bind_table(ITAB')