Day3_FPM

47
Massachusetts Institute of Technology Web Dynpro for ABAP Volume III: Floorplan Manager By: Hendrik Pieterse 27 January 2011

Transcript of Day3_FPM

Page 1: Day3_FPM

Massachusetts Institute of Technology

Web Dynpro for ABAP

Volume III: Floorplan Manager

By: Hendrik Pieterse

27 January 2011

Page 2: Day3_FPM

27 January 2011 2

Agenda

  Purpose

  Features

  Architecture

  FPM UI Regions

  FPM Configuration

  Runtime API’s

  Useful Interfaces

Page 3: Day3_FPM

  SAP Framework for consistent Web Applications

  Provides mechanism to configure multiple WDA Components to form cohesive applications

  Advantages for Application Developers:   Prevents reinventing the wheel with pre-defined UI patterns, e.g. Forms, Lists, Tabs

  Allows customization of applications with no/minor code changes

  Plays on the strengths of WDA – Componentization

  Provide common APIs for:   Navigation

  Data-loss handling

  Messaging

  Personalization

Purpose

Page 4: Day3_FPM

Predefined application patterns:

 Object Instance Floor plan (OIF)

  Tabbed interface containing Main (and

optional subordinate) tabs

Features

Page 5: Day3_FPM

Predefined application patterns:

 Object Instance Floor plan (OIF)

  Tabbed interface containing Main (and

optional subordinate) tabs

Features

 Guided Activity Floor plan (GAF)

  Application Roadmap containing

Main (and optional subordinate steps)

Page 6: Day3_FPM

Predefined application patterns:

 Object Instance Floor plan (OIF)

  Tabbed interface containing Main (and

optional subordinate) tabs

 Quick Activity Floor plan (QAF)

  Simplified interface to Create, Delete, Display, and Change attributes and associations of

Business Objects

Features

 Guided Activity Floor plan (GAF)

  Application Roadmap containing

Main (and optional subordinate steps)

Page 7: Day3_FPM

 Various Configuration Editors for FPM adjustments

  Global settings

  Application Floor plan

  Referenced Components

  Predefined UI Component Templates

 Ability to define Configuration Variants

  Complete set of configuration data for an OIF view or GAF roadmap

  Variant selection is controlled programmatically

  For example, to alter an application view based on user authorizations

Features

Page 8: Day3_FPM

 Components implement FPM Interface IF_FPM_BUILDING_BLOCK

  Becomes “UI Building Block” (UIBB)

  Allows component to take part in event loop

  Ensure consistent implementations

  Allows framework adjustments without impacting components

 The FPM acts as the Main Web Dynpro application

  FPM_OIF_COMPONENT (Tabs)

  FPM_GAF_COMPONENT (Roadmap)

Architecture

Page 9: Day3_FPM

  Identification Region (IDR)

  Header area (IDR Basic)

  Ticket area (IDR Extended)

  Items area

FPM UI Regions

Page 10: Day3_FPM

  Identification Region (IDR)

  Header area (IDR Basic)

  Ticket area (IDR Extended)

  Items area

  Message Region (MR)

  Message Box area

FPM UI Regions

Page 11: Day3_FPM

  Identification Region (IDR)

  Header area (IDR Basic)

  Ticket area (IDR Extended)

  Items area

  Message Region (MR)

  Message Box area

  Context Navigation Region (CNR)

  Toolbar area with:

−  Standard Functions, e.g. (Save, Edit, Finish, Read-only and Next/Previous for GAF)

  Custom buttons

  Dropdown choices

  Navigation menus

FPM UI Regions

Page 12: Day3_FPM

  Identification Region (IDR)

  Header area (IDR Basic)

  Ticket area (IDR Extended)

  Items area

  Message Region (MR)

  Message Box area

  Context Navigation Region (CNR)

  Toolbar area with:

−  Standard Functions, e.g. (Save, Edit, Finish, Read-only and Next/Previous for GAF)

  Custom buttons

  Dropdown choices

  Navigation menus

  Roadmap Region

  GAF only

FPM UI Regions

