82
ABAP WEBDYNPRO Company Logo

ABAP Webdynpro 4 JKT

Embed Size (px)

Citation preview

Page 1: ABAP Webdynpro 4 JKT

ABAP WEBDYNPRO

Company Logo

Page 2: ABAP Webdynpro 4 JKT

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

Page 3: ABAP Webdynpro 4 JKT

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.

Page 4: ABAP Webdynpro 4 JKT
Page 5: ABAP Webdynpro 4 JKT
Page 6: ABAP Webdynpro 4 JKT
Page 7: ABAP Webdynpro 4 JKT

Main webdynpro component’s parts• Component Controller

Context• Windows

Controller Context Attributes Methods Enbedded views ........

• Views UI elements Layout Controller Plugs Actions Context ..................

Page 8: ABAP Webdynpro 4 JKT

Parts of webdynpro component

Page 9: ABAP Webdynpro 4 JKT

Different types of Controllers• Component Controller• Custom controller• Configuration controller• View controller• Window controller

Page 10: ABAP Webdynpro 4 JKT

Different Webdynpro entities

Page 11: ABAP Webdynpro 4 JKT

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.

Page 12: ABAP Webdynpro 4 JKT

Context

Page 13: ABAP Webdynpro 4 JKT

Context and data transport

Page 14: ABAP Webdynpro 4 JKT

Context Nodes and Attributes

Page 15: ABAP Webdynpro 4 JKT

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.

Page 16: ABAP Webdynpro 4 JKT

Example of Cardinality

Page 17: ABAP Webdynpro 4 JKT
Page 18: ABAP Webdynpro 4 JKT
Page 19: ABAP Webdynpro 4 JKT

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.

Page 20: ABAP Webdynpro 4 JKT

Exercise 1

Page 21: ABAP Webdynpro 4 JKT

Exercise 1: Programming data fetching

Page 22: ABAP Webdynpro 4 JKT

Exercise 1: service call wizard

Page 23: ABAP Webdynpro 4 JKT

Exercise 1: After service call

Page 24: ABAP Webdynpro 4 JKT

Exercise 1: Context mapping

Page 25: ABAP Webdynpro 4 JKT

Exercise 1: creating forms

Page 26: ABAP Webdynpro 4 JKT

Exercise 1 : context binding

Page 27: ABAP Webdynpro 4 JKT

Exercise 1: Adding button and action

Page 28: ABAP Webdynpro 4 JKT

Exercise 1: creating action

Page 29: ABAP Webdynpro 4 JKT

Exercise 1: Event controlled method

Page 30: ABAP Webdynpro 4 JKT

Exercise 1: creating table

Page 31: ABAP Webdynpro 4 JKT

Exercise 1: binding table

Page 32: ABAP Webdynpro 4 JKT

Exercise 1: binding table

Page 33: ABAP Webdynpro 4 JKT

Exercise 1: embedding views

Page 34: ABAP Webdynpro 4 JKT

Exercise 1: Output

Page 35: ABAP Webdynpro 4 JKT

EXERCISE 2: CREATING A WEBDYNPRO APPLICATION WITH MULTIPLE VIEWS

Page 36: ABAP Webdynpro 4 JKT

Exercise 2: Application overview

Page 37: ABAP Webdynpro 4 JKT

Exercise 2: design first view

Page 38: ABAP Webdynpro 4 JKT

Exercise 2: context mapping of view1

Page 39: ABAP Webdynpro 4 JKT

Exercise 2: data binding view1

Page 40: ABAP Webdynpro 4 JKT

Exercise 2: design second view

Page 41: ABAP Webdynpro 4 JKT

Exercise 2: context mapping view2

Page 42: ABAP Webdynpro 4 JKT

Exercise 2: data binding view2

Page 43: ABAP Webdynpro 4 JKT

Exercise 2: view embedding

Page 44: ABAP Webdynpro 4 JKT

Exercise 2: creating navigation links

Page 45: ABAP Webdynpro 4 JKT

Exercise 2: creating application & test

Page 46: ABAP Webdynpro 4 JKT

INTER-APPLICATION NAVIGATION

WD application 1

WD application 2

WD application 3

Page 47: ABAP Webdynpro 4 JKT

Example

Page 48: ABAP Webdynpro 4 JKT

Web Dynpro application and aggregated components

Page 49: ABAP Webdynpro 4 JKT

Principle of an inter-application-navigation scenario

Page 50: ABAP Webdynpro 4 JKT

Defining a Web Dynpro Application in SAP NetWeaver™ Developer Studio

Page 51: ABAP Webdynpro 4 JKT

Interface IPublicStartCompInterfaceView

Page 52: ABAP Webdynpro 4 JKT

View layout

Page 53: ABAP Webdynpro 4 JKT

Defining view controller usage

Page 54: ABAP Webdynpro 4 JKT

Implementing eventhandler

Page 55: ABAP Webdynpro 4 JKT

Start Component and firing exit plug

Page 56: ABAP Webdynpro 4 JKT

Target Component

Page 57: ABAP Webdynpro 4 JKT

Adding a startup plug parameter

Page 58: ABAP Webdynpro 4 JKT

Defining the component controller usage

Page 59: ABAP Webdynpro 4 JKT

USER INTERFACE ELEMENTS

Page 60: ABAP Webdynpro 4 JKT

Standard UI elements are :

Button

Table

InputField

Page 61: ABAP Webdynpro 4 JKT

UI elements help to execute

Actions

Display text

Enter text

Display graphics

Page 62: ABAP Webdynpro 4 JKT

Various UI element sections

● favorites● text● action● selection● complex● layout● graphic● integration

Page 63: ABAP Webdynpro 4 JKT

Various types of text forms● Static Texts● Dynamic Texts● Long texts

Page 64: ABAP Webdynpro 4 JKT

MESSAGES

Company Logo

Page 65: ABAP Webdynpro 4 JKT

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.

Page 66: ABAP Webdynpro 4 JKT

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

Page 67: ABAP Webdynpro 4 JKT

Example

Page 68: ABAP Webdynpro 4 JKT

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

Page 69: ABAP Webdynpro 4 JKT

Messages in POPUP window

Page 70: ABAP Webdynpro 4 JKT

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

Page 71: ABAP Webdynpro 4 JKT

• Messages are integrated into the message log of a component using the Message Manager (interface IF_WD_MESSAGE_MANAGER) .

Page 72: ABAP Webdynpro 4 JKT

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

Page 73: ABAP Webdynpro 4 JKT

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 = ' ' ).

Page 74: ABAP Webdynpro 4 JKT

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

Page 75: ABAP Webdynpro 4 JKT

SEARCH HELP

Page 76: ABAP Webdynpro 4 JKT

Two pre-implemented input helps• OVS help• ABAP Dictionary Search Help

Page 77: ABAP Webdynpro 4 JKT

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.

Page 78: ABAP Webdynpro 4 JKT

Example

Page 79: ABAP Webdynpro 4 JKT

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.

Page 80: ABAP Webdynpro 4 JKT

Event OVS

Page 81: ABAP Webdynpro 4 JKT

• 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.

Page 82: ABAP Webdynpro 4 JKT

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