Upload
rohit-sharma
View
478
Download
5
Tags:
Embed Size (px)
Citation preview
ABAP WEBDYNPRO
Company Logo
Course ObjectiveAfter completing this course, you will be able to:• Explain the architecture of a Web Dynpro component• Describe the constituents of a Web Dynpro controller• Create context elements in Web Dynpro controllers• Explain how navigation and data transfer in and between Web Dynpro components can be realized• Define the UI of a Web Dynpro component• Internationalize a Web Dynpro application• Define and send messages• Define value help and semantic help related to UI elements• Display dialog boxes• Embed Web Dynpro components into other Web Dynpro components• Manipulate the context and the UI element hierarchy at runtime• Use the ABAP List Viewer (ALV) in the Web Dynpro UI• Configure and personalize Web Dynpro components• Integrate Web Dynpro applications into the SAP NetWeaver Portal
Definition :Web Dynpro is the SAP NetWeaver programming model for user interfaces (UIs).
Features :• The Web Dynpro model is based on the Model View Controller
paradigm, and has been build on the classic dynpro model• Clear separation of business logic and display logic• Uniform metamodel for all types of user interfaces• Execution on a number of client platforms.• Extensive platform independence of interfaces• Web Dynpro is available both in the Java and the ABAP
development environment.
Main webdynpro component’s parts• Component Controller
Context• Windows
Controller Context Attributes Methods Enbedded views ........
• Views UI elements Layout Controller Plugs Actions Context ..................
Parts of webdynpro component
Different types of Controllers• Component Controller• Custom controller• Configuration controller• View controller• Window controller
Different Webdynpro entities
At runtime, all controller instances are singletons in respect to their parent component. This is also true for view controllers; thus, embedding a view in a view assembly more than one time is not allowed.
Context
Context and data transport
Context Nodes and Attributes
Cardinality
Cardinality Description
1...1 Only one element is instantiated.
0...1 At runtime, no more than one element is instantiated, but it is also possible that no element is instantiated.
1...n n elements can be instantiated, but at least one element must be instantiated.
0...n The number of instantiated elements of the context node can vary.
Example of Cardinality
Note: Since the root node of a context is only ever instantiated once, every nodedirectly below the root node (in our example, Vehicle) is always automatically a singleton node.
Exercise 1
Exercise 1: Programming data fetching
Exercise 1: service call wizard
Exercise 1: After service call
Exercise 1: Context mapping
Exercise 1: creating forms
Exercise 1 : context binding
Exercise 1: Adding button and action
Exercise 1: creating action
Exercise 1: Event controlled method
Exercise 1: creating table
Exercise 1: binding table
Exercise 1: binding table
Exercise 1: embedding views
Exercise 1: Output
EXERCISE 2: CREATING A WEBDYNPRO APPLICATION WITH MULTIPLE VIEWS
Exercise 2: Application overview
Exercise 2: design first view
Exercise 2: context mapping of view1
Exercise 2: data binding view1
Exercise 2: design second view
Exercise 2: context mapping view2
Exercise 2: data binding view2
Exercise 2: view embedding
Exercise 2: creating navigation links
Exercise 2: creating application & test
INTER-APPLICATION NAVIGATION
WD application 1
WD application 2
WD application 3
Example
Web Dynpro application and aggregated components
Principle of an inter-application-navigation scenario
Defining a Web Dynpro Application in SAP NetWeaver™ Developer Studio
Interface IPublicStartCompInterfaceView
View layout
Defining view controller usage
Implementing eventhandler
Start Component and firing exit plug
Target Component
Adding a startup plug parameter
Defining the component controller usage
USER INTERFACE ELEMENTS
Standard UI elements are :
Button
Table
InputField
UI elements help to execute
Actions
Display text
Enter text
Display graphics
Various UI element sections
● favorites● text● action● selection● complex● layout● graphic● integration
Various types of text forms● Static Texts● Dynamic Texts● Long texts
MESSAGES
Company Logo
Description Messages are language-dependent texts that are displayed on the screen if, for example, an error occurs when an application is run or the user enters data in the wrong format.
Advisory SAP recommends that you restrict the number of messages to a manageable amount. If there are too many messages it overburdens the end user
Example
Three settings for handling messages
• if user request for it then only it is displayed
Show message component if
required
• If the message does not exist then text ‘No Message’ is displayed
If messages exist, they are
displayed
• Even if there are no messages, the message component is still displayed in the top view
Always show message
component
Messages in POPUP window
Configuration options for Popups● Display all messages as up to now (standard setting)● Only display the messages that belong to their window as well as all non-window-specific messages● Display no messages at all
• Messages are integrated into the message log of a component using the Message Manager (interface IF_WD_MESSAGE_MANAGER) .
Methods for triggering messages• CLEAR_MESSAGES
Deletes all messages• IS_EMPTY
Queries whether there are any messages• REPORT_ATTRIBUTE_ERROR_MESSAGE
Reports a Web Dynpro exception to a context attribute• REPORT_ATTRIBUTE_EXCEPTION
Reports a Web Dynpro exception to a context attribute• REPORT_ATTRIBUTE_T100_MESSAGE
Reports a Web Dynpro exception to a context attribute• REPORT_ERROR_MESSAGE
Reports a Web Dynpro message with optional parameters• REPORT_EXCEPTION
Reports a Web Dynpro exception (it may come back)• REPORT_FATAL_ERROR_MESSAGE
Reports a fatal Web Dynpro message with optional parameters• REPORT_FATAL_EXCEPTION
Reports a fatal Web Dynpro exception• REPORT_SUCCESS
Reports a success message• REPORT_T100_MESSAGE
Reports a message using a T100 entry• REPORT_WARNING
Reports a warning
Configuration of message displaydata: l_api_mycomp type ref to if_wd_window_controller, l_wd_message_area type ref to if_wd_message_area. l_api_mycomp ?= wd_this->wd_get_api( ). l_wd_message_area = l_api_mycomp->get_message_area( ). l_wd_message_area->set_display_attributes( i_for_all_instances = ' ' i_msg_lines_visible = '0' i_use_toggle_area = ' ' i_show_only_current = ' ' ).
Description of settingsSetting Description
i_use_toggle_area = ' ' New design of the message area (default setting)
i_use_toggle_area = 'X' Old design of the message area (with the toggle area)
i_msg_lines_visible = 0 All messages are immediately visible (default setting)
i_msg_lines_visible = <x> x > 0. Only x messages are immediately visible; the rest become visible by scrolling.
i_show_only_current = 'X' Together with i_use_toggle_area = ' ' this means that no message log can be displayed (default setting)
i_show_only_current = ' ' Together with i_use_toggle_area = ' ' this means that a link takes you to where the message log can be displayed
SEARCH HELP
Two pre-implemented input helps• OVS help• ABAP Dictionary Search Help
ABAP Search help• This input help is based on the search help
function of the ABAP Dictionary in the SAP system. So you use search helps for data elements and structures defined in the ABAP Dictionary so far as these are supported by Web Dynpro.
Example
OVS help• You can use Object Value Selection input help
if it is not possible to carry out the search using the ABAP Dictionary, for example, if the value set is to be calculated in the Web Dynpro application.
Event OVS
• The callback to the using component is implemented through the OVS event at the interface controller of the OVS component. This event is automatically triggered four times, one after the other . It passes parameter OVS_CALLBACK_OBJECT of type IF_WD_OVS to the corresponding event handler in the application component. The phase is determined from instance attribute PHASE_INDICATOR of the event parameter. When the event is first triggered the attribute has value CO_PHASE_0, when it is triggered the second time, CO_PHASE_1 and so on.
Various phase indicators• PHASE_INDICATOR = IF_WD_OVS=>CO_PHASE_0• PHASE_INDICATOR = IF_WD_OVS=>CO_PHASE_1• PHASE_INDICATOR = IF_WD_OVS=>CO_PHASE_2• PHASE_INDICATOR = IF_WD_OVS=>CO_PHASE_3