Page 13: Day3_FPM

  Runtime (Administrator mode):

  Start FPM application with URL parameter sap-config-mode=X

  From the application user interface using the Adapt Configuration link

  Runtime (Expert mode):   From the application user interface using the Change Configuration link

(User parameter FPM_CONFIG_EXPERT must be set to X )

  Design time (Application Configuration):   From the Object Navigator of the ABAP Workbench using the Web Dynpro Application

Configuration

  Design time (Component Configuration):   From the Object Navigator of the ABAP Workbench using the Web Dynpro Component

Configuration

FPM configuration

Page 14: Day3_FPM

FPM configuration editor

Page 15: Day3_FPM

 Control Region:   Select the screens to preview/configure (initial, main or confirmation)   Change or Display application global settings and configuration variants

 Hierarchy:   Provides hierarchical display of configurable elements of the selected screen

 Preview:   Presents the user interface of the application allowing UI element selection

 Action Region:   Contains links to allowed actions for the selected UI

element

 Attribute View:   Allows changes to the attributes of selected UI elements   Changes can be seen immediately in the Preview area

 Message Region:   Shows potential conflicts in the configuration

FPM configuration editor

Page 16: Day3_FPM

FPM configuration editor

Page 17: Day3_FPM

Leads to component configuration for all involved components:

 FPM_OIF_COMPONENT   Show Top-level + sub-level tabs   Adding new tabs

 FPM_GAF_COMPONENT   Roadmap with the main and sub-steps

 FPM_IDR_COMPONENT   Basic Version − Application Title and Tooltip

  Extended Version − Application Title, Tooltip and

Items area

Application configuration

An Application Configuration defines the floor plan and IDR to be used

Page 18: Day3_FPM

 Allows specification of application-specific parameters, e.g. include:

  Enabling Accessibility Mode

  Use of Delta Rendering

  Display of Splash Screen

  Forced use of External Stylesheet

  Disabling Extended Help by default

  Allowing Save

  Use of new Lightspeed Rendering

Application configuration

Page 19: Day3_FPM

 Arranges the layout of the application, by allowing the following tasks:   Enabling   Add extra steps or views   Configure the toolbar with predefined buttons and navigation menus   Attach your UIBBs to the relevant steps or views   Attach predefined FOM GUIBBs   Configure Quick Help for your application   Configure an initial screen and/or confirmation screen   Configure application variants   Change the global application settings

 Window layout:   Navigation hierarchy   Preview   Action area

Component configuration

A Component Configuration defines the specific Components (UIBBs) to assemble into a Floorplan Manager application

Page 20: Day3_FPM

Global Settings:

 Specify Application specific parameters   Define an Application Component Controller   Define a default configuration and Variant

 Specify the Resource Management Parameters   Indicate if UIBBs which are not visible, can be removed from memory so as to increase

the performance and the memory footprint of the application (i.e. Transient)

 Specify Messaging parameters

Component configuration

Page 21: Day3_FPM

 Global Settings:

 Maximum message size − The Message Region will expand to accommodate up to the Maximum Message Size

messages

− A scroll bar is presented to allow access to any messages exceeding the maximum limit

 Message logs − You can produce a log of the messages for your application

− All previously reported messages can be seen via the Display Message Log link in the Message Region

− Note: You can also turn on the message log by using the URL parameter FPM_SHOW_MESSAGE_LOG=X

Message configuration All messages are displayed in the Message Region,

which is included in all FPM applications

Page 22: Day3_FPM

 Both the Header and the Ticket areas can be configured at design-time in the

Component Configuration window for the IDR configuration

 Ticket area:

  Only available for the OIF applications

  To configure the ticket area, choose Add IDR Extended

  Attributes for Ticket Top and Ticket Bottom appear

  These attributes can be called dynamically to add:

–  Label/value pairs

–  Label/navigation link pairs

–  Label/icon pairs

Header configuration

Page 23: Day3_FPM

 Configuration Options for toolbar buttons:

Toolbar configuration

Button Type Use Activation Function Primarily to be used as a Save button (automatically added by

default) Alternate Function Application-specific function shown in the same toolbar region

