Professional Documents
Culture Documents
NET313 Floorplan Manager For Web Dynpro PDF
NET313 Floorplan Manager For Web Dynpro PDF
Date
Training Center
Instructors
Education Website
Participant Handbook
Course Version: 91
Course Duration: 3 Day(s)
Material Number: 50094991
No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP AG. The information contained herein may be changed
without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software
components of other software vendors.
Trademarks
Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint and SQL Server are
registered trademarks of Microsoft Corporation.
IBM, DB2, OS/2, DB2/6000, Parallel Sysplex, MVS/ESA, RS/6000, AIX,
S/390, AS/400, OS/390, and OS/400 are registered trademarks of IBM Corporation.
ORACLE is a registered trademark of ORACLE Corporation.
INFORMIX-OnLine for SAP and INFORMIX Dynamic ServerTM are registered
trademarks of Informix Software Incorporated.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, the Citrix logo, ICA, Program Neighborhood, MetaFrame, WinFrame,
VideoFrame, MultiWin and other Citrix product names referenced herein are trademarks
of Citrix Systems, Inc.
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C, World
Wide Web Consortium, Massachusetts Institute of Technology.
JAVA is a registered trademark of Sun Microsystems, Inc.
JAVASCRIPT is a registered trademark of Sun Microsystems, Inc., used under license for
technology invented and implemented by Netscape.
SAP, SAP Logo, R/2, RIVA, R/3, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP
EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com
are trademarks or registered trademarks of SAP AG in Germany and in several other countries
all over the world. All other products mentioned are trademarks or registered trademarks of
their respective companies.
Disclaimer
THESE MATERIALS ARE PROVIDED BY SAP ON AN "AS IS" BASIS, AND SAP EXPRESSLY
DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR APPLIED, INCLUDING
WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE, WITH RESPECT TO THESE MATERIALS AND THE SERVICE,
INFORMATION, TEXT, GRAPHICS, LINKS, OR ANY OTHER MATERIALS AND PRODUCTS
CONTAINED HEREIN. IN NO EVENT SHALL SAP BE LIABLE FOR ANY DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES OF ANY
KIND WHATSOEVER, INCLUDING WITHOUT LIMITATION LOST REVENUES OR LOST
PROFITS, WHICH MAY RESULT FROM THE USE OF THESE MATERIALS OR INCLUDED
SOFTWARE COMPONENTS.
g2009112114144
About This Handbook
This handbook is intended to complement the instructor-led presentation of this
course, and serve as a source of reference. It is not suitable for self-study.
Typographic Conventions
American English is the standard used in this handbook. The following
typographic conventions are also used.
Example text Screen output. This includes file and directory names
and their paths, messages, names of variables and
parameters, and passages of the source text of a
program.
Example text Exact user entry. These are words and characters that
you enter in the system exactly as they appear in the
documentation.
<Example text> Variable user entry. Pointed brackets indicate that you
replace these words and characters with appropriate
entries.
Icon Meaning
Exception or caution
Procedures
Unit 1: Introduction........................................................ 1
Web Dynpro ABAP Fundamentals ...................................2
Floorplan Manager - Overview ...................................... 36
Target Audience
This course is intended for the following audiences:
Course Prerequisites
Required Knowledge
NET310 - Fundamentals of Web Dynpro for ABAP
Course Goals
This course will prepare you to:
Course Objectives
After completing this course, you will be able to:
Unit Overview
In the first lesson of this unit, Web Dynpro fundamentals are repeated. Especially
the topics Component Reuse and Personalization are discussed since the FPM
framework is based on these techniques.
The second lesson provides a brief introduction into the FPM topic. The
architecture of FPM based Web Dynpro applications is compared to the
architecture of Web Dynpro applications not making use of the FPM framework.
The two important floorplans Guided Activity Floorplan (GAF) and Object
Instance Floorplan (OIF) are introduced. This includes a discussion of the
mandatory and optional functionality.
Unit Objectives
After completing this unit, you will be able to:
Unit Contents
Lesson: Web Dynpro ABAP Fundamentals ....................................2
Lesson: Floorplan Manager - Overview....................................... 36
Exercise 1: Create Package and copy template Components ........ 47
Lesson Overview
The Floorplan Manager for Web Dynpro ABAP is a framework that allows to
embed multiple Web Dynpro components by a common highly configurable
component (floorplan component). The prerequisite to understand the functionality
of the Floorplan Manager (FPM) framework is a deep comprehension of the Web
Dynpro features component reuse and adaptation via configuration.
These features - already explained in class NET310 - will be summarized in this
lesson.
Lesson Objectives
After completing this lesson, you will be able to:
Describe, how Web Dynpro components can be reused
Describe the adaptation of Web Dynpro components via implicit and explicit
configuration.
Business Example
The prerequisite to understand the functionality of the Floorplan Manager (FPM)
framework is a deep comprehension of the Web Dynpro features component reuse
and adaptation via configuration. Thus you have to recapitulate what you have
learned in class NET310 you have (hopefully) attended before.
Views are embedded in windows. Windows allow to define which views may be
visible for a certain application connected to this window. If combinations of
multiple views are to be displayed, these views are combined in the window (view
assembly). Windows are used to define the visual flow by creating navigation
links between the outbound plugs and the inbound plugs of embedded views.
The control flow of a Web Dynpro component is defined in the component
controller. From the component controller methods, the database of the local
system or the functionality of a back-end system is accessed. This is mainly done
by calling methods of a globally defined class (model) encapsulating the related
source code. These methods preferably encapsulate ABAP Open-SQL statements
(local DB access), the call of a Web service or the call of a function module in a
back-end system. The data interchanged between the controller and the model
can be stored in the model (if this global class is instantiated), in the component
controller's attributes, or in the component controller's context.
For modularization reasons, custom controllers may be created. These serve as
sub controllers of the component controller.
Certain parts of a controller's functionality are potentially visible to other
controllers. This is true for all controllers besides the view controller (MVC
principle). The controller that needs to access to functionality has to declare the
usage of the controller providing the functionality. Then, the complete context, all
ordinary methods, and all events are visible to the consumer controller. Context
mapping simplifies accessing the context of a used controller by the consumer
controller.
Navigation
Navigation from one view (assembly) to another view (assembly) is typically
triggered by a client side user action (e.g. clicking a button, selecting a table line).
This client side event can be related to the processing of a special method in the
related view controller by means of an action.
To define which views will make up the next view assembly, one or more outbound
plugs can be fired. A view's outbound plug can only be fired from a method of the
corresponding view controller. Plugs allow to pass data via export parameters.
Outbound plugs and inbound plugs of different views are connected in the window
via navigation links. One outbound plug can be connected to multiple inbound
plugs. This is meaningful if each inbound plug belongs to a different view and
all views together belong to the next view assembly. On the other side, multiple
outbound plugs may be connected to the same inbound plug.
Controller Methods
Each of the Web Dynpro controller types contains a set of predefined methods
which are called by the Web Dynpro runtime. In addition to these so called hook
methods, additional methods can be defined by the developer. These may be
ordinary methods, event handler methods, or supply functions. Ordinary methods
are the only methods that can be called from other methods of the same controller
or even from other controllers (not valid for view controllers). Supply functions
are connected to a context node. They are used to fill the context. Supply functions
are called by the Web Dynpro framework is the data is needed (data display or
functional access) and this data is not available in the context.
All controllers contain the hook methods WDDOINIT() and WDDOEXIT(). These
are the first and the last method processed in a controllers lifetime, respectively.
Window controllers contain in addition the two methods WDDOONOPEN() and
WDDOONCLOSE(), which are called when opening or closing the window as a
dialog box, respectively.
View controllers contain in addition the methods WDDOBEFOREACTION(),
WDDOAFTERACTION(), WDDOONCONTEXTMENU(), and
WDDOMODIFYVIEW(). WDDOBEFOREACTION() is called before any action
handler method (as a result of a client side event) is processed. This method is
typically used to check the user input. WDDOAFTERACTION() is called after any
action handler method (as a result of a client side event) is processed. This method
can be used for modularization reasons. WDDOMODIFYVIEW() is used for
dynamic changes of the UI element hierarchy while WDDOONCONTEXTMENU()
allows to assign and change context menus dynamically.
Custom controllers do not contain additional hook methods.
The component controller contains the additional hook methods
WDDOBEFORENAVIGATION() and WDDOPOSTPROCESSING().
WDDOBEFORENAVIGATION() is called after the action handling is finished
and just before the Web Dynpro framework processes the methods of all views
belonging to the next view assembly. WDDOPOSTPROCESSING() is the last
hook method processed before the response is send back to the client.
Controller Attributes
Each controller contains the predefined attributes WD_THIS and WD_CONTEXT
which are used to access the controller's functionality and its context information,
respectively.
If the component controller is defined as a used controller for another controller,
the attribute WD_COMP_CONTROLLER will be added to the attribute list of the
controller declaring the usage. This attribute is used to access the functionality of
the component controller object at runtime.
If an assistance class is related to a Web Dynpro component, each controller of
this component will contain an additional attribute WD_ASSIST. This allows to
access the functionality of the assistance class instance at runtime.
In addition to these standard attributes, the developer may define an arbitrary
number of additional attributes. These serve as the controller's globally visible
variables. In contrast to the information kept in the controller context, attributes
can not be bound to UI element properties, nor they can be mapped between
controllers. In addition, there is lot of meta information related to context nodes
and context attributes (cardinality, selection cardinality, singleton property, related
supply function ...) not available for controller attributes.
Controller Events
Component controller and custom controllers can raise events which may be
handled by event handler methods defined in other controllers. Subscribing an
event handler method to an event can be performed statically at design time or
dynamically at runtime. An event handler method can belong to any controller
located in the same component or even in another component. Exporting
parameters related to the controller events allow to pass data to the handler method.
Component Reuse
Web Dynpro components are reusable modules. This allows to build Web Dynpro
applications that consist of different components. From within a component,
an interface enables you to use the data and functions of another component.
Creating generic components is meaningful since they may be used by different
developers in different contexts.
Next, the component usage has to be instantiated. Technically, this can be done
from any method of any controller belonging to the consumer component. As a
prerequisite, the name of the component usage has to be entered in the list of used
components/controllers that can be found on the Properties tab of the controller.
Phase Model
Component reuse has a significant impact on the phase model. The hook
methods of the main component controllers and the hook methods of the direct
sub component controllers are processed in a sequence that can be described as
follows:
First, the action handling is conducted:
The WDDOBEFOREACTION( ) method is processed for all views
being part of the last view assembly.
The action handler ONACTION<ACTION>( ) is processed.
The WDDOAFTERACTION( ) method is processed for all views being
part of the last view assembly.
Next, the component controller method WDDOBEFORENAVIGATION( ) is
processed for all components instantiated so far.
Now the rendering of the next view assembly takes place.
For all controllers not instantiated so far, controller objects will be
created (method WDDOINIT( ) ).
The inbound plug handler methods (method HANDLE<PLUG>( ) )
will be processed according to the outbound plugs that have been fired
and the navigation links related to these plugs.
The WDDOMODIFYVIEW( ) method is processed for all views being
part of the next view assembly.
Finally, the component controller method WDDOPOSTPROCESSING( ) is
processed for all components instantiated so far.
Adaptation
There are three techniques available to adapt Web Dynpro applications:
Configuration, customizing, and personalization. Intrinsically, all concepts allow
to change predefined property values of UI elements used in any of the views of
this component. However, these concepts can be extended to allow all changes
that are guided by changing the values of context attributes.
Configuration is performed by a developer. First, at least one component
configuration has to be created for every Web Dynpro component that has to be
adapted.
At runtime, one component configuration can be loaded for each component in
order to adapt this component. It is possible to load the component configuration
data programmatically. However, it is also possible to define statically which
component configuration is used for which component. This assignment is defined
by an application configuration. Application configurations have to be created by
a developer.
Configuration takes place at design time. This kind of application adjustment
is visible for everybody in the system.
In contrast to configuration, personalization is a function that is available to
the user of an application and provides him or her with the option of adjusting
the application to suit his or her own personal requirements or preferences. The
framework for variation options within personalization is less far-reaching than
that in configuration; personal settings in the UI must never limit the running
ability of an application. Personalization of an application is performed directly
by a user from within the current application.
It is possible to maintain application settings in a uniform manner for all users
working in the same client (customizing or user-independent personalization).
A system administrator can process personalization settings on the basis of
his or her extended authorization, provided the respective application runs in
so-called configuration mode. Customizing allows to change a lot more settings
then personalization does.
Personalization and customizing are always executed at runtime of an application.
Adaptation Hierarchy
The concepts of configuration, customizing, and personalization can be combined
to define the final adaptation. Here, the changes defined by personalization
overwrite the changes defined by customizing, and customizing overwrites
the configuration adaptation. On the other side, the parameters available for
configuration can be set final so they cannot be changed using customizing or
personalization. Parameters available for customizing can be set final so they
cannot be changed using personalization.
Technically, the developer has to define a data interface that can be used
to pass adaptable data values to the component when instantiating it. This
concept is called explicit adaptation and can be implemented by configuration,
customizing and personalization. The data interface is the context of a special
custom controller (configuration controller) that is instantiated even before the
component controller of the related Web Dynpro component is instantiated. The
Web Dynpro framework reads the adapted data values and fills the context of the
configuration controller automatically when instantiating the related component.
Thus, the adapted data values are loaded before the first hook method of any other
controller defined in this component is processed. All other controllers can access
the adaptation data by mapping the corresponding nodes of the configuration
controller.
The developer has to decide which attributes should be defined in the configuration
controller and how changing these attributes will influence the functionality and
the UI of this component.
Hint: Only one configuration controller may exist for each Web Dynpro
component.
Configuration
Configuration is a concept that lets the developer create configuration data sets
containing values for UI element properties or context attributes (typically bound
to UI element properties). This allows to overwrite many of the statically defined
UI element properties, resulting in a different look and feel of the application
(UI elements may be set to invisible, tables may have an alternating row color,
and so on).
Configuration data sets are related to components or they are related to
applications. Component configurations allow you to change properties of
UI elements defined in any view of a single component. For each component,
an arbitrary number of component configurations can be defined. Application
configurations are bound to Web Dynpro applications. They define which
component configuration is used for which component in this application. For
each application, an arbitrary number of application configurations can be created.
Application changes related to configuration affect every user of this application
in every client.
2. Click on the button having the text Create. This will open a dialog box.
Enter a description and a package name and click on the OK button.
3. A new dialog box appears. Enter the transport task the component
configuration is to be assigned to and click on the OK button. If the
component configuration is defined as a local object, this dialog box will
not appear.
4. Now a new screen is displayed. A tab strip allows to display the
administrative information related to the component configuration on the
first tab.
5. The second tab labeled Component-Defined can only be selected if a
configuration controller exists for this component. In this case, the values
of all attributes defined in the context of the configuration controller can be
changed on this tab (explicit configuration).
6. On the tab labeled Web Dynpro Built-In, all views are displayed by a table. If
a view is marked, the UI element hierarchy of this view will be displayed.
Choose any UI element you want to manipulate (implicit configuration).
Change the property values and set the Final flag if you do not want this
property to be changed by customizing or by personalization.
7. Click on the button with the text Save. This will store the configuration data
set on the data base.
8. Close the browser. In the ABAP Workbench, refresh the object list. The
component configuration can be found as a sub-element of the Web Dynpro
component.
Using the same configuration tool, existing component configurations can be
displayed, changed, deleted, copied, renamed or they may be assigned to another
Web Dynpro component.
2. Click on the button having the text Create. This will open a dialog box.
Enter a description and a package name and click on the OK button.
3. A new dialog box appears. Enter the transport task the application
configuration is to be assigned to and click on the OK button. If the
application configuration is defined as a local object, this dialog box will
not appear.
4. On the next screen, a tab strip allows to display the administrative
information related to the application configuration (first tab).
5. In the second tab labeled Structure the main component and all statically
defined component usages are displayed by a table. Use the value help
related to the column Configuration to define which component configuration
is to be loaded for which component (usage).
6. Application parameters can also be adapted by an application configuration.
On the third tab labeled Application Parameters all application parameters
are listed and their values can be modified.
7. Finally, click the Save button. This will save the application configuration
on the data base.
8. Close the browser. In the ABAP Workbench, refresh the object list. The
application configuration can be found as a sub-element of the Web Dynpro
application.
Using the same configuration tool, existing application configurations can be
displayed, changed, deleted, copied, renamed, or they may be assigned to another
Web Dynpro application.
Lesson Summary
You should now be able to:
Describe, how Web Dynpro components can be reused
Describe the adaptation of Web Dynpro components via implicit and explicit
configuration.
Lesson Overview
This lesson gives an overview over the Floorplan Manager (FPM) for Web
Dynpro ABAP. First, the advantages of using this framework is sketched. Next,
the different floorplans available in Web Dynpro ABAP are introduced. Finally,
the basic features of the floorplans Guided Activity Floorplan (GAF) and Object
Instance Floorplan (OIF) are summarized.
Lesson Objectives
After completing this lesson, you will be able to:
Describe what floorplans are
List the advantages of developing Web Dynpro ABAP applications using
the FPM framework
Business Example
You would like to know what floorplans are and how floorplans can be put into
practice when developing Web Dynpro ABAP applications.
Using the FPM ensures that user interfaces behave the same way in all
applications.
The design of all cross-application entities of a user interface (e.g. toolbar
with toolbar buttons, page header, roadmap steps, or horizontal contextual
panel) is defined by the FPM.
The design follows the SAP user interface design guidelines.
Thus, users of such applications benefit from a high level of recognition,
which enables them to quickly and easily familiarize themselves with new
applications.
Time-consuming user interface programming is greatly reduced.
Simple applications are adjusted by configuring the underlying Web Dynpro
components and not by additional programming.
Adjustments that you make to the user interfaces of applications using the
FPM configuration editor are modification-free changes (FPM uses the Web
Dynpro adjustment concept).
In the examples above, upper case letters mark different parts of the floorplan.
These are as follows:
The QAF is a specialization of the OIF. Thus this floorplan consists of the same
constituents as the OIF. However, the QAF does not display the horizontal
contextual panel, because only one sub view is defined.
In the drawing above, the content area is labeled with the letter E, while the
optional bottom toolbar is labeled with the letter F.
Figure 34: FPM based Web Dynpro ABAP applications: Architecture (1)
Figure 35: FPM based Web Dynpro ABAP applications: Architecture (2)
As described above, the FPM component serves as the main component in FPM
based WD applications. However, this component is part of the FPM framework
and can not be edited by the application developer. On the other side, it is
necessary for the FPM component to interact with its sub components. This
drawback can be overcome as follows:
All sub components related to the embedded UIBBs can implement the Web
Dynpro component interface IF_FPM_UI_BUILDING_BLOCK. At runtime, the
methods defined in the component interface are triggered by the FPM component
at predefined points of the phase model. Thus, the phase model of each sub
component is extended by the methods defined in the implemented component
interface.
If classical component reuse and component reuse in the FPM context are
compared, the changes in respect to the phase model can be summarized as
follows:
The action handling is modified significantly since the corresponding
methods of the FPM component may not be edited.
For the components related to the last visible UIBBs, the methods
FLUSH( ), NEEDS_CONFIRMATION( ), and PROCESS_EVENT( )
are processed.
Then, the components related to the next visible UIBBs are instantiated.
This will also instantiate the corresponding component controllers.
Finally the method PROCESS_BEFORE_OUTPUT( ) is processed for
all UIBBs related to the next screen.
For details about the phase model modifications related to GUIBBs please refer to
the corresponding lesson in this handbook.
To share date and functionality between UIBBs that do not belong to the same
component, a simple global class can be used (Central Data Model). This class
has to be instantiated as a singleton by one of the sub components.
Business Example
You would like to create two WD components. These components will supply the
UIBBs that are embedded by the Floorplan Manager (FPM) component later on.
Template Components:
NET313_BOOKING_T
NET313_CUSTOMER_T
Solution Components:
NET313_BOOKING_S1
NET313_CUSTOMER_S1
Task 1:
Create a package that will contain all the Repository objects you are going to
develop.
1. Create the package ZNET313_## (replace ## by your group number).
Assign the application component BC-WD, the software component HOME,
and a short description.
A transport request has been created by your trainer.
Task 2:
Copy the template components. Store the copies in your package.
1. Copy the template component NET313_BOOKING_T. Name the copy
ZNET313_##_BOOKING_S1. Assign the package ZNET313_## and
a description (e.g. Cancel bookings) to your component. Activate your
component.
Task 3:
Implement the interface IF_FPM_UI_BUILDING_BLOCK by both components
you have created in the last task.
1. Implement the interface IF_FPM_UI_BUILDING_BLOCK by your
component ZNET313_##_BOOKING_S1.
2. Implement the interface IF_FPM_UI_BUILDING_BLOCK by your
component ZNET313_##_CUSTOMER_S1.
Task 4:
Activate your components.
1. Activate the components ZNET313_##_BOOKING_S1 and
ZNET313_##_CUSTOMER_S1.
Task 5:
Start the template solutions to find out what you should develop in this class.
Check out the architecture of your components to identify the coding sections
needed to implement this solution.
1. Start the template solution for the booking scenario. Start the
application NET313_BOOKING_S5 using the application configuration
NET313_BOOKING_S5_AC1.
2. Take a look at the component controller methods of your component
ZNET313_##_BOOKING_S1. In addition check out the method
ONACTIONGET_CUSTOMER( ) of view CUSTOMER_VIEW.
3. Start the template solution for the booking scenario. Start the application
NET313_CUSTOMER_S6 using the application configuration
NET313_CUSTOMER_S6_AC1.
4. Take a look at the component controller methods of component
ZNET313_##_CUSTOMER_S1.
Task 2:
Copy the template components. Store the copies in your package.
1. Copy the template component NET313_BOOKING_T. Name the copy
ZNET313_##_BOOKING_S1. Assign the package ZNET313_## and
a description (e.g. Cancel bookings) to your component. Activate your
component.
a) Perform this step like you (hopefully) have done often before.
Task 3:
Implement the interface IF_FPM_UI_BUILDING_BLOCK by both components
you have created in the last task.
1. Implement the interface IF_FPM_UI_BUILDING_BLOCK by your
component ZNET313_##_BOOKING_S1.
a) Display your component ZNET313_##_BOOKING_S1 by double
clicking on the component's name in the object tree. Switch to the
edit mode.
b) Click on the tab labeled Implemented Interfaces.
c) Enter the interface name in the column labeled Name and confirm
your input.
d) Click the button labeled Reimplement which is displayed right of the
interface name. This will implement the interface methods.
2. Implement the interface IF_FPM_UI_BUILDING_BLOCK by your
component ZNET313_##_CUSTOMER_S1.
a) Repeat the last step for component ZNET313_##_CUSTOMER_S1.
Task 4:
Activate your components.
1. Activate the components ZNET313_##_BOOKING_S1 and
ZNET313_##_CUSTOMER_S1.
a) Perform this step like you (hopefully) have done often before.
Task 5:
Start the template solutions to find out what you should develop in this class.
Check out the architecture of your components to identify the coding sections
needed to implement this solution.
1. Start the template solution for the booking scenario. Start the
application NET313_BOOKING_S5 using the application configuration
NET313_BOOKING_S5_AC1.
a) In the object tree of the Object Navigator, display the package NET313.
b) Open the branch Web Dynpro > Web Dynpro Applicat..
c) Open the branch related to the application NET313_BOOKING_S5
until the application configuration is displayed.
d) From the context menu of the application configuration choose Test.
3. Start the template solution for the booking scenario. Start the application
NET313_CUSTOMER_S6 using the application configuration
NET313_CUSTOMER_S6_AC1.
a) In the object tree of the Object Navigator, display the package NET313.
b) Open the branch Web Dynpro > Web Dynpro Applicat..
c) Open the branch related to the application NET313_CUSTOMER_S6
until the application configuration is displayed.
d) From the context menu of the application configuration choose Test.
4. Take a look at the component controller methods of component
ZNET313_##_CUSTOMER_S1.
a) GET_BOOKINGS( ) will be used to read all bookings for a given
customer. Two internal tables containing cancelled bookings and
non-cancelled bookings are defined and bound to the context nodes
BOOKINGS_C and BOOKINGS_N, respectively.
GET_CUSTOMER( ) will be used to read customer details for a
given customer number. The default value of the context attribute
CUSTOMER_ID.ID is set to '1'.
SET_INTRO_TEXT( ) is called from the method WDDOINIT( ). It is
used to get a SAP Script text from the data base and display it on the
view INTRO_VIEW.
TOGGLE_EDIT_MODE( ) will be used to toggle the editability of form
fields for the form displaying customer details.
UPDATE_CUSTOMER( ) will be used to store the changes of customer
details on the data base.
WDDOINIT( ) encapsulated to call of the method SET_INTRO_TEXT(
). In addition, the controller attribute GO_CONTEXT is set. This
reference to the context object is used to access the context change log.
This log file contains all changes of context attribute values resulting
from a user input. This will be used to find out, if data needs to be
updated on the data base.
Lesson Summary
You should now be able to:
Describe what floorplans are
List the advantages of developing Web Dynpro ABAP applications using
the FPM framework
Unit Summary
You should now be able to:
Describe, how Web Dynpro components can be reused
Describe the adaptation of Web Dynpro components via implicit and explicit
configuration.
Describe what floorplans are
List the advantages of developing Web Dynpro ABAP applications using
the FPM framework
Related Information
Additional information about FPM ABAP can be found in the SDN
discussion forum at https://www.sdn.sap.com/irj/scn/forum?forumID=296
Online help for the FPM ABAP can be found at http://help.sap.com. Open
the SAP NetWeaver 7.0 EhP1 documentation and enter the search term
Floorplan Manager for Web Dynpro ABAP.
Unit Overview
Developing FPM applications consists of the configuration of the underlaying
FPM components and of the development of source code sections to interact with
the FPM framework at runtime. This unit explains the configuration of the OIF,
the GAF, and the IDR component. In addition, basic programming techniques that
are needed to implement an FPM application are discussed.
Unit Objectives
After completing this unit, you will be able to:
Unit Contents
Lesson: Configuring FPM Components....................................... 56
Exercise 2: Create FPM Applications..................................... 81
Exercise 3: Define Initial Screen and Confirmation Screen............ 91
Exercise 4: Configure Toolbar and Explanation Texts .................. 95
Lesson: FPM Programming - Basics .........................................100
Exercise 5: Implement Methods of FPM-Interface .....................123
Exercise 6: Access the Toolbar at Runtime .............................131
Exercise 7: Access the IDR at Runtime .................................135
Exercise 8: Use the FPM Message manager...........................147
Lesson Overview
This lesson deals with the configuration of FPM components. This includes a
discussion of the configuration editor for FPM components. The section about
configuring the IDR component includes the definition of application title an
ticket area. The section about configuring the OIF component and of the GAF
component includes the definition of the floorplans (embedding UIBBs), the
configuration of the toolbar, the configuration of explanation texts, and the
definition of initial and confirmation screen.
Lesson Objectives
After completing this lesson, you will be able to:
Display UIBBs in floorplans of type OIF, QAF and GAF
Configure the IDR
Configure the toolbar
Configure the primary help
Configure initial screen and confirmation screen
Business Example
You know the architecture of Web Dynpro applications based on the FPM
framework. Now you would like to create your first applications. One application
should allow to display and edit details related to a flight customer. The second
application should permit the cancellation of bookings for a certain flight customer.
In order to start the creation process of the component configurations for the FPM
component and for the IDR component, mark the corresponding table line and
click the button labeled Go to Component Configuration. This will open a new
browser window and the component configuration editor will be displayed.
On the first screen, you have to enter the name of the component configuration
in the field labeled Configuration ID. To create this component configuration
press the button labeled Create.
On the following popups, enter a description, the name of the package the
component configuration should be assigned to, and the key of the transport
request.
Screen area 1:
An initial screen and a confirmation screen can be added (button Add) and deleted
again (button Delete). Multiple variants may be created. Each variant defines a
separate version of the main screen and of the confirmation screen. The concept of
configuration variants is well known from the SAP List Viewer for Web Dynpro
ABAP. Each configuration variant represents a complete set of configuration data.
At runtime, the application can decide which of the configuration variants is to
be used. The screen to configure is defined by selecting the corresponding radio
button and choosing the variant.
Screen area 2:
In the left lower corner, the single parts of the layout are represented by list entries.
On the first hierarchy level, an entry is displayed for each tab of the horizontal
contextual panel (main view). An additional entry represents the toolbar.
If a main view node is expanded, the dependent sub views related to the links are
displayed on the second hierarchy level. If a sub view node is expanded, the
UIBBs embedded by this sub view are displayed on the third hierarchy level.
UIBBs are always related to sub views. If only one sub view is defined, the related
link below the tab is not displayed at runtime. If only one main view and one sub
view is defined, the complete horizontal contextual panel is suppressed.
If the toolbar node is expanded, the toolbar elements are displayed on the second
hierarchy level.
Screen area 3:
To change the properties of any element displayed in the hierarchy, the
corresponding element has to be selected. This will also mark the table line. The
related attributes will be displayed below the preview in screen area 3 using
appropriate UI elements (e.g. check boxes, input fields, drop down boxes, tables).
Screen area 4:
This is the preview area. Toolbar and horizontal contextual panel are displayed as
they will appear at runtime. For the UIBBs, placeholders are displayed below the
horizontal contextual panel. The IDR is only displayed with a dummy title.
Screen area 5:
This area contains buttons which can be used to create new main views, new sub
views, new toolbar elements, or an explanation text. Moreover, additional UIBBs
can be embedded on a sub view.
Screen area 1:
Screen area 1:
In the hierarchical view two elements may be displayed: An entry for the basic
IDR and an entry for the extended IDR.
Screen area 2:
To change the properties of the basic IDR or the extended IDR, the corresponding
element in the hierarchy has to be selected. This will also mark the table line.
The related attributes will be displayed below the preview in screen area 2 using
appropriate UI elements (e.g. check boxes, input fields).
Hint: The items area can only be accessed from the application's source
code.
Screen area 3:
In the preview area, the application title and the ticket element are displayed as
they will appear at runtime.
Screen area 4:
A button allows to add the extended IDR.
Hint: The ticket area is not displayed if used with the GAF
component.
Hint: The ticket area can be accessed from the application's source
code. It is not necessary to configure the extended IDR statically to
be able to access this area at runtime.
Hint: The items area can only be accessed from the application's
source code.
Hint: Leaving the initial screen can also be triggered from the application.
Details can be found in the section Toolbar and FPM-Events
For the OIF, a confirmation screen should only be displayed if the object currently
processed by the application has been deleted. This can be triggered by clicking
the standard button Delete Object. As a result, the confirmation screen will be
displayed in place of the main screen.
Hint: Deleting the current object and thus navigating to the confirmation
screen can also be triggered from the application. Details can be found in
the section Toolbar and FPM-Events
Depending on the floorplan and the screen (initial screen, main screen,
confirmation screen), different sets of standard toolbar elements are offered. The
confirmation screen toolbar only contains the Close button (and for the GAF the
navigation buttons). Additional toolbar elements cannot be defined on this screen.
The Close button can not be deleted for any of the screens. However, this button
can be hidden dynamically.
Hint: Some of the toolbar functions are offered as standard buttons and
as button-choices. If both toolbar elements are added to the toolbar, the
button-choice will be suppressed.
For all toolbar elements, the property Visibility can be set. In the following, the
element-specific attributes are listed for all toolbar elements:
Toolbar Elements
Element Explana- En- Tooltip Label Sequence FPM
tion abled Index EventID
Create X
Undo X
Redo X
Load Draft X
Save Draft X
Other X X X X X X
Function
Other X and X X and X per item
Function per item per
(Choice) item
The sequence index is used to define the sequence of the application defined
toolbar elements. Elements with a lower index are positioned left of elements with
a higher index. The FPM-Event ID attribute allows to define the value (ID) of
the FPM-Event for application defined toolbar elements. For further details about
handling FPM-Events, please refer to the next lesson.
For all toolbar elements, the properties Visibility and Enabled can be set. In the
following, the element-specific attributes are listed for all toolbar elements:
Toolbar Buttons
Element Explana- Tooltip La- De- Ele- Se- FPM
tion bel fault ment quence Even-
ID Index tID
Previous X X X
Object
Next X X X
Object
Activa- X X X X X
tion Func-
tion
Alternate X X X X X
Function
Edit X X
Read X X
Only
Save As X
Save X
Draft
Load X
Draft
Print X
Preview
Print X
Send X
Start Over X
Refresh X
Undo X
Redo X
Check X X X X
New X
Other X X X X X X
Function
Delete X X X
Object
Toolbar Button-Choices
Element Tooltip Label En- Element Se- FPM
abled ID quence EventID
Index
Print per X and per item
Preview item per item
Print per X and per item
item per item
Sequence index and FPM-Event ID are explained in the section about the initial
screen toolbar. The element ID can be used to access the application defined
toolbar elements from the application's source code.
For all toolbar elements, the property Visibility can be set. In the following, the
element-specific attributes are listed for all toolbar elements:
Toolbar Elements
Element Explana- En- Tooltip La- Ele- Se- FPM
tion abled bel ment quence Even-
ID Index tID
Finish X X
Save X X
Draft
Other X X X X X X X
Function
Other X and X X X X per
Function per and item
(Choice) item per
item
Exit to X X
Main
Step
Sequence index, element ID, and FPM-Event ID are explained in the section
about the OIF toolbar.
Business Example
You would like to create FPM applications embedding the interface views of your
components ZNET313_##_BOOKING_S1 and ZNET313_##_CUSTOMER_S1,
respectively. The UIBBs of your first component should define the screens of
a GAF, while the UIBBs related to your second component should define the
screens of an OIF.
Solution Applications:
NET313_BOOKING_S1
NET313_CUSTOMER_S1
Solution Application Configurations:
NET313_BOOKING_S1_AC1
NET313_CUSTOMER_S1_AC1
Solution Component Configurations:
NET313_BOOKING_S1_CC1
NET313_BOOKING_S1_IDR
NET313_CUSTOMER_S1_CC1
NET313_CUSTOMER_S1_IDR
Task 1:
Create an application pointing on the FPM component FPM_OIF_COMPONENT.
Name this application ZNET313_##_CUSTOMER_S1.
Create a second application pointing on the FPM component
FPM_GAF_COMPONENT. Name this application ZNET313_##_BOOKING_S1
1. Create an application pointing on the FPM component FPM_OIF_COMPO-
NENT. Name this application ZNET313_##_CUSTOMER_S1.
Continued on next page
Task 2:
For each of the applications, create an application configuration having the name
of the component plus a suffix _AC1.
1. For the application ZNET313_##_CUSTOMER_S1, create the application
configuration ZNET313_##_CUSTOMER_S1_AC1.
2. For the application ZNET313_##_BOOKING_S1, create the application
configuration ZNET313_##_BOOKING_S1_AC1.
Task 3:
For each of the application configurations define, which component configuration
is used to configure the FPM component and the IDR component, respectively.
The name of the FPM component configuration should equal the application name
plus the suffix _CC1. The name of the IDR component configuration should equal
the application name plus the suffix _IDR. Create the component configurations.
1. For the application configuration ZNET313_##_CUSTOMER_S1_AC1,
assign a component configuration to each of the components. Name the
component configurations ZNET313_##_CUSTOMER_S1_CC1 and
ZNET313_##_CUSTOMER_S1_IDR, respectively.
2. Create the component configurations.
3. For the application configuration ZNET313_##_BOOKING_S1_AC1,
assign a component configuration to each of the components. Name
the component configurations ZNET313_##_BOOKING_S1_CC1 and
ZNET313_##_BOOKING_S1_IDR, respectively.
4. Create the component configurations.
Task 4:
The OIF should display UIBBs related to component ZNET313_##_CUS-
TOMER_S1. On the first tab, the interface view CUSTOMER_WINDOW
(customer details) should be displayed. The second tab should display two sub
views. On the first sub view, the interface view BOOKINGS_N_WINDOW
(non-cancelled bookings) should be embedded, while on the second sub view the
interface view BOOKINGS_C_WINDOW (cancelled bookings) is to be displayed.
1. Edit the component configuration ZNET313_##_CUSTOMER_S1_CC1.
2. Define an OIF consisting of two tabs and (on the second tab) two sub views.
Display the texts Customer (first tab), Bookings (second tab), not cancelled
(first link related to second tab), and cancelled (second link related to second
tab).
3. Assign the UIBBs to the sub views.
Task 5:
The GAF should display UIBBs of component ZNET313_##_BOOKING_S1. The
first roadmap step should be related to the interface view CUSTOMER_WINDOW
(customer details). The next main steps should display related flights (IF
FLIGHTS_WINDOW), bookings (IF BOOKINGS_WINDOW), and again the
bookings selected by the user (IF CHECK_WINDOW).
1. Edit the component configuration ZNET313_##_BOOKING_S1_CC1.
2. Define a roadmap consisting of four roadmap steps. Display the texts Select
customer (first step), Select flights (second step), Select bookings (third step),
and Check data (last step).
3. Assign the UIBBs to the roadmap steps.
Task 6:
The IDR of the OIF application should display the application title NET313:
Customer details, while the IDR of the GAF application should display the text
NET313: Cancel bookings.
1. Define the IDR of the OIF application.
2. Define the IDR of the GAF application.
Task 7:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
2. Start the FPM application displaying the GAF.
Task 2:
For each of the applications, create an application configuration having the name
of the component plus a suffix _AC1.
1. For the application ZNET313_##_CUSTOMER_S1, create the application
configuration ZNET313_##_CUSTOMER_S1_AC1.
a) From the context menu of the application, choose Create / Change
Configuration.
b) In the browser application, enter ZNET313_##_CUSTOMER_S1_AC1
in the field labeled Configuration ID. Click the button labeled Create.
c) In the following popup, enter a description (e.g. Display / change
customer) and the package name ZNET313_##. Click OK.
d) On the next popup confirm the transport request number and click OK.
Task 3:
For each of the application configurations define, which component configuration
is used to configure the FPM component and the IDR component, respectively.
The name of the FPM component configuration should equal the application name
plus the suffix _CC1. The name of the IDR component configuration should equal
the application name plus the suffix _IDR. Create the component configurations.
1. For the application configuration ZNET313_##_CUSTOMER_S1_AC1,
assign a component configuration to each of the components. Name the
component configurations ZNET313_##_CUSTOMER_S1_CC1 and
ZNET313_##_CUSTOMER_S1_IDR, respectively.
a) Edit your application configuration. Double clicking the application
configuration in the object tree of transaction SE80 will display the
item in the object area. Clicking the button Start Configurator will
open the browser based application configuration editor.
b) In the browser application click the button labeled Change.
c) Enter ZNET313_##_CUSTOMER_S1_CC1 in the column labeled
Configuration for the component FPM_OIF_COMPONENT.
d) Enter ZNET313_##_CUSTOMER_S1_IDR in the column labeled
Configuration for the component FPM_IDR_COMPONENT.
e) Save (ignore the warnings).
2. Create the component configurations.
a) Mark the first line of the table and click on the button labeled Go to
Component Configuration. This will open the component configuration
editor.
b) Click on the button labeled Create. On the following popups enter a
description and the package ZNET313_## and confirm the transport
request number.
c) Go back to your application configuration. Mark the second line of the
table and click on the button labeled Go to Component Configuration.
d) Click on the button labeled Create. On the following popups enter a
description and the package ZNET313_## and confirm the transport
request number.
Task 4:
The OIF should display UIBBs related to component ZNET313_##_CUS-
TOMER_S1. On the first tab, the interface view CUSTOMER_WINDOW
(customer details) should be displayed. The second tab should display two sub
views. On the first sub view, the interface view BOOKINGS_N_WINDOW
(non-cancelled bookings) should be embedded, while on the second sub view the
interface view BOOKINGS_C_WINDOW (cancelled bookings) is to be displayed.
1. Edit the component configuration ZNET313_##_CUSTOMER_S1_CC1.
a) Double click the corresponding item in the object tree of the Object
Navigator. This will display the configuration's meta data in the object
area.
b) Click on the button labeled Start Configurator. This will open the
component configuration editor.
c) Click the button Change in the component configuration editor.
2. Define an OIF consisting of two tabs and (on the second tab) two sub views.
Display the texts Customer (first tab), Bookings (second tab), not cancelled
(first link related to second tab), and cancelled (second link related to second
tab).
a) Click on the button labeled Add Main View in order to define a second
tab.
b) Mark the second tab in the hierarchy.
c) Click the button labeled Add Subview. This will add a second sub view
to the second tab.
d) Mark the first tab. The attributes related to this tab will be displayed
below the preview area.
e) Enter the text Customer in the field labeled Mainview name.
f) Mark the second tab.
g) Enter the text Bookings in the field labeled Mainview name.
h) Mark the first sub view related to the Bookings tab.
i) Enter the text not cancelled in the field labeled Subview name.
j) Mark the second sub view related to the Bookings tab.
k) Enter the text cancelled in the field labeled Subview name.
3. Assign the UIBBs to the sub views.
a) Mark the first tab.
b) Click the button Attributes displayed in the preview area.
c) Enter ZNET313_##_CUSTOMER_S1 in the field labeled Component
and CUSTOMER_WINDOW in the field labeled View.
d) Mark the sub view related to non-cancelled bookings.
e) Click the button Attributes displayed in the preview area.
f) Enter ZNET313_##_CUSTOMER_S1 in the field labeled Component
and BOOKINGS_N_WINDOW in the field labeled View.
g) Mark the sub view related to cancelled bookings.
h) Click the button Attributes displayed in the preview area.
i) Enter ZNET313_##_CUSTOMER_S1 in the field labeled Component
and BOOKINGS_C_WINDOW in the field labeled View.
j) Save your changes.
Task 5:
The GAF should display UIBBs of component ZNET313_##_BOOKING_S1. The
first roadmap step should be related to the interface view CUSTOMER_WINDOW
(customer details). The next main steps should display related flights (IF
FLIGHTS_WINDOW), bookings (IF BOOKINGS_WINDOW), and again the
bookings selected by the user (IF CHECK_WINDOW).
1. Edit the component configuration ZNET313_##_BOOKING_S1_CC1.
a) Proceed as described in the last task.
2. Define a roadmap consisting of four roadmap steps. Display the texts Select
customer (first step), Select flights (second step), Select bookings (third step),
and Check data (last step).
a) Click three times on the button labeled Add Main Step in order to define
three additional roadmap steps.
b) Mark each roadmap step in the hierarchy in order to edit its attributes.
c) For each roadmap step, enter the name to be displayed in the field
labeled Mainstep name.
3. Assign the UIBBs to the roadmap steps.
a) Mark the first roadmap step.
b) Click the button Attributes displayed in the preview area.
c) Enter ZNET313_##_BOOKING_S1 in the field labeled Component and
CUSTOMER_WINDOW in the field labeled View.
d) Repeat this procedure for the second roadmap step (FLIGHTS_WIN-
DOW), the third roadmap step (BOOKINGS_WINDOW), and the last
roadmap step (CHECK_WINDOW).
e) Save your changes.
Task 6:
The IDR of the OIF application should display the application title NET313:
Customer details, while the IDR of the GAF application should display the text
NET313: Cancel bookings.
1. Define the IDR of the OIF application.
a) Edit the IDR component configuration ZNET313_##_CUS-
TOMER_S1_IDR used in the application configuration
ZNET313_##_CUSTOMER_S1_AC1.
b) Select the item IDR Basic in the hierarchy.
c) Enter the application title in the field labeled Application title.
d) Save.
2. Define the IDR of the GAF application.
a) Edit the IDR component configuration ZNET313_##_BOOK-
ING_S1_IDR used in the application configuration
ZNET313_##_BOOKING_S1_AC1.
b) Select the item IDR Basic in the hierarchy.
c) Enter the application title in the field labeled Application title.
d) Save.
Task 7:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
2. Start the FPM application displaying the GAF.
a) From the context menu of your application configuration
ZNET313_##_BOOKING_S1_AC1, select Test to start the related FPM
application.
Business Example
You would like to add initial screens to both of your FPM applications and a
confirmation screen to your FPM application implementing a GAF.
Solution Component Configurations:
NET313_BOOKING_S2_CC1
NET313_CUSTOMER_S2_CC1
Task 1:
For both FPM applications add an initial screen to the floorplan. Embed the UIBB
INTRO_WINDOW available in both of your WD components.
1. Add an initial screen to your FPM application ZNET313_##_BOOKING_S1.
2. Add an initial screen to your FPM application ZNET313_##_CUSTOMER_S1.
Task 2:
For the GAF application, add a confirmation screen to the floorplan. This
confirmation screen should display the interface view CONFIRMATION_WINDOW
of the component ZNET313_##_BOOKING_S1.
1. Add the confirmation screen to your GAF application.
Task 3:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
2. Start the FPM application displaying the GAF.
Task 2:
For the GAF application, add a confirmation screen to the floorplan. This
confirmation screen should display the interface view CONFIRMATION_WINDOW
of the component ZNET313_##_BOOKING_S1.
1. Add the confirmation screen to your GAF application.
a) Display your component configuration ZNET313_##_BOOK-
ING_S1_CC1 by the configuration configuration editor.
b) Click the button Change.
c) On the next screen, click the button choice Add located above the
hierarchy. Select the item Confirmation Screen. This will mark the
radio button labeled Confirmation Screen in the radio button group
above the button choice.
d) Edit the attributes of the UIBB. Set Component = ZNET313_##_BOOK-
ING_S1 and Window = CONFIRMATION_WINDOW.
e) Save.
Task 3:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
b) This application should display an initial screen but no confirmation
screen.
2. Start the FPM application displaying the GAF.
a) From the context menu of your application configuration
ZNET313_##_BOOKING_S1_AC1, select Test to start the related FPM
application.
b) This application should display an initial screen and (related to the last
roadmap step) the confirmation screen.
Business Example
You would like to adapt the toolbar of your FPM application via configuration. In
addition, you would like to display explanation texts on each screen displayed to
the user.
Solution Component Configurations::
NET313_BOOKING_S3_CC1
NET313_CUSTOMER_S3_CC1
Task 1:
Add a button to the toobar of the OIF application. This button will be used to
toggle the edit mode of the form fields displayed on the first tab (customer details).
Make sure that the toolbar is displayed above and below the tabs.
1. Add a button to the toolbar of the FPM application ZNET313_##_CUS-
TOMER_S1. This button should display the text Display/Change Customer.
In addition, choose FPM-Event ID = EDIT_TOGGLE and Element ID =
CUSTOMER_TOGGLE.
2. Make sure, that the toolbar is displayed above and below the tabs.
Task 2:
Add explanation texts to each roadmap step of your GAF application. The
explanation texts should describe what the user has to do on the related screen.
1. Add explanation texts to each roadmap step of the GAF application. Assign
texts to the attribute Text of each explanation element.
Task 3:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
Task 2:
Add explanation texts to each roadmap step of your GAF application. The
explanation texts should describe what the user has to do on the related screen.
1. Add explanation texts to each roadmap step of the GAF application. Assign
texts to the attribute Text of each explanation element.
a) Display your component configuration ZNET313_##_BOOK-
ING_S1_CC1 by the component configuration editor.
b) Click the button Change.
c) On the next screen, mark the first roadmap step in the hierarchy. Click
the button Add Explanation to assign an explanation step to the first
roadmap step. Assign a meaningful text to the attribute Text of the
explanation element.
d) Repeat this procedure for all roadmap steps.
e) Save.
Task 3:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
b) This application should now display an additional button in the toolbar.
2. Start the FPM application displaying the GAF.
Lesson Summary
You should now be able to:
Display UIBBs in floorplans of type OIF, QAF and GAF
Configure the IDR
Configure the toolbar
Configure the primary help
Configure initial screen and confirmation screen
Lesson Overview
This lesson discusses the basic FPM programming techniques. This includes
the handling of FPM-Events (triggered by clicking toolbar elements), the firing
of FPM-Events from the application source code, the manipulation of the
FPM toolbar at runtime, the activation of roadmap sub steps for the GAF, the
manipulation of the IDR, and the usage of the FPM message manager to send
messages.
Lesson Objectives
After completing this lesson, you will be able to:
Handle FPM-Events
Fire FPM-Events from the application source code
Access the FPM toolbar and the IDR at runtime
Use the FPM message manager
Business Example
You need to learn more about the FPM framework since you would like to react
on toolbar elements clicked by the user, and you would like to manipulate the
FPM toolbar and the page header at runtime. In addition you would like to send
messages using the FPM message manager.
PROCESS_EVENT X X X
AFTER_FAILED_EVENT X X X
PROCESS_BEFORE_OUT- X X
PUT
Toolbar element:
<TE> (e.g. SEND)
Value of IO_EVENT->MV_EVENT_ID (FPM-Event ID):
'FPM_<TE>' (e.g. 'FPM_SEND')
Constant containing this value:
CL_FPM_EVENT=>GC_EVENT_<TE> (e.g.
CL_FPM_EVENT=>GC_EVENT_SEND)
Exceptions from this Rule
START on the initial screen. Here the FPM-Event ID is set to
FPM_LEAVE_INITIAL_SCREEN.
DELETE OBJECT may be displayed in the OIF toolbar. Here the
FPM-Event ID is set to FPM_DELETE_CURRENT_OBJECT.
Most of the FPM-Events have to be handled by the application. Only the Start
button on the initial screen, the navigation buttons for the GAF component and
the Close button are handled by the FPM component.
Reacting on FPM-Events
The methods provided by the interface IF_FPM_UI_BUILDING_BLOCK are
used in the following context:
FLUSH( ):
This method is triggered for all UIBBs that have been displayed on the
previous screen. In this method, data of different UIBBs may be transported
to a central data model. For UIBBs belonging to the same component,
context mapping is used to store the data in the common component
controller. In this case, this method is not used.
NEEDS_CONFIRMATION( ):
This method is processed directly after the method FLUSH( ) for
all UIBBs displayed on the previous screen . Each UIBB can
request a data-loss popup to be displayed. This can be triggered
from the source code of this method by evaluating the exporting
parameter EO_CONFIRMATION_REQUEST with the constant
CL_FPM_CONFIRMATION_REQUEST=>GO_DATA_LOSS.
PROCESS_EVENT( ):
In this method which is processed for all UIBBs displayed on the previous
screen, actions specific to the FPM-Event are performed (e.g. printing,
checking, saving). Depending on the result, the exporting parameter
EV_RESULT should be set as follows:
IF_FPM_CONSTANTS=>GC_EVENT_RESULT-OK (successful - this
is the default, thus setting this value is optional)
IF_FPM_CONSTANTS=>GC_EVENT_RESULT-FAILED (not
successful)
IF_FPM_CONSTANTS=>GC_EVENT_RESULT-DEFER (not
successful - further user input required)
In the later two cases, the method AFTER_FAILED_EVENT( ) is triggered
afterwards.
AFTER_FAILED_EVENT( ):
This method should contain the code to rollback the actual UIBB to the
last consistent state if event processing was not successful. This method
may also be triggered if the actual UIBB was processed successfully, but
processing of another UIBB was not successful. This is indicated by the
importing parameter IV_REVERT.
PROCESS_BEFORE_OUTPUT( ):
This method is processed for the UIBBs embedded on the next screen
displayed to the user. Here, corresponding data should be read.
In the following, defining new buttons and button choices for the OIF is displayed
exemplarily:
Toolbar element:
<TE> (e.g. SEND)
Constant to identify the toolbar element:
IF_FPM_CONSTANT=>GC_BUTTON-<TE>, if <TE> is a button.
IF_FPM_CONSTANT=>GC_BUTTON_CHOICE-<TE>, if <TE>
is a button choice.
(e.g. IF_FPM_CONSTANT=>GC_BUTTON-SEND)
Exceptions from this Rule
SAVE in the OIF toolbar. This is a predefined button of type Activation
Function. Thus the constant IF_FPM_CONSTANT=>GC_BUTTON-
ACTIVATION_FUNCTION has to be used to access this button. In
addition, the element ID has to be provided since multiple activation
functions may exist.
DELETE OBJECT in the OIF toolbar. Here the constant
IF_FPM_CONSTANT=>GC_BUTTON-DELETE has to be used to
access the button.
For the GAF, each main step and each sub step has its own toolbar. In addition,
for each main step multiple sub step variants may be defined. Thus, the methods
to create new buttons and new button choices in the toolbar of the GAF contain
three additional importing parameters:
IV_MAINSTEP_ID:
ID of the main step, the toolbar is related to. This parameter is optional (as of
SAP NetWeaver 7.0 EhP1 SAP_ABA SPS 2). If this optional parameter is
not supplied, the toolbar of the current main step will be accessed.
IV_SUBTEP_ID:
ID of the sub step, the toolbar is related to. If this optional parameter is not
supplied, the toolbar of the current main step will be accessed.
IV_SUBVARIANT_ID:
ID of the substep variant, the toolbar is related to. If this optional parameter
is not supplied, but the parameter IV_SUBTEP_ID is supplied, all changes
will be conducted for the current substep variant.
Hint: The ID of each sub step variant can be defined in the Configuration
Editor as follows: First, the sub step variant has to be marked in the
hierarchy displayed on the left side. Next, the menu item Substep Variant
Parameters has to be selected from the button choice Change. A popup
will open. The ID of the sub step variant can then be entered in the field
labeled Substep Variant ID.
In the following, defining new buttons for the GAF is described exemplarily.
Creating button choices for the GAF is not displayed.
The header area and the ticket area can be configured statically. However, the
item area can not be defined statically. In order to define the content of the
item area and to change the content of the header area and the ticket area at
runtime, methods of the IDR service object have to be used. A reference to
this object can be obtained by calling the method GET_SERVICE( ) for the
FPM service object. This method is also used to access the toolbar service
objects for the OIF and for the GAF. However, in order to access the IDR, the
importing parameter IV_SERVICE_KEY has to be evaluated with the constant
CL_FPM_SERVICE_MANAGER=>GC_KEY_IDR. The returned object is
described by the interface IF_FPM_IDR.
The methods of the IDR service object can be classified as follows:
Methods acting on the header area:
GET_APPLICATION_TITLE( ) - get text and tooltip of application
title.
SET_APPLICATION_TITLE( ) - change text and tooltip of
application title.
SET_HEADER_VISIBILITY( ) - change visibility of application title.
Methods acting on the ticket area:
GET_TICKET( ) - get texts and tooltips displayed in ticket area (top
and bottom).
SET_TICKET( ) - change texts and tooltips displayed in ticket area
(top and bottom).
Figure 73: IDR - adding images to the items area / delete item groups
The methods of the FPM message manager object can be classified as follows:
Methods used to report messages:
REPORT_MESSAGE( ) - report message based on simple text literal.
Message text is mandatory.
REPORT_T100_MESSAGE( ) - report message based on T100
database content. Message class and number are mandatory.
REPORT_BAPIRET2_MESSAGE( ) - report message based on return
structure of BAPI call. This structure is mandatory.
REPORT_OBJECT_MESSAGE( ) - report message based on an
exception object. Exception object is mandatory.
Methods used to raise the exception CX_FPM_EXCEPTION. This will
create a dump:
RAISE_EXCEPTION( ) - exception text is based on an arbitrary text
literal (if supplied).
RAISE_T100_EXCEPTION( ) - exception text is based on T100
database content. Message class and number are mandatory.
RAISE_BAPIRET2_EXCEPTION( ) - exception text is based on
return structure of BAPI call. This structure is mandatory.
RAISE_CX_ROOT_EXCEPTION( ) - exception text is based on
exception object inheriting from CX_ROOT or subclass. Exception
object is mandatory.
Other methods:
CLEAR_MESSAGES( ) - remove messages from message stack.
Interface parameters allow to exclude messages according to their type
and component relation.
In the following, the main differences between the standard WD message manager
and the FPM message manager are summarized:
For each text category (simple text, T100 text, text from exception objects),
only one method exists to send this text as a message of type error, warning,
or success.
The message type (SUC, WRN, ERR) and an optional binding to a single
attribute or to multiple attributes of the same context element is defined via
parameters of this method.
For error messages, the navigation is cancelled automatically (if send in the
hook method WDDOBEFORENAVIGATION( ) or in a method processed
before). There is no differentiation between fatal errors, errors, and errors
related to context attributes.
The BAPI returning structure (type BAPIRET2) can be passed directly to a
corresponding method of the FPM message manager.
Clearing the messages stored in the message manager can be restricted to
certain message types.
The lifetime and visibility of messages is handled according to the UI
guidelines. Instead of the parameters CONTROLLER_PERMANENT_MSG,
IS_PERMANENT and SCOPE_PERMANENT_MSG (generic WD message
manager), the parameters IO_COMPONENT, IO_CONTROLLER, and
IV_LIFETIME are used.
Business Example
You would like to implement the application logic. This includes the handling of
FPM-Events, the identification of UIBBs displayed to the user on the previous
and on the next screen, cancelling the navigation to the next UIBB if necessary,
or sending data loss popups if needed.
Thus you need to put your code in the methods related to the interface
IF_FPM_UI_BUILDING_BLOCK
Solution Components:
NET313_BOOKING_S4
NET313_CUSTOMER_S3
Task 1:
Implement the source code of your GAF application.
1. Go on edit the component ZNET313_##_BOOKING_S1. Implement the
source code of the component controller method PROCESS_EVENT( ).
Process the source code of this method only, if the user clicked the button
labeled Next Step. Check the name of the last UIBB displayed to the user.
If this name equals CUSTOMER_WINDOW, get the flights the customer
booked.
If this name equals FLIGHTS_WINDOW, get the booking information
for the flights the customer booked.
If this name equals BOOKINGS_WINDOW, get the bookings selected by
the user.
If this name equals CHECK_WINDOW, cancel the selected bookings.
For all four steps, a corresponding controller method has to be called. All
methods return the information if proceeding the method was successful
via the returning parameter RV_RESULT. If proceeding the method was
not successful, cancel the navigation.
Task 2:
Implement the source code of the OIF application.
1. Implement the source code of the component controller method
PROCESS_EVENT( ). Process the source code of this method only, if the
user clicked the button labeled Save or the button labeled Display/Change
Customer.
If the user clicked the button labeled Display/Change Customer, toggle the
editability of the customer form fields.
If the user clicked the Save button, update the customer data.
If updating the customer data was successful, reset the context change log.
Task 3:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
2. Start the FPM application displaying the GAF.
Task 2:
Implement the source code of the OIF application.
1. Implement the source code of the component controller method
PROCESS_EVENT( ). Process the source code of this method only, if the
user clicked the button labeled Save or the button labeled Display/Change
Customer.
If the user clicked the button labeled Display/Change Customer, toggle the
editability of the customer form fields.
If the user clicked the Save button, update the customer data.
If updating the customer data was successful, reset the context change log.
a) The name of the FPM-Event related to the client side event is available
the interface parameter IO_EVENT
b) Use the component controller methods TOGGLE_EDIT_MODE( ),
and UPDATE_CUSTOMER( ), respectively.
c) The context change log is cleared if the method RESET_CON-
TEXT_CHANGE_LOG( ) of the component controller attribute
GO_CONTEXT is called.
d) Please find the source code at the end of this exercise.
2. Implement the source code of component controller method
NEEDS_CONFIRMATION( ).
Check if the user clicked the button labeled Close. In this case, check if the
context change log is empty. If the log is not empty (which means that data
have been changed by the user, but these changes have not been written to
the data base yet), display a data loss popup.
a) The name of the FPM-Event related to the client side event is available
the interface parameter IO_EVENT
b) The content of the context change log is accessible via the method
GET_CONTEXT_CHANGE_LOG( ) related to the component
controller attribute GO_CONTEXT.
Task 3:
Test your FPM applications.
1. Start the FPM application displaying the OIF.
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
b) Try to close your application after having changed customer data. A
data loss popup should appear.
c) Try to close your application not having changed customer data. No
data loss popup should appear.
d) Try to close your application after having changed customer data and
saved the data. No data loss popup should appear.
e) The cancelled and the non-cancelled bookings should be displayed on
the second tab.
2. Start the FPM application displaying the GAF.
a) From the context menu of your application configuration
ZNET313_##_BOOKING_S1_AC1, select Test to start the related FPM
application.
b) If no flights are selected, the navigation should be cancelled. If flights
are selected, the corresponding bookings should be displayed on the
next page.
Result
GAF: Component Controller - PROCESS_EVENT( )
METHOD process_event.
CASE lv_interface_view.
* if interface view was CUSTOMER_WINDOW, read flights for customer
* stay on page if no flights could be read
WHEN 'CUSTOMER_WINDOW'.
lv_result = wd_this->get_flights( ).
IF lv_result = abap_false.
ev_result = if_fpm_constants=>gc_event_result-failed.
ENDIF.
* if interface view was FLIGHTS_WINDOW, read bookings for on flights
* stay on page if no bookings could be read
WHEN 'FLIGHTS_WINDOW'.
lv_result = wd_this->get_bookings( ).
IF lv_result = abap_false.
ev_result = if_fpm_constants=>gc_event_result-failed.
ENDIF.
* if interface view was BOOKINGS_WINDOW, check for selected bookings
* stay on page if no bookings were selected
WHEN 'BOOKINGS_WINDOW'.
lv_result = wd_this->get_selected_bookings( ).
IF lv_result = abap_false.
ev_result = if_fpm_constants=>gc_event_result-failed.
ENDIF.
* if interface view was CHECK_WINDOW, try to cancel bookings on DB
ENDMETHOD.
CASE io_event->mv_event_id.
* if EDIT_TOGGLE was selected, toggle edit mode
WHEN 'EDIT_TOGGLE'.
wd_this->toggle_edit_mode( ).
* if SAVE was selected, update customer data
WHEN cl_fpm_event=>gc_event_save.
lv_result = wd_this->update_customer( ).
IF lv_result = abap_false.
ELSE.
* if update was successful, clear context change log
wd_this->go_context->reset_context_change_log( ).
ENDIF.
ENDCASE.
ENDMETHOD.
CASE io_event->mv_event_id.
* if CLOSE was selected
WHEN cl_fpm_event=>gc_event_close.
* get context change log (internal table)
lt_change_log = wd_this->go_context->get_context_change_log(
and_reset = abap_false ).
IF lt_change_log IS NOT INITIAL.
* if context change log contains any data, send data loss popup
eo_confirmation_request = cl_fpm_confirmation_request=>go_data_loss.
ENDIF.
ENDCASE.
ENDMETHOD.
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->get_customer( ).
ENDMETHOD.
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->get_bookings( ).
ENDMETHOD.
Business Example
Depending on the screen displayed to the user, you would like to adapt the
properties of a toolbar button displayed by your OIF component.
Solution Component:
NET313_CUSTOMER_S4
Task:
Check, which information will be displayed to the user on the next screen. If
the customer form will be displayed, enable the button labeled Display/Change
Customer. If bookings will be displayed to the user, disable this button.
1. Get the reference to the FPM service object and to the OIF service object and
store these reference in attributes of the component controller. Encapsulate
the code in the hook method WDDOINIT( ).
2. Implement the source code of the component controller method
PROCESS_BEFORE_OUTPUT( ). Check the name of the next UIBB
displayed to the user. If this name equals CUSTOMER_WINDOW, enable
the toolbar button labeled Display/Change Customer. For all other cases,
disable the toolbar button.
Result
OIF: Component Controller - WDDOINIT( )
METHOD wddoinit .
ENDMETHOD.
iv_function = if_fpm_constants=>gc_button-other_function
iv_element_id = 'CUSTOMER_TOGGLE'
iv_enabled = abap_false ).
ENDIF.
ENDMETHOD.
Business Example
You would like to adapt the application title, the ticket area, and the items area
displayed by your OIF application at runtime.
Solution Component:
NET313_CUSTOMER_S5
Task 1:
When navigating from the initial screen to the customer form, the customer
data is read from the data base using the component controller method
GET_CUSTOMER( ). This method is called from the hook method WDDOINIT( )
of the view CUSTOMER_VIEW.
Create a new component controller method (name: INIT_IDR( )) encapsulating
the code to adapt the application title. Call this new method from the hook method
WDDOINIT( ) of the view CUSTOMER_VIEW. Position the call directly behind
the call of method GET_CUSTOMER( ).
Hint: The application title should read 'Customer <no>', where <no> is
the ID of the customer selected on the initial screen.
1. Get the reference to the IDR service object and store this reference in a
component controller attribute. Define the related source code in the hook
method WDDOINIT( ).
2. Create a new component controller method having the name INIT_IDR( ).
Call this method from the source code of the method WDDOINIT( ) related
to the view CUSTOMER_VIEW.
3. Implement the source code of method INIT_IDR( ):
Get the current customer data from the component controller context.
Then get the text with the symbol '006' from the assistance class.
Concatenate this text and the customer ID. This will define the application's
title.
Get the text with the symbol '007' from the assistance class. This will define
the tooltip of the application title.
Now you can set the new application title by calling the method
SET_APPLICATION_TITLE( ) of the IDR service object.
Task 2:
Optional part 1
Adapt the ticket area. Display the current customer name in line one and the city
in line two. If the customer data is changed by the user, these two lines need to
be synchronized with the current form field values.
1. Create a new component controller method having the name
SET_IDR_TICKET( ). This method should have an importing parameter
(name: IS_CUSTOMER, type: SCUSTOM). Call this method from the source
code of the component controller method INIT_IDR( ).
2. Edit the component controller method FLUSH( ). Check, if the context
change log contains any entries. If this is the case, read the current customer
data from the context. Then call the method SET_IDR_TICKET( ) and pass
the current customer data to this method.
3. Implement the source code of method SET_IDR_TICKET( ):
Get the text with the symbol '008' from the assistance class. This will define
the tooltip of line one (ticket top).
Get the text with the symbol '009' from the assistance class. This will define
the tooltip of line two (ticket bottom).
Call the method SET_TICKET( ) of the IDR service object to actualize the
ticket area. Display the customer name on the first line (ticket top) and the
city in the second line (ticket bottom).
Task 3:
Optional part 2
Adapt the items area. Display the current status of the customer data (unchanged /
changed but not saved / changed and saved).
1. Create a new component controller method having the name
SET_IDR_ITEMS( ). This method should have an importing parameter
(name: IV_STATE, type: C). Call this method from the source code of the
component controller method INIT_IDR( ). Pass the value 'I' (initial) to
the method.
2. Edit the component controller method FLUSH( ). In case that the user
changed any customer data, do not only call the method SET_IDR_TICKET(
) but also the method SET_IDR_ITEMS( ). Pass the value 'M' (modified) to
the method.
3. Edit the component controller method PROCESS_EVENT( ). If saving the
customer data was successful and the context log file was cleared, call the
method SET_IDR_ITEMS( ). Pass the value 'S' (saved) to the method.
4. Implement the source code of method SET_IDR_ITEMS( ):
Define an internal table of type IF_FPM_IDR=>T_ITEMS_VAL and a
corresponding work area. Define one item to be displayed in the item area by
adding one line to the internal table. Set the fields of the work area as follows:
VALUE: Depending on the status (importing parameter IV_STATE) of
the customer data, get a text to be displayed as the item's value from
the assistance class. Appropriate text symbols are '011' (initial), '012'
(modified), and '013' (saved).
VALUE_TOOLTIP: Get the text with the symbol '014' from the assistance
class.
LABEL_NAME and LABEL_TOOLTIP: Get the text with the symbol '010'
from the assistance class.
Call the method INITIALIZE_ITEMS( ) to delete all existing item groups.
Then call the method ADD_ITEM_GROUP_BY_VAL( ) to define a new
item group. Pass the internal table to this method.
Task 4:
Test your OIF application.
1. Start the FPM application displaying the OIF.
Hint: The application title should read 'Customer <no>', where <no> is
the ID of the customer selected on the initial screen.
1. Get the reference to the IDR service object and store this reference in a
component controller attribute. Define the related source code in the hook
method WDDOINIT( ).
a) Edit the component controller of your component ZNET313_##_CUS-
TOMER_S1.
b) Define a new attribute of reference type IF_FPM_IDR. Name this
attribute GO_FPM_IDR.
c) Now edit the component controller method WDDOINIT( ).
d) Call the method GET_SERVICE( ) for the FPM service object.
Evaluate the importing parameter IV_SERVICE_KEY with the constant
CL_FPM_SERVICE_MANAGER=>GC_KEY_IDR. This will return
the reference to the IDR service object. Store this reference in the
controller attribute GO_FPM_IDR.
e) Please find the source code at the end of this exercise.
2. Create a new component controller method having the name INIT_IDR( ).
Call this method from the source code of the method WDDOINIT( ) related
to the view CUSTOMER_VIEW.
a) Please find the source code at the end of this exercise.
3. Implement the source code of method INIT_IDR( ):
Get the current customer data from the component controller context.
Then get the text with the symbol '006' from the assistance class.
Concatenate this text and the customer ID. This will define the application's
title.
Continued on next page
Get the text with the symbol '007' from the assistance class. This will define
the tooltip of the application title.
Now you can set the new application title by calling the method
SET_APPLICATION_TITLE( ) of the IDR service object.
a) Please find the source code at the end of this exercise.
Task 2:
Optional part 1
Adapt the ticket area. Display the current customer name in line one and the city
in line two. If the customer data is changed by the user, these two lines need to
be synchronized with the current form field values.
1. Create a new component controller method having the name
SET_IDR_TICKET( ). This method should have an importing parameter
(name: IS_CUSTOMER, type: SCUSTOM). Call this method from the source
code of the component controller method INIT_IDR( ).
a) Please find the source code at the end of this exercise.
2. Edit the component controller method FLUSH( ). Check, if the context
change log contains any entries. If this is the case, read the current customer
data from the context. Then call the method SET_IDR_TICKET( ) and pass
the current customer data to this method.
a) Please find the source code at the end of this exercise.
3. Implement the source code of method SET_IDR_TICKET( ):
Get the text with the symbol '008' from the assistance class. This will define
the tooltip of line one (ticket top).
Get the text with the symbol '009' from the assistance class. This will define
the tooltip of line two (ticket bottom).
Call the method SET_TICKET( ) of the IDR service object to actualize the
ticket area. Display the customer name on the first line (ticket top) and the
city in the second line (ticket bottom).
a) Please find the source code at the end of this exercise.
Task 3:
Optional part 2
Adapt the items area. Display the current status of the customer data (unchanged /
changed but not saved / changed and saved).
1. Create a new component controller method having the name
SET_IDR_ITEMS( ). This method should have an importing parameter
(name: IV_STATE, type: C). Call this method from the source code of the
component controller method INIT_IDR( ). Pass the value 'I' (initial) to
the method.
a) Please find the source code at the end of this exercise.
2. Edit the component controller method FLUSH( ). In case that the user
changed any customer data, do not only call the method SET_IDR_TICKET(
) but also the method SET_IDR_ITEMS( ). Pass the value 'M' (modified) to
the method.
a) Please find the source code at the end of this exercise.
3. Edit the component controller method PROCESS_EVENT( ). If saving the
customer data was successful and the context log file was cleared, call the
method SET_IDR_ITEMS( ). Pass the value 'S' (saved) to the method.
a) Please find the source code at the end of this exercise.
4. Implement the source code of method SET_IDR_ITEMS( ):
Define an internal table of type IF_FPM_IDR=>T_ITEMS_VAL and a
corresponding work area. Define one item to be displayed in the item area by
adding one line to the internal table. Set the fields of the work area as follows:
VALUE: Depending on the status (importing parameter IV_STATE) of
the customer data, get a text to be displayed as the item's value from
the assistance class. Appropriate text symbols are '011' (initial), '012'
(modified), and '013' (saved).
VALUE_TOOLTIP: Get the text with the symbol '014' from the assistance
class.
LABEL_NAME and LABEL_TOOLTIP: Get the text with the symbol '010'
from the assistance class.
Call the method INITIALIZE_ITEMS( ) to delete all existing item groups.
Then call the method ADD_ITEM_GROUP_BY_VAL( ) to define a new
item group. Pass the internal table to this method.
a) Please find the source code at the end of this exercise.
Task 4:
Test your OIF application.
1. Start the FPM application displaying the OIF.
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
b) Check application title, ticket area and items area before you change
the customer data.
c) If you have finished the optional tasks, change the customer name and
the city and click on the Bookings tab to trigger a roundtrip. The ticket
area should be updated and the items area should indicate that data
has been changed.
d) Save the customer data. The items area should display the new status.
Result
OIF: View CUSTOMER_VIEW- WDDOINIT( )
METHOD wddoinit .
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->get_customer( ).
ENDMETHOD.
lo_el_customer = lo_nd_customer->get_element( ).
lo_el_customer->get_static_attributes(
IMPORTING
static_attributes = ls_customer ).
wd_this->go_fpm_idr->set_application_title(
iv_title = lv_app_title
iv_title_tooltip = lv_app_title_tooltip ).
ENDMETHOD.
...
wd_this->go_fpm_idr->set_application_title(
iv_title = lv_app_title
iv_title_tooltip = lv_app_title_tooltip ).
ENDMETHOD.
ENDIF.
ENDMETHOD.
ENDMETHOD.
...
ENDMETHOD.
...
* Optional parts **************************************************************
...
* refresh ticket area (display updated customer data)
wd_this->set_idr_ticket( is_customer = ls_customer ).
* refresh items area (display that customer data has been changed)
wd_this->set_idr_items( iv_state = 'M' ).
...
ENDMETHOD.
...
* if update was successful, clear context change log
wd_this->go_context->reset_context_change_log( ).
* Optional part: refresh items area (display, that changed data is saved)
wd_this->set_idr_items( iv_state = 'S' ).
...
ENDMETHOD.
CASE iv_state.
WHEN 'I'. "Initial
wd_this->go_fpm_idr->initialize_items( ).
wd_this->go_fpm_idr->add_item_group_by_val(
EXPORTING
it_items = lt_items ).
ENDMETHOD.
Business Example
You would like to display messages in your application to indicate if handling
FPM-Events was successful or not.
Solution Components:
NET313_BOOKING_S5
NET313_CUSTOMER_S6
Task 1:
Adapt your GAF application ZNET313_##_BOOKING_S1. Display an error
message if any of the following situations occur:
No flights are found for the selected customer.
No bookings are found for the selected flights (also because no flights have been
selected).
No bookings have been selected by the user.
The cancellation of the selected bookings was not successful.
1. Get the reference to the FPM message manager and store this reference in a
new attribute (name: GO_MES_MAN) in the component controller of your
GAF component.
Task 2:
Adapt your OIF application ZNET313_##_CUSTOMER_S1. Display an error
message if the customer data could not be saved to the data base. Display a
success message, if storing the data was successful.
1. Get the reference to the FPM message manager and store this reference in a
new attribute (name: GO_MES_MAN) in the component controller of your
OIF component.
Task 2:
Adapt your OIF application ZNET313_##_CUSTOMER_S1. Display an error
message if the customer data could not be saved to the data base. Display a
success message, if storing the data was successful.
1. Get the reference to the FPM message manager and store this reference in a
new attribute (name: GO_MES_MAN) in the component controller of your
OIF component.
Result
GAF: Component Controller - WDDOINIT( )
METHOD wddoinit .
ENDMETHOD.
...
CASE lv_interface_view.
* if interface view was CUSTOMER_WINDOW, read flights for customer
* report message with parameter if no flights could be read
WHEN 'CUSTOMER_WINDOW'.
lv_result = wd_this->get_flights( ).
IF lv_result = abap_false.
* ev_result = if_fpm_constants=>gc_event_result-failed.
lv_text = wd_assist->get_text( '001' ).
lo_nd_customer = wd_context->get_child_node(
name = wd_this->wdctx_customer ).
lo_el_customer = lo_nd_customer->get_element( ).
Continued on next page
lo_el_customer->get_attribute(
EXPORTING
name = `ID`
IMPORTING
value = lv_id ).
ls_parameters-name = '1'.
ls_parameters-value = lv_id.
APPEND ls_parameters TO lt_parameters.
wd_this->go_mes_man->report_message(
iv_message_text = lv_text
io_component = wd_this->go_fpm
iv_parameters = lt_parameters ).
ENDIF.
* if interface view was FLIGHTS_WINDOW, read bookings for on flights
* report message if no bookings could be read
WHEN 'FLIGHTS_WINDOW'.
lv_result = wd_this->get_bookings( ).
IF lv_result = abap_false.
* ev_result = if_fpm_constants=>gc_event_result-failed.
lv_text = wd_assist->get_text( '002' ).
wd_this->go_mes_man->report_message(
iv_message_text = lv_text
io_component = wd_this->go_fpm ).
ENDIF.
* if interface view was BOOKINGS_WINDOW, check for selected bookings
* report message if no bookings were selected
WHEN 'BOOKINGS_WINDOW'.
lv_result = wd_this->get_selected_bookings( ).
IF lv_result = abap_false.
* ev_result = if_fpm_constants=>gc_event_result-failed.
lv_text = wd_assist->get_text( '002' ).
wd_this->go_mes_man->report_message(
iv_message_text = lv_text
io_component = wd_this->go_fpm ).
ENDIF.
* if interface view was CHECK_WINDOW, try to cancel bookings on DB
* report message if cancelling bookings was not successful
WHEN 'CHECK_WINDOW'.
lv_result = wd_this->cancel_bookings( ).
IF lv_result = abap_false.
* ev_result = if_fpm_constants=>gc_event_result-failed.
lv_text = wd_assist->get_text( '003' ).
wd_this->go_mes_man->report_message(
iv_message_text = lv_text
io_component = wd_this->go_fpm ).
ENDIF.
ENDCASE.
ENDMETHOD.
ENDMETHOD.
CASE io_event->mv_event_id.
* if EDIT_TOGGLE was selected, toggle edit mode
WHEN 'EDIT_TOGGLE'.
wd_this->toggle_edit_mode( ).
* if SAVE was selected, update customer data
WHEN cl_fpm_event=>gc_event_save.
lv_result = wd_this->update_customer( ).
IF lv_result = abap_false.
ENDMETHOD.
Lesson Summary
You should now be able to:
Handle FPM-Events
Fire FPM-Events from the application source code
Access the FPM toolbar and the IDR at runtime
Use the FPM message manager
Unit Summary
You should now be able to:
Display UIBBs in floorplans of type OIF, QAF and GAF
Configure the IDR
Configure the toolbar
Configure the primary help
Configure initial screen and confirmation screen
Handle FPM-Events
Fire FPM-Events from the application source code
Access the FPM toolbar and the IDR at runtime
Use the FPM message manager
Unit Overview
Forms and lists are used frequently on the UI of Web Dynpro applications. In the
FPM context, generic WD components exist to display a single data set by a form
(FORM GUIBB) or multiple data sets by a table (LIST GUIBBs).
In the first lesson of this unit, the general architecture of a WD application which
is based on the FPM framework and which is reusing generic UI building blocks
is discussed. In addition, the general aspects of special global classed (feeder
classes) that are used to provide the data displayed by the GUIBBs are covered.
The configuration of the FORM GUIBB and of the LIST GUIBB and the specific
aspects of the related feeder classes are explained in the two consecutive lessons.
Unit Objectives
After completing this unit, you will be able to:
Unit Contents
Lesson: Generic UI Building Blocks - general Aspects ....................160
Lesson: The FORM GUIBB ...................................................167
Exercise 9: FORM GUIBB - Define Feeder Class, use Central Data
Model and configure the GUIBB ..........................................185
Lesson: The LIST GUIBB......................................................201
Exercise 10: LIST GUIBB - Define Feeder Class and configure
Component ..................................................................213
Lesson Overview
This lesson summarizes the architecture of FPM applications making use of
generic UI building blocks (GUIBBs). In addition, feeder classes are discussed.
Feeder classes are used to retrieve the data displayed by the GUIBB. In addition,
they control all variable aspects in respect to the configuration process and the
runtime behavior of GUIBBs.
Lesson Objectives
After completing this lesson, you will be able to:
Describe the architecture of FPM applications which are based on GUIBBs.
Describe the interaction between GUIBBs and feeder classes.
Create feeder classes.
Business Example
You would like to assure, that all forms and lists displayed by your FPM
applications have a consistent look and feel.
Architecture
Generic UI Building Blocks (GUIBBs) allow to display data provided by special
classes (feeder classes) based on a predefined UI pattern. The layout of GUIBBs is
not designed freely by the application developer, but configured using the Web
Dynpro configuration editor. This reduces the degree of freedom in respect to:
the type of UI elements which can be used to define the layout
the positioning of the UI elements in the layout
the UI element properties that may be adjusted by the developer
Thus, using GUIBBs guarantees a consistent look and feel of floorplan
applications. In addition, the UI provided by GUIBBs can be adjusted via
component configuration and thus without any modification.
The following drawing summarizes the basic architecture of FPM applications.
The Web Dynpro application points on an FPM component which embeds the IDR
component (to display the page header) and one or multiple sub components. The
interface views of the embedded sub components (UIBBs) are embedded in the
window of the FPM component to implement the desired floorplan.
GUIBBs are highly flexible UIBBs, that allow to define a pattern-based layout
(form, list, tab strip). The exact layout has to be configured. The information pool
available for the configuration process (design time) is controlled by a so called
feeder class. At runtime, this class will also supply the corresponding data and
care for events triggered by the user. Thus, multiple forms (or lists or tabs) can
be defined by assigning different feeder classes to the corresponding GUIBB
component via configuration. If an FPM application is based entirely on GUIBBs,
all coding related to the application is contained by the feeder classes or in other
global classes referenced by the feeder classes.
Feeder Classes
Feeder classes are used to provide the application specific information necessary to
configure a GUIBB at design time and to display the application data and handle
the events triggered by the user at runtime. These classes need to implement a
predefined interface which depends on the type of the related GUIBB:
FORM GUIBB:
Component: FPM_FORM_UIBB
Feeder class needs to implement interface IF_FPM_GUIBB_FORM.
LIST GUIBB:
Component: FPM_LIST_UIBB
Feeder class needs to implement interface IF_FPM_GUIBB_LIST.
TABBED GUIBB:
Component: FPM_TABBED_UIBB
No feeder class necessary (statical assignment of UIBBs to tabs defined
by GUIBB).
The interfaces IF_FPM_GUIBB_FORM and IF_FPM_GUIBB_LIST embed the
interface IF_FPM_GUIBB.
Figure 78: Phase model when navigating - replacing target UIBB by GUIBB
Figure 79: Phase model when navigating - replacing initial UIBB by GUIBB
Lesson Summary
You should now be able to:
Describe the architecture of FPM applications which are based on GUIBBs.
Describe the interaction between GUIBBs and feeder classes.
Create feeder classes.
Lesson Overview
This lesson explains how to configure the FORM GUIBB and how to implement
the methods in the related feeder class.
Lesson Objectives
After completing this lesson, you will be able to:
Define a feeder class related to the FORM GUIBB.
Implement the most important methods of this feeder class
Configure the FORM GUIBB.
Business Example
You would like to define UIBBs containing forms by using the corresponding
GUIBB provided by the Web Dynpro framework.
The configuration editor for Web Dynpro will be opened in a new browser
window. Click Create to create the component configuration for the FORM
GUIBB. Complete the popups asking for description, package assignment,
and transport request.
Now, a dialog box pops up asking for the feeder class. Enter the
name of the corresponding feeder class. This class has to implement
the interface IF_FPM_GUIBB_FORM and optionally the interface
IF_FPM_GUIBB_FORM_EXT.
Click Edit Parameters.
If parameters have not been defined in the feeder class, a popup displaying a
success message will be displayed. In this case, finish the dialog.
If parameters have been defined in the feeder class, the value of each
parameter can be adjusted on the next popup. For each parameter, a label
/ input field pair will be displayed.
The type of each parameter will typically be defined by a data element
which is based on a domain having fixed values. In this case, the label will
originate from the long text of the data element, while the allowed values
will equal the domain fixed values.
Next, the view's layout needs to be structured. Here, one or multiple groups
may be used as container elements. All groups will be defined on the same
hierarchy level (groups may not be defined as children of existing groups).
For each group, the group's caption can be set. In addition, each group can
occupy the complete page width or only half of the page with. A group
occupying the complete page with can display its form fields in one column
or in two columns.
Melting groups (not discussed here) can be defined as sub elements of a
group. A melting group occupies the space of one form field. However,
multiple form fields can be contained by a melting group.
Form fields may be assigned to any group (or melting group). This group has
to be marked in the hierarchy view.
Then the button Configure Group (Configure Melting Group) has to be
clicked.
A dialog box pops up displaying a number of fields. An arbitrary number
of fields can be marked. Clicking the button Add Fields will add them to
the group.
Optionally, each field of the field selection may be assigned to a field group.
This is meaningful is the field selection contains a large number of field. In
this case a drop down box in the upper left corner of the popup allows to
select the field group. Then, only fields assigned to this field group will be
displayed by the left table.
The field selection, the properties of each field, the field groups and the assignment
of each field to a field group has to be defined by the content of method
GET_DEFINITION( ):
The field selection has to be defined by a RTTI description of type
CL_ABAP_STRUCTDESCR which is returned to the framework via the exporting
parameter EO_FIELD_CATALOG.
For each of the fields contained in the field catalog, properties have to be set
and returned via the exporting parameter ET_FIELD_DESCRIPTION. If a field
should be available during the configuration process, its visibility has to be set to
CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE. Other properties are defined in
the ABAP Dictionary structure FPMGB_S_FORMFIELD_DESCR.
In order to assign the form fields to field groups, these field groups need to be
defined first. This is also done in method GET_DEFINITION( ). Here, the
exporting parameter ET_SPECIAL_GROUPS is used to inform the framework
about the internal group names and the names displayed in the configuration editor.
After having defined which form fields are to be displayed in which group, the
form field properties can be configured:
The form field has to be marked in the hierarchy view.
The following properties can then be configured: The type of UI element
(Display Type), the visibility of the label (Label Visibility), and the label text
(Text - this will overwrite the text obtained from the ABAP DDIC).
Additional properties do depend on the type of UI element used to display
the form field.
If the client side event related to the form field should related to an action,
the button Assign Action has to be clicked. All bindable actions are displayed
by a dialog box popping up.
The actions displayed by the dialog box need to be defined in the method
GET_DEFINITION( ). Here, the exporting parameter ET_ACTION_DEFINITION
is used to inform the WD runtime.
Figure 92: Define list of actions that may be assigned to form fields
After having configured all form field properties, this component configuration
can be saved and the configuration process is finished.
If the properties of the form fields have to be modified, the new form field properties
have to be exported to the GUIBB via the changing parameter CT_FIELD_USAGE.
In addition the exporting parameter EV_FIELD_USAGE_CHANGED has to be set
to ABAP_TRUE.
If the action usage has to be modified, the actualized action usage has to be
exported to the GUIBB via the changing parameter CT_ACTION_USAGE. In
addition the exporting parameter EV_ACTION_USAGE_CHANGED has to be set
to ABAP_TRUE.
Messages can be defined by calling the appropriate methods of the FPM message
manager. However, each message can also be defined by appending a structure
containing the message details to the exporting parameter ET_MESSAGES.
Business Example
You would like to define the customer form of your OIF application via
configuration of the corresponding generic UIBB. However, this also means that
you have to create the feeder class and you have to implement the methods of this
class. In addition, you need to exchange data between this feeder class and the
OIF component. Thus, you need to use a simple central data model.
Template Feeder Class:
CL_NET313_FORM_GUIBB_T
Solution Component:
NET313_CUSTOMER_S7
Solution Feeder Class:
CL_NET313_FORM_GUIBB
Central Data Model Class:
CL_NET313_CENTRAL_DATA
Solution Component Configuration:
NET313_CUSTOMER_S7_CC1 (FPM component)
NET313_CUSTOMER_S7_CC_FORM (FORM GUIBB)
Task 1:
OPTIONAL TASK:
Complete the feeder class to be used by the FORM GUIBB. Copy the template
CL_NET313_FORM_GUIBB_T. Name your copy ZCL_##_NET313_FORM.
The template contains the all methods and attributes needed to implement the
feeder class. You only need to complete the methods FLUSH( ), GET_DATA( ),
and GET_DEFINITION( ).
Implement the source code: The feeder class should not support parameters. All
fields of the DDIC structure SCUSTOM but the field MANDT should be available
for the configuration process. All fields should not be editable. The labels of the
fields and the lengths of the fields should be obtained from the DDIC description.
The feeder class should allow to replace the customer form of your application
by the FORM GUIBB.
1. Create the feeder class to be used by the FORM GUIBB by copying
the template CL_NET313_FORM_GUIBB_T. Name your class
ZCL_##_NET313_FORM.
2. Implement the source code of feeder class method GET_DEFINITION( ).
The source code consists of the following steps:
Get the RTTI description of the DDIC structure SCUSTOM (use method
CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( ) ).
Pass this description to the exporting parameter EO_FIELD_CATALOG.
Get the components from the RTTI description of the DDIC structure
SCUSTOM (use method GET_COMPONENTS( ) for RTTI structure
description).
Loop over the component list.
For each component, define a new line of the exporting parameter
ET_FIELD_DESCRIPTION.
Set NAME = name of structure component.
Set VISIBILITY = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE for
all structure components but the component MANDT. Set VISIBILITY =
CL_WD_UIELEMENT=>E_VISIBLE-NONE for the component MANDT.
Set READ_ONLY = ABAP_TRUE, LABEL_BY_DDIC = ABAP_TRUE, and
LENGTH_BY_DDIC = ABAP_TRUE for all structure components.
3. Complete the source code of feeder class method FLUSH( ). This consists
of the following steps:
Check if the user changed any form data during the last application
step. This is done by analyzing the content of the importing parameter
IT_CHANGE_LOG.
Continued on next page
If this internal table is not empty, proceed processing the method. Get the
current form data from the reference variable IS_DATA. De-reference this
data reference into a field symbol of type SCUSTOM. Store the customer
data in the feeder class attribute GS_CUSTOMER.
Store the information, that the customer data has been changed by the user: Set
the central data model attribute GO_CENTRAL_DATA->GV_SAVE_DATA
to ABAP_TRUE.
Call the methods SET_IDR_TICKET( ) and SET_IDR_ITEMS( ). Pass the
customer data set to the first method and the literal 'M' (modified) to the
second method.
4. Complete the source code of feeder class method GET_DATA( ). This
consists of the following steps:
Check, whether the value of the feeder class attribute GS_CUSTOMER
has been changed during the current dialog step (GV_DATA_CHANGED
= ABAP_TRUE).
In this case, set CS_DATA = GS_CUSTOMER and EV_DATA_CHANGED
= ABAP_TRUE. This will force the WD runtime to actualize the form
data displayed to the user. In addition set GV_DATA_CHANGED =
ABAP_FALSE.
Set the readOnly property of the form fields according to the current value of
the feeder class attribute GV_READ_ONLY:
Loop over the changing parameter CT_FIELD_USAGE. Modify the
value of the field READ_ONLY for each data set. In addition set
EV_FIELD_USAGE_CHANGED = ABAP_TRUE. This will force the WD
runtime to update the form field properties.
Enable the button labeled Display/Change Customer.
5. Save and activate your feeder class.
Task 2:
Adapt your OIF component assuming that the customer form is defined by the
FORM GUIBB:
Delete all WD entities which are not needed any more.
Delete all component controller methods, attributes, and context nodes that are
not needed any more.
Adapt the remaining component controller methods of your OIF component.
Work on attributes of the central data model (GO_CENTRAL_DATA-
>GV_SAVE_DATA, GO_CENTRAL_DATA->GV_CUSTOM_ID) instead of
component controller attributes.
Add a component controller attribute to store the reference to the central data
model. Set the value of this attribute in the controller method WDDOINIT( ).
Implement the component controller method FLUSH( ). If the last interface view
displayed to user was INTRO_WINDOW, pass the customer ID selected by the user
to the central data model attribute GO_CENTRAL_DATA->GV_CUSTOM_ID.
1. Delete the view CUSTOMER_VIEW and the window CUSTOMER_WIN-
DOW.
2. In the component controller context, delete the context node
UI_ELEM_PROPERTIES.
3. Delete the component controller attribute GO_CONTEXT. Delete all coding
sections referring to this attribute.
4. Delete the component controller methods INIT_IDR( ),
TOGGLE_EDIT_MODE( ), UPDATE_CUSTOMER( ),
GET_CUSTOMER( ) and - if you have created them in the related optional
exercise - SET_IDR_ITEMS( ) and SET_IDR_TICKET( ).
5. Create the controller attribute GO_CENTRAL_DATA of reference type
CL_NET313_CENTRAL_DATA. Get the reference to the central data model
in method WDDOINIT( ).
6. Implement the source code of the component controller method FLUSH( ).
Replace the existing source code as follows:
If the last interface view displayed to user was INTRO_WINDOW,
read the customer ID from the context (node CUSTOMER_ID).
Copy the customer ID to the central data model attribute
GO_CENTRAL_DATA->GV_CUSTOM_ID.
Task 3:
Edit the component configuration of your OIF component. On the tab displaying
the customer form, replace the UIBB of your OIF component by the FORM
GUIBB. Use the feeder class defined in the last task or the template feeder class.
Copy the layout of the freestyle UIBB by configuring the FORM GUIBB.
1. Edit your component configuration ZNET313_##_CUSTOMER_S1_CC1.
2. On the first tab (Customer) replace the interface view CUSTOMER_WINDOW
of your OIF component by the interface view FORM_WINDOW of the
GUIBB component FPM_FORM_UIBB. Assign a component configuration
to the FORM GUIBB (name: ZNET313_##_CUSTOMER_S1_CC_FORM).
3. Create the component configuration for the FORM GUIBB. Use your feeder
class ZCL_##_NET313_FORM. If you have not created your own feeder
class, use feeder class CL_NET313_FORM_GUIBB.
4. Copy the layout of the freestyle UIBB by configuring the FORM GUIBB.
Output the form fields as input fields in a two column layout. Assign a
header text to the surrounding group.
Task 4:
Test your FPM application.
1. Start the FPM application displaying the OIF. Check the functionality of
your application (change customer data, save data, check if toolbar button
labeled Display/Change Customer is disabled if bookings are displayed ...).
Task 2:
Adapt your OIF component assuming that the customer form is defined by the
FORM GUIBB:
Delete all WD entities which are not needed any more.
Delete all component controller methods, attributes, and context nodes that are
not needed any more.
Adapt the remaining component controller methods of your OIF component.
Work on attributes of the central data model (GO_CENTRAL_DATA-
>GV_SAVE_DATA, GO_CENTRAL_DATA->GV_CUSTOM_ID) instead of
component controller attributes.
Add a component controller attribute to store the reference to the central data
model. Set the value of this attribute in the controller method WDDOINIT( ).
Implement the component controller method FLUSH( ). If the last interface view
displayed to user was INTRO_WINDOW, pass the customer ID selected by the user
to the central data model attribute GO_CENTRAL_DATA->GV_CUSTOM_ID.
1. Delete the view CUSTOMER_VIEW and the window CUSTOMER_WIN-
DOW.
a) Deleting should not be a problem ...
Task 3:
Edit the component configuration of your OIF component. On the tab displaying
the customer form, replace the UIBB of your OIF component by the FORM
GUIBB. Use the feeder class defined in the last task or the template feeder class.
Copy the layout of the freestyle UIBB by configuring the FORM GUIBB.
1. Edit your component configuration ZNET313_##_CUSTOMER_S1_CC1.
a) Edit the component configuration ZNET313_##_CUSTOMER_S1_CC1.
b) Double click the corresponding item in the object tree of the Object
Navigator. This will display the configuration's meta data in the object
area.
c) Click on the button labeled Start Configurator. This will open the
component configuration editor.
d) Click the button Change in the component configuration editor.
2. On the first tab (Customer) replace the interface view CUSTOMER_WINDOW
of your OIF component by the interface view FORM_WINDOW of the
GUIBB component FPM_FORM_UIBB. Assign a component configuration
to the FORM GUIBB (name: ZNET313_##_CUSTOMER_S1_CC_FORM).
a) Mark the UIBB related to the first tab in the hierarchy. The attributes
related to this UIBB will be displayed below the preview area.
b) Enter FPM_FORM_UIBB in the field labeled Component.
c) Enter FORM_WINDOW in the field labeled View.
d) Enter ZNET313_##_CUSTOMER_S1_CC_FORM in the field labeled
Configuration Name.
e) Save.
3. Create the component configuration for the FORM GUIBB. Use your feeder
class ZCL_##_NET313_FORM. If you have not created your own feeder
class, use feeder class CL_NET313_FORM_GUIBB.
a) Click the button Configure UIBB which is displayed in the preview
area for the FORM GUIBB.
b) On the next screen, click the button Create.
c) Enter a description, your package name and the key of your transport
request in the related fields of next two popups.
d) When being asked for the feeder class, enter the name of your feeder
class (ZCL_##_NET313_FORM) in the form field. If you have not
created your own feeder class, enter the name of the template solution
(CL_NET313_FORM_GUIBB). Click the button Edit Parameters. On
the next dialog, click OK.
4. Copy the layout of the freestyle UIBB by configuring the FORM GUIBB.
Output the form fields as input fields in a two column layout. Assign a
header text to the surrounding group.
a) Click the button labeled Add Group in order to create a new group.
b) Set the group's attributes as follows:
Text = Details for Customer, Group Type = F2 (full with, two columns).
c) Click the button Configure Group.
d) Mark the fields you would like to display in the table on the left side
(CTRL + left mouse click). Then click the button Add Fields.
Note: The fields having an odd index will be displayed in the
left column of the form, the fields having an even index will be
displayed on the right side. Click OK to finish the dialog.
e) Save.
Task 4:
Test your FPM application.
1. Start the FPM application displaying the OIF. Check the functionality of
your application (change customer data, save data, check if toolbar button
labeled Display/Change Customer is disabled if bookings are displayed ...).
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
b) The customer form displayed on the first tab is now provided by the
FORM GUIBB.
Result
OPTIONAL TASK: CL_NET313_FORM_GUIBB -
IF_FPM_GUIBB~GET_DEFINITION( )
METHOD if_fpm_guibb_form~get_definition.
ENDMETHOD.
* Any changes?
lv_lines = LINES( it_change_log ).
IF lv_lines = 0.
RETURN.
ENDIF.
* Data have been changed by the user, but have not been written to database yet
go_central_data->gv_save_data = abap_true.
ENDMETHOD.
* Actualize data
IF gv_data_changed = abap_true.
cs_data = gs_customer.
ev_data_changed = gv_data_changed.
gv_data_changed = abap_false.
ENDIF.
ENDMETHOD.
wd_this->set_intro_text( ).
* wd_this->go_context = wd_context->get_context( ).
* get reference to central data object.
wd_this->go_central_data =
cl_net313_central_data=>get_instance( ).
wd_this->go_fpm = cl_fpm_factory=>get_instance( ).
wd_this->go_fpm_oif ?= wd_this->go_fpm->get_service(
iv_service_key = cl_fpm_service_manager=>gc_key_cnr_oif ).
wd_this->go_fpm_idr ?= wd_this->go_fpm->get_service(
iv_service_key = cl_fpm_service_manager=>gc_key_idr ).
wd_this->go_mes_man = wd_this->go_fpm->mo_message_manager.
ENDMETHOD.
IF lv_interface_view = 'INTRO_WINDOW'.
lo_nd_customer_id = wd_context->get_child_node( name = wd_this->wdctx_customer_id ).
lo_el_customer_id = lo_nd_customer_id->get_element( ).
lo_el_customer_id->get_attribute(
EXPORTING
name = `ID`
IMPORTING
value = lv_id ).
wd_this->go_central_data->gv_custom_id = lv_id.
ENDIF.
ENDMETHOD.
CASE io_event->mv_event_id.
WHEN cl_fpm_event=>gc_event_close.
IF wd_this->go_central_data->gv_save_data = abap_true.
eo_confirmation_request = cl_fpm_confirmation_request=>go_data_loss.
ENDIF.
ENDCASE.
ENDMETHOD.
wd_this->go_fpm_oif->define_button(
iv_function = if_fpm_constants=>gc_button-other_function
iv_element_id = 'CUSTOMER_TOGGLE'
iv_enabled = abap_false ).
ENDMETHOD.
ENDMETHOD.
Lesson Summary
You should now be able to:
Define a feeder class related to the FORM GUIBB.
Implement the most important methods of this feeder class
Configure the FORM GUIBB.
Lesson Overview
This lesson explains how to configure the LIST GUIBB and how to implement
the methods in the related feeder class.
Lesson Objectives
After completing this lesson, you will be able to:
Define a feeder class related to the LIST GUIBB.
Implement the most important methods of this feeder class
Configure the LIST GUIBB.
Business Example
You would like to define UIBBs containing lists by using the corresponding
GUIBB provided by the Web Dynpro framework.
The configuration editor for Web Dynpro will be opened in a new browser
window. Click Create to create the component configuration for the LIST
GUIBB. Complete the popups asking for description, package assignment,
and transport request.
Now, a dialog box pops up asking for the feeder class. Enter the
name of the corresponding feeder class. This class has to implement
the interface IF_FPM_GUIBB_LIST and optionally the interface
IF_FPM_GUIBB_LIST_EXT.
Click Edit Parameters.
If parameters have not been defined in the feeder class, a popup displaying a
success message will be displayed. In this case, finish the dialog.
If parameters have been defined in the feeder class, the value of each
parameter can be adjusted on the next popup. For each parameter, a label
/ input field pair will be displayed.
The type of each parameter will typically be defined by a data element
which is based on a domain having fixed values. In this case, the label will
originate from the long text of the data element, while the allowed values
will equal the domain fixed values.
For details about defining parameters please refer to the corresponding section in
the lesson about the FORM GUIBB.
Next, the list's properties needs to be configured. After having selected
the List element in the hierarchy, the list header can be defined (attribute
Text). In addition, a special action can be assigned to the client side event
OnLeadSelect of the related Table UI element. All bindable actions are
displayed by a dialog box popping up.
Additional table settings can be adjusted if the Settings element in the
hierarchy is selected. The number of columns (Col count) and the number
of rows (Row count) can be fixed by assigning a positive integer value.
The attribute labeled Selection Mode corresponds to the Table property
selectionMode. The field labeled Selection Event allows to define which
clicks on the mark column will trigger the FPM-Event with the ID
FPM_GUIBB_LIST_ON_LEAD_SELECTI. Finally, the property labeled
Selection behavior allows to define, if clicking a the mark column will
automatically change the lead selection index accordingly.
Actions that may be assigned to the client side event OnLeadSelect need to be
defined in the method GET_DEFINITION( ). For details please refer to the
corresponding section in the lesson about the FORM GUIBB.
Next, the columns displayed in the list need to be defined
Click the button Configure Columns.
A dialog box pops up displaying available columns. An arbitrary number of
columns can be marked. Clicking the button Add Columns will add them to
the list.
Optionally, each available column may be assigned to a field group. This is
meaningful is the number of available columns is large. In this case a drop
down box in the upper left corner of the popup allows to select the field
group. Then, only columns assigned to this field group will be displayed
in the left table.
The available columns, the properties of each column, the field groups and the
assignment of each available column to a field group has to be defined by the
content of method GET_DEFINITION( ):
The column selection has to be defined by a RTTI description of type
CL_ABAP_TABLEDESCR which is returned to the framework via the exporting
parameter EO_FIELD_CATALOG.
For each of the columns contained in the field catalog, properties have to be set
and returned via the exporting parameter ET_FIELD_DESCRIPTION. If a column
should be available during the configuration process, its visibility has to be set to
CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE. Other properties are defined in
the ABAP Dictionary structure FPMGB_S_LISTFIELD_DESCR.
In order to assign the form fields to field groups, these field groups need to be
defined first. For details please refer to the corresponding section in the lesson
about the FORM GUIBB.
After having defined which columns are to be displayed in which group, the
column properties can be configured:
The column has to be marked in the hierarchy view.
The following properties can then be configured: The type of UI element
used to display the column content (Display Type), the position of the
column (Index), and the header text (Column header - this will overwrite the
text obtained from the ABAP DDIC).
Additional properties do depend on the UI element used to display the
column content.
After having configured all list and column properties, this component
configuration can be saved and the configuration process is finished.
Note: The current data displayed to the user is available from the
importing parameter IT_DATA. At runtime, this parameter will contain
the complete list.
If a clickable cell element was clicked by the user, additional information can be
extracted from the interface parameter IO_EVENT. This parameter contains the
public attribute MO_EVENT_DATA being an object described by the interface
IF_FPM_PARAMETER. Calling the getter method GET_VALUE( ), the following
information can be extracted:
The line index (parameter key FPM_GUIBB_LIST_INDEX).
The column name (parameter key FPM_GUIBB_LIST_COL_NAME).
The name of the feeder class (parameter key
FPM_GUIBB_LIST_FEEDER_NAME).
For each parameter of the feeder class the parameter value (parameter key as
defined in method GET_PARAMETER_LIST( ) ).
If the event handling was not successful, the WD runtime can be informed by
setting the exporting parameter EV_RESULT accordingly. In this case, the method
AFTER_FAILED_EVENT( ) will be processed before navigation takes place.
Messages can be defined by calling the appropriate methods of the FPM message
manager. However, each message can also be defined by appending a structure
containing the message details to the exporting parameter ET_MESSAGES.
Business Example
You would like to define the booking lists of your OIF application via configuration
of the corresponding generic UIBB. However, this also means that you have to
create the feeder class and you have to implement the methods of this class. In
addition, you need to exchange data between this feeder class, the feeder class for
the FORM GUIBB, and the OIF component. Thus, you need to use a central
data model.
Template Feeder Class:
CL_NET313_LIST_GUIBB_T
Solution Component:
NET313_CUSTOMER_S8
Solution Feeder Class:
CL_NET313_LIST_GUIBB
Solution Component Configuration:
NET313_CUSTOMER_S8_CC1 (FPM component)
NET313_CUSTOMER_S8_CC_LIST1 (LIST GUIBB displaying
non-cancelled bookings)
NET313_CUSTOMER_S8_CC_LIST2 (LIST GUIBB displaying cancelled
bookings)
Task 1:
OPTIONAL TASK:
Complete the feeder class to be used by the LIST GUIBB. Copy the template
CL_NET313_LIST_GUIBB_T. Name your class ZCL_##_NET313_LIST.
The template contains the all methods and attributes needed to implement
the feeder class. You only need to complete the methods GET_DATA( ),
GET_DEFINITION( ), INITIALIZE( ), and GET_PARAMETER_LIST( ).
Implement the source code. The feeder class should support one parameter
defining if non-cancelled bookings or if cancelled bookings are to be displayed.
All fields of the DDIC structure SBOOK but the field MANDT should be available
for the configuration process. All fields should not be editable. The column
headers should be obtained from the DDIC description.
1. Create the feeder class to be used by the LIST GUIBB by copying the template
CL_NET313_LIST_GUIBB_T. Name your class ZCL_##_NET313_LIST.
2. Implement the source code of feeder class method GET_PARAME-
TER_LIST( ). The source code consists of the following steps:
Define a work area for the returning parameter of this method.
Set the components of this structure as follows:
NAME = 'DATA_KIND' and TYPE = 'NET313_LIST_BOOKING_KIND'.
Append the work area to the returning parameter of the method
Get the RTTI description of the DDIC structure SBOOK (use method
CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( ) ). Then call the
method CL_ABAP_TABLEDESCR=>CREATE( ) to define an RTTI
description of an internal table which is based on the RTTI description of
the structure.
Pass this table description to the exporting parameter EO_FIELD_CATALOG.
Get the components from the RTTI description of the DDIC structure SBOOK
(use method GET_COMPONENTS( ) for RTTI structure description).
Loop over the component list.
For each component, append a new line to the exporting parameter
ET_FIELD_DESCRIPTION containing the following information:
NAME = name of structure component.
Set VISIBILITY = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE for
all structure components but the component MANDT. Set VISIBILITY =
CL_WD_UIELEMENT=>E_VISIBLE-NONE for the component MANDT.
READ_ONLY = ABAP_TRUE and HEADER_LABEL_BY_DDIC =
ABAP_TRUE for all structure components.
Task 2:
Adapt your OIF component assuming that the booking lists are defined by the
LIST GUIBB:
Delete all WD entities which are not needed any more.
Delete all component controller methods, attributes, and context nodes that are
not needed any more.
Adapt the remaining component controller methods of your OIF component. Work
on attributes of the central data model (GO_CENTRAL_DATA->GV_SAVE_DATA,
GO_CENTRAL_DATA->GV_CUSTOM_ID) instead on component controller
attributes.
1. Delete the views BOOKINGS_C_VIEW and BOOKINGS_N_VIEW.
Delete the windows BOOKINGS_C_WINDOW and BOOKINGS_N_WIN-
DOW.
2. In the component controller context, delete the context nodes BOOKINGS_C,
BOOKINGS_N, and CUSTOMER.
3. Delete all component controller attributes but the ones beginning with WD_
and the attribute GO_CENTRAL_DATA.
4. Delete the component controller method GET_BOOKINGS( ).
5. Delete the complete source code of the methods NEEDS_CONFIRMATION(
) and PROCESS_BEFORE_OUTPUT( ).
6. Adapt the component controller method WDDOINIT( ). Delete the coding
used to determine the reference to the FMP service object, to the IDR service
object, to the OIF service object, and to the FPM message manager object.
7. Save and activate your OIF component.
Task 3:
Edit the component configuration of your OIF component. On the tab displaying
bookings, replace the UIBBs of your OIF component by the LIST GUIBB. Use
the feeder class created during the last task or the template feeder class. Display
an arbitrary number of columns by the list. Display the cells of the columns
CANCELLED, INVOICE, RESERVED, or SMOKER as checkboxes. Each list
should display 10 data rows. A marking column should not be displayed.
1. Edit your component configuration ZNET313_##_CUSTOMER_S1_CC1.
Task 4:
Test your FPM application.
1. Start the FPM application displaying the OIF.
Task 2:
Adapt your OIF component assuming that the booking lists are defined by the
LIST GUIBB:
Delete all WD entities which are not needed any more.
Delete all component controller methods, attributes, and context nodes that are
not needed any more.
Adapt the remaining component controller methods of your OIF component. Work
on attributes of the central data model (GO_CENTRAL_DATA->GV_SAVE_DATA,
GO_CENTRAL_DATA->GV_CUSTOM_ID) instead on component controller
attributes.
1. Delete the views BOOKINGS_C_VIEW and BOOKINGS_N_VIEW.
Task 3:
Edit the component configuration of your OIF component. On the tab displaying
bookings, replace the UIBBs of your OIF component by the LIST GUIBB. Use
the feeder class created during the last task or the template feeder class. Display
an arbitrary number of columns by the list. Display the cells of the columns
CANCELLED, INVOICE, RESERVED, or SMOKER as checkboxes. Each list
should display 10 data rows. A marking column should not be displayed.
1. Edit your component configuration ZNET313_##_CUSTOMER_S1_CC1.
a) Edit the component configuration ZNET313_##_CUSTOMER_S1_CC1.
b) Double click the corresponding item in the object tree of the Object
Navigator. This will display the configuration's meta data in the object
area.
c) Click on the button labeled Start Configurator. This will open the
component configuration editor.
d) Click the button Change in the component configuration editor.
2. On the sub view displaying the non-cancelled bookings, replace the
interface view BOOKINGS_N_WINDOW of your OIF component
by the interface view LIST_WINDOW of the GUIBB component
FPM_LIST_UIBB. Assign a component configuration to the LIST GUIBB
(name: ZNET313_##_CUSTOMER_S1_CC_LIST1).
a) Mark the UIBB related to the sub view displaying the non-cancelled
bookings in the hierarchy. The attributes related to this UIBB will be
displayed below the preview area.
b) Enter FPM_LIST_UIBB in the field labeled Component.
c) Enter LIST_WINDOW in the field labeled View.
d) Enter ZNET313_##_CUSTOMER_S1_CC_LIST1 in the field labeled
Configuration Name.
e) Save.
Task 4:
Test your FPM application.
1. Start the FPM application displaying the OIF.
a) From the context menu of your application configuration
ZNET313_##_CUSTOMER_S1_AC1, select Test to start the related
FPM application.
b) The booking lists displayed on the second tab are now provided by the
LIST GUIBB.
Result
OPTIONAL TASK: CL_NET313_LIST_GUIBB -
IF_FPM_GUIBB~GET_PARAMETER_LIST( )
METHOD if_fpm_guibb~get_parameter_list.
ls_parameter_descr-name = 'DATA_KIND'.
ls_parameter_descr-type = 'NET313_LIST_BOOKINGS_KIND'.
APPEND ls_parameter_descr TO rt_parameter_descr.
ENDMETHOD.
* read bookings
get_bookings( ).
gv_data_changed = abap_true.
* get parameter
READ TABLE it_parameter INTO ls_parameter WITH KEY name = 'DATA_KIND'.
IF sy-subrc <> 0.
gv_data_kind = 'N'.
ELSE.
ASSIGN ls_parameter-value->* TO <lv_value> CASTING.
gv_data_kind = <lv_value>.
ENDIF.
ENDMETHOD.
IF ls_field_description-name = 'MANDT' .
ls_field_description-visibility = cl_wd_uielement=>e_visible-none.
ELSE.
ls_field_description-visibility = cl_wd_uielement=>e_visible-visible.
ENDIF.
* Read only mode
ls_field_description-read_only = abap_true.
* Label
ls_field_description-header_label_by_ddic = abap_true.
ENDMETHOD.
* Actualize data
IF gv_data_changed = abap_true.
CASE gv_data_kind.
WHEN 'C'.
ct_data = gt_bookings_c.
WHEN 'N'.
ct_data = gt_bookings_n.
ENDCASE.
ev_data_changed = gv_data_changed.
gv_data_changed = abap_false.
ENDIF.
ENDMETHOD.
ENDMETHOD.
ENDMETHOD.
wd_this->set_intro_text( ).
* wd_this->go_context = wd_context->get_context( ).
ENDMETHOD.
Lesson Summary
You should now be able to:
Define a feeder class related to the LIST GUIBB.
Implement the most important methods of this feeder class
Configure the LIST GUIBB.
Unit Summary
You should now be able to:
Describe the architecture of FPM applications which are based on GUIBBs.
Describe the interaction between GUIBBs and feeder classes.
Create feeder classes.
Define a feeder class related to the FORM GUIBB.
Implement the most important methods of this feeder class
Configure the FORM GUIBB.
Define a feeder class related to the LIST GUIBB.
Implement the most important methods of this feeder class
Configure the LIST GUIBB.
Course Summary
You should now be able to:
PROCESS_EVENT( ), application, 4
103 component, 2
initial screen, 68 component controller, 3
toolbar, 71 component interface, 9
component reuse, 9
O component reuse - call
OIF, 39 methods, 12
service object, 107 component reuse - context
toolbar, 73 mapping, 15
toolbar access at runtime, component reuse -
108 declaration, 9
P component reuse - embed
personalization, 31 interface view, 11
explicit, 34 component reuse - handle
events, 13
Q component reuse -
QAF, 40 instantiation, 10
T component reuse - phase
model, 19
toolbar, 70
context mapping, 3
access at runtime (GAF),
controller attributes, 7
112
controller events, 8
access at runtime (OIF),
controller methods, 5
108
controller methods - order
U of processing, 6
UIBB, 36 controller usage, 3
definition, 56 custom controller, 3
user interface building block data binding, 2
(see UIBB), 36 interface controller, 4
interface view, 4
W navigation, 4
Web Dynpro basics, 2 navigation link, 5
action, 4 phase model, 6
adaptation, 20 plugs, 4
adaptation - configuration, startup plug, 4
24 used controller, 3
adaptation - configuration user interface (UI), 2
controller, 24 view, 2
adaptation - customizing / window, 3
personalization, 31
adaptation - hierarchy, 21
adaptation - implicit /
explicit, 22