as the Save button Other Function Application-specific function shown in separate toolbar region

You Can Also Provide navigation links away from the FPM

Related Links Provide navigation links away from the FPM

Close (GAF only)

Provides a Close button

Exit to Main Step (GAF sub-steps only)

Returns to the Main Step to which the button is assigned

Finish (GAF main steps only)

Roadmap is executed sequentially by navigating up to the last screen (before the confirmation screen) or stopping if on error

Next steps/Final Action (GAF only)

Provides mechanism to execute final action before the confirmation screen Each variant of the roadmap can have one Final Action

Page 24: Day3_FPM

 Standard FPM GUIBBs:   Form Component (FPM_FORM_UIBB)   List Component (FPM_LIST_UIBB)   Tabbed Component (FPM_TABBED_UIBB)

 Requires a custom Feeder Class:   Must Implement Interface: − IF_FPM_GUIBB_FORM for form components; − IF_FPM_GUIBB_LIST for list components

  Provides: − Data definition, structure or table definitions and their technical aspects via method − An optional action definition based on metadata − Action/event handling and data forwarding to the underlying application model

 The actual data retrieval and display are only executed at runtime using the provided configuration

Generic UIBBs

Generic User Interface Building Blocks (GUIBB) are generic design templates which can be added to the Component Configuration during design time in place a of custom UIBBs

Page 25: Day3_FPM

 Configuration Steps:

1.  Select Add UIBB button in Component Configuration Action area.

2.  In the Component field, enter FPM_FORM_UIBB or FPM_LIST_UIBB

3.  In the View field, enter FORM_WINDOW or LIST_WINDOW

4.  In the Configuration Name field, enter a name for the form component configuration

5.  Select Save

6.  Select Configure UIBB

7.  Create a configuration name

8.  Provide the name of the Feeder Class

9.  The Form / List Editor is launched to specify the layout and actions

Generic UIBBs

Page 26: Day3_FPM

 Feeder Class Methods:

Generic UIBBs

Name Description GET-DEFINITION Provide all necessary information for configuring the list/

form GET_PARAMETER_LIST Called at design time to define the list parameters

supported by the feeder class. This list is used by the FPM Configuration Editor to provide the input fields for these parameters

INITIALIZE First method called at runtime when the list/form is created

FLUSH The first method called during an event loop. Can be used to forward changed data to other components

PROCESS_EVENT Called within the FPM event loop, forwarding the FPM PROCESS_EVENT to the feeder class

GET_DATA Called within the FPM event loop, forwarding the FPM PROCESS_BEFORE_OUTPUT event to the feeder class. Provides the form data after the event has been processed

Page 27: Day3_FPM

 Headers

 Toolbars

 Messaging

 Dialog Boxes

FPM Runtime APIs

Page 28: Day3_FPM

 Adjusting the IDR:

  During runtime, use the IDR API to make changes to the individual IDR areas

  This API consists of the methods encapsulated in the IF_FPM_IDR interface

  Also possible to provide application a link to the FPM Configuration Editor

  Accessed via CL_FPM_SERVICE_MANAGER

 Events:

  FPM generally only ensures only that all affected UIBB’s are informed

  All standard Function buttons are attached to a hard-coded FPM events

  Some button events are pre-configured (e.g. Previous, Next, Save) which may require no

extra code

  Special case: Printing

– Even though a Print button is provided there is no print support in FPM

API: Header

Page 29: Day3_FPM

 Methods:

API: Header

Region Method Name Description

Header

GET_APPLICATION_TITLE Retrieves the title text and its tooltip

SET_APPLICATION_TITLE Specify a new title text and/or tooltip

SET_HEADER_VISIBILITY Display or hide the header entirely

Ticket

GET_TICKET Retrieves the ticket top, bottom and tooltip texts

SET_TICKET Specify new texts for the ticket top, bottom and tooltips

GET_TICKET_VISIBILITY Display or hide the ticket area

Items

ADD_ITEM_GROUP_BY_VAL Adds a new ‘item group’ to the item area as simple text strings. Each item consists of a label, its tooltip, a value and the value’s tooltip. A group consists of an arbitrary amount of items

ADD_ITEM_GROUP_BY_REF Similar to ADD_ITEM_GROUP_BY_VAL, but passing a reference to a context node attribute, allowing dynamic updates and data types other than string

ADD_NAVIGATION_ITEM Adds a pair of label/navigation links. The link itself is provided by the report launchpad

INITIALIZE_ITEMS Clears all items from the IDR

Page 30: Day3_FPM

 Example:

API: Header

DATA: lo_fpm_idr TYPE REF TO if_fpm_idr, lo_fpm TYPE REF TO if_fpm. lo_fpm = cl_fpm_factory=>get_instance( ). lo_fpm_idr ?= lo_fpm->get_service( cl_fpm_service_manager=>gc_key_idr ). lo_fpm_idr->set_ticket( EXPORTING iv_top                      iv_bottom iv_top_tooltip   iv_bottom_tooltip ).  

Page 31: Day3_FPM

 Changing Toolbars:

  GAF Toolbar: Interface IF_FPM_CNR_GAF (initial screen or main screen)

  OIF Toolbar: Interface IF_FPM_CNR_OIF (initial screen or main screen)

  Accessed via CL_FPM_SERVICE_MANAGER

  API Methods require different parameters depending on GAF or OIF floor plan

 Events:

  FPM generally only ensures only that all affected UIBB’s are informed

  All standard Function buttons are attached to a hard-coded FPM events

  Some button events are pre-configured (e.g. Previous, Next, Save) which

may require no extra code

  Special case: Printing

– Even though a Print button is provided there is no print support in FPM

API: Toolbars

Page 32: Day3_FPM

  Interface IF_FPM_CNR_xxx Methods:

API: Toolbars

Name Description DEFINE_BUTTON Create/Change both standard and application-specific buttons.

•  Parameter IV_FUNCTION defines the button type (see IF_FPM_CONSTANTS=>gc_button).

•  Parameter ELEMENT_ID is needed for application-specific buttons must be changed

DEFINE_BUTTON_CHOICE Create/Change both standard and application-specific button-choices. •  Parameter IV_FUNCTION defines choice type (see

IF_FPM_CONSTANTS=>gc_button_choice). •  Parameter ELEMENT_ID is needed if application-specific

buttons must be changed subsequently CREATE_SEPARATOR Create a separator at runtime in the Other Functions area

SET_DUPLICATE_TOOLBAR Activate / Deactivate the duplication of the toolbar

DEFINE_YOU_CAN_ALSO Define launchpads for the You Can Also menu bar

Page 33: Day3_FPM

  Interface IF_FPM_CNR_xxx Methods:

API: Toolbars

Name Description DEFINE_RELATED_LINKS Use this method to edit the menu bar for Related Links

GET_BUTTONS Determines which buttons (and their configurations) are to be shown in the toolbar

GET_BUTTON_CHOICES Determines which button-choices (and their configurations) are to be shown in the toolbar

GET_SEPARATORS Determines the positions of the separators in the toolbar (only in the Other Functions area)

GET_RELATED_LINKS Determines the contents of the Related Links menu in the toolbar

GET_YOU_CAN_ALSO Determines the contents of the You Can Also menu in the toolbar

Page 34: Day3_FPM

 Example:

API: Toolbars

DATA: lo_cnr_gaf TYPE REF TO if_fpm_cnr_gaf, lo_fpm TYPE REF TO if_fpm. lo_fpm = cl_fpm_factory=>get_instance( ). lo_cnr_gaf ?= lo_fpm->get_service( cl_fpm_service_manager=>gc_key_cnr_gaf ). lo_cnr_gaf->define_button( EXPORTING iv_variant_id (op%onal;  e.g.  ’my_variant_1';  current  variant  if  skipped)   iv_mainstep_id (op%onal;  e.g.  ‘mainstep_1’;  current  main  step  if  skipped)   iv_subvariant_id (op%onal;  e.g.  ‘subvariant_123’)   iv_substep_id (op%onal;  e.g.  ‘substep_1’)   iv_function (e.g.  EXIT_TO,  FINISH,  SAVE_DRAFT  ,  see    

       IF_FPM_CONSTANTS=>gc_button) iv_screen (op%onal;  Screen  to  be  changed  (e.g.  INIT,  MAIN)     iv_element_id (op%onal;  to  allow  changing  buSon  proper%es  aTerwards)   iv_sequence_id (op%onal;  determine  place  to  insert  buSon;  only  when  using  

         OTHER_FUNCTIONS)     iv_design (op%onal;  BuSon-­‐Design) iv_enabled (op%onal;  BuSon-­‐Enabling) iv_explanation (op%onal;  BuSon-­‐Explana%on)   iv_on_action    (op%onal;  determines  the  Event-­‐Id  for  a  buSon;     iv_hotkey    (op%onal;  key-­‐combina%on  for  ac%va%ng  the  event  of  this  buSon>  ).  

Page 35: Day3_FPM

 Example continued:

API: Toolbars

…   lo_cnr_gaf->define_button_choice( EXPORTING iv_variant_id (op%onal;  e.g.'variant_1’;  current  variant  if  skipped)   iv_subvariant_id (op%onal;‘subvariant_xyz’)   iv_mainstep_id (op%onal;‘mainstep_1’;  mainstep  if  skipped)     iv_substep_id (op%onal;‘substep_99’)   iv_function (e.g.  OTHER_FUNCTIONS  (appl-­‐specific  buSon-­‐choices))   iv_screen (op%onal;  the  screen  where  the  UI-­‐Element  has  to  be  changed  (INIT,    

       MAIN)     iv_element_id (op%onal;  only  if  you  want  to  change  the  buSon-­‐choice  proper%es  

         aTerwards)   iv_sequence_id (op%onal;  only  if  you  use  OTHER_FUNCTIONS;  determines  the  place    

       where  to  insert  this  buSon-­‐choice)   iv_enabled (op%onal;  BuSon-­‐Choice-­‐Enabling)   iv_text (op%onal;  BuSon-­‐Choice-­‐Label)   iv_tooltip (op%onal;  BuSon-­‐Choice-­‐Tool%p)   iv_visibility (op%onal;  BuSon-­‐Visibility)   it_menu_action_items (menu  elements  of  a  BuSon-­‐Choice)  ).  

Page 36: Day3_FPM

Changing Toolbars:   Interface IF_FPM_MESSAGE_MANAGER provides methods similar to IF_WD_MESSAGE_MANAGER, e.g.:   Clearing all messages   Raising exceptions   Reporting messages

Using the FPM Message Manager: 1.  Declare a global attribute in the Component Controller e.g.:

MR_MESSAGE_MANAGER as type IF_FPM_MESSAGE_MANAGER 2.  Obtain reference to instance in method WDDOINIT

API: Messaging

METHOD wddoinit. "Get handle to the IF_FPM interface

wd_this->mr_fpm = cl_fpm_factory=>get_instance( ).

"Get handle to the FPM Message Manager

wd_this->mr_message_manager = wd_this->mr_fpm->mo_message_manager.

ENDMETHOD.

Page 37: Day3_FPM

Initiate/Manage via  The NEEDS_CONFIRMATION method during the FPM Event Loop

 The PROCESS_EVENT method for the handling of application-specific dialog boxes

 Work-protect mode (offered by the Portal and the NWBC) using the IF_FPM_WORK_PROTECTION interface

API: Dialog boxes

Page 38: Day3_FPM

Data-Loss Dialog Boxes:  Any UIBB can request a data-loss dialog box:

  During the NEEDS_CONFIRMATION method of the FPM event loop   By returning the pre-defined instance of the class CL_FPM_CONFIRMATION_REQUEST as

detailed below:

Custom Confirmation Dialog Boxes:  Create custom instance of the class CL_FPM_CONFIRMATION_REQUEST adding

application-specific text

API: Dialog boxes

METHOD needs_confirmation

IF <condition>.

eo_confirmation_request = cl_fpm_confirmation_request=>go_data_loss.

ENDIF.

ENDMETHOD.

Page 39: Day3_FPM

 Application Controllers

 Application Configuration Controllers

 Shared Data Components

 Transactions

Useful FPM Interfaces

Page 40: Day3_FPM

  Implements interface IF_FPM_APP_CONTROLLER

 Not possible with simple UIBBs because:

1.  Interface IF_FPM_UI_BUILDING_BLOCK only participate in the event loop when the

corresponding UIBBs are visible at the time the event loop happens or become visible

after the current event loop has finished successfully

2.  UIBBs cannot make assumptions about the sequence in which they are called

Application controllers

An Application Controller is a singleton instance of a Component provided by the application. Useful when it is necessary for single component instance to participate in all FPM events to control the end-to-end application

Page 41: Day3_FPM

Interface Methods:

Application controllers

Method Use

BEFORE_FLUSH Executes before/after the regular FPM FLUSH methods AFTER_FLUSH

BEFORE_NEEDS_CONFIRMATION Executes before/after the regular FPM NEEDS_CONFIRMATION methods AFTER_NEEDS_CONFIRMATION

BEFORE_PROCESS_EVENT Executes before/after the regular FPM PROCESS_EVENT methods AFTER_PROCESS_EVENT

Page 42: Day3_FPM

 Application-specific configuration controller (AppCC) allows for:   Performing checks affecting more than one UIBB   Making global FPM event adjustments, e.g. − Cancelling events − Changing event parameters

  Reading the structure of the FPM application at runtime   Changing the structure of the FPM application dynamically   Selecting a Configuration Variant at runtime

  Implement one of the following Web Dynpro interfaces in a Web Dynpro component:   IF_FPM_OIF_CONF_EXIT for an OIF application   IF_FPM_GAF_CONF_EXIT for a GAF application

Application configuration controllers

Page 43: Day3_FPM

 Examples of IF_FPM_xxx_CONF_EXIT Interface Methods:

Application configuration controllers

Method Use GET_VARIANTS Primarily to be used as a Save button (automatically added by

default) GET_MAINVIEWS Returns a list of all main views for a given variant for OIF

applications GET_MAINSTEPS Returns a list of all main steps for a given variant (GAF

applications) ADD_UIBB Dynamically adds UIBB to a main view, sub-view, main step,

or sub-step ADD_MAINVIEW Dynamically adds another main view at runtime

RENAME_MAINSTEP Dynamically renames a Main Step at runtime

Page 44: Day3_FPM

 Sharing Component:   Implements Interface IF_FPM_SHARED_DATA

(a marker interface containing no methods or attributes)  Consuming Components:

  Declare a usage to the Shared Data Component   Communicate via Context Mapping and/or method calls

 FPM controls the lifecycle of the Shared Component

 Generally also specified for Application Controllers

Shared Data Components

There is often the need to share data between these components, especially when the UIBBs of an application are implemented in several distinct Components.

Page 45: Day3_FPM

 Transactions are supported by FPM in a systematic manner

 Provided by implementing Interface IF_FPM_TRANSACTION

 Optional interface providing the following advantages:   Logical sequence in which the interface methods are called  Transaction steps can be split up into the required sequence  The check – save – validate sequence provides high transaction integrity  The check – save – fail – recover sequence provides robustness

Transactions

Page 46: Day3_FPM

IF_FPM_TRANSACTION Interface Methods:

Transactions

Method Name Description CHECK_BEFORE_SAVE The rejected return parameter indicates whether the pre-save

validation was successful. Return FALSE if the check was successful, TRUE to reject the save request

SAVE Performs the actual save and any required database commits. Called when CHECK_BEFORE_SAVE returned FALSE. If the save was indeed successful, then the method AFTER_COMMIT is called

AFTER_COMMIT Perform clean up activities such as: • releasing database locks, • releasing other resources, • triggering an event for processing

AFTER_REJECTED_SAVE Perform any roll back activities and/or release locks and resources

Page 47: Day3_FPM

  http://help.sap.com/saphelp_autoid70/helpdata/en/9f/95467bbefc4a808fffeba4c5177258/frameset.htm

References