Top Banner
The Controller Interface Standard Attributes wd_this (always available - references controller - see next section for list of methods because it is dependent on controller type. Within a component click on Display interface controller to view attributes and methods associated with its wd_this) wd_context (always available - list of methods ) wd_comp_controller (if componentcontroller defined as used controller for another controller, it appears in the other controller as type IG<USDED_CONTROLLER>. A view's componentcontroller is always present for the view as type IG_COMPONENTCONTROLLER which is thewd_this for componentcontroller. ) wd_assist (if an assistance class is related to a component) wd_this - Structure of the Controller Interface IF_<CONTROLLER> (Local) o e.g., IF_VIEW1 - The view name is VIEW1. Its WD_THIS is defined as IF_VIEW1, which is a local controller interface. o e.g., WD_THIS->WD_CPIFC_<CONTROLLER> will access the view's used component e.g., wd_this->wd_cpifc_model( ) model is the name of the used component IG_<CONTROLLER> (Global) IWCI_<CONTROLLER> (SAP Reusable) o accessing the used component within the view, VIEW1 above:
18

The Controller Interface

Nov 27, 2014

Download

Documents

hjhggfg
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Controller Interface

The Controller Interface

Standard Attributes

wd_this (always available - references controller - see next section for list of methods because it is dependent on controller type. Within a component click

on   Display interface controller to view attributes and methods associated with its wd_this)

wd_context (always available - list of methods) wd_comp_controller (if componentcontroller defined as used controller for

another controller, it appears in the other controller as type IG<USDED_CONTROLLER>. A view's componentcontroller is always present for the view as type IG_COMPONENTCONTROLLER which is thewd_this for componentcontroller. )

wd_assist (if an assistance class is related to a component)

wd_this - Structure of the Controller Interface

IF_<CONTROLLER> (Local)o e.g., IF_VIEW1 - The view name is VIEW1. Its WD_THIS is defined as

IF_VIEW1, which is a local controller interface.o e.g., WD_THIS->WD_CPIFC_<CONTROLLER> will access the view's

used component e.g., wd_this->wd_cpifc_model( )

model is the name of the used component IG_<CONTROLLER> (Global) IWCI_<CONTROLLER> (SAP Reusable)

o accessing the used component within the view, VIEW1 above: wd_this->wd_cpifc_model( )

ZIWCI_<CONTROLLER> (Custom Reusable) *** Note, if you create a reusuable component (e.g., ZLSO_MC_ATTENDEE_LIST), when you reuse it, the code must reference ZIWCI_LSO_MC_ATTENDEE_LIST, not ZIWCI_ZLSO_MC_ATTENDEE_LIST!

Page 2: The Controller Interface

Generated Local Interface for View Controllers

View Controller <VIEW>

Generated Interface IF_<VIEW> (e.g., IF_VIEW1)

METHODS

wd_get_api wd_create_action

USED CONTROLLERS

methodso get_<USED_CONTROLLER>_CTR (e.g.,

get_componentcontroller_ctr)o wd_cpuse_<COMPONENT_USAGE> (e.g., wd_cpuse_model)o wd_cpifc_<COMPONENT_USAGE> (e.g., wd_cpifc_model)

INBOUND PLUGS

Page 3: The Controller Interface

methodso handle<INBOUND_PLUG>

OUTBOUND PLUGS

methodso fire_<OUTBOUND_PLUG>_plg

CONTEXT

constantso wdctx_<NODE>

typeso element_<NODE>o elements_<NODE>

USER-DEFINED ATTRIBUTES

ACTIONS

ORDINARY METHODS

Page 4: The Controller Interface

IF_<VIEW> (e.g., IF_VIEW1) generated interface for view controllers - view interfaces always private

<ATTRIBUTE> (e.g., RANKING)WDCTX_<NODE> (e.g., WDCTX_SEARCH_RESULTS)

WD_GET_API()WD_CREATE_ACTION()

GET_<USED_CONTROLLER>_CTR() e.g., GET_COMPONENTCONTROLLER_CTR() for all used controllers defined in same component WD_CPUSE_<COMPONENT_USAGE>() e.g., WD_CPUSE_MODEL() if component usage is added to used controller list WD_CPIFC_<COMPONENT_USAGE>() e.g., WD_CPIFC_MODEL() if interface controller of used component is used controller HANDLE<INBOUND_PLUG>()FIRE_<OUTBOUND_PLUG>_PLG()GET_<ACTION>_ACT()ONACTION<ACTION>()<ORDINARY_METHOD>()

 

IG_<WINDOW> generated public interface for window controllers

<ATTRIBUTE> flag PUBLIC checked WDCTX_<NODE>

WD_GET_API()

FIRE_<OUTBOUND_PLUG>_PLG() <ORDINARY_METHOD>()

For window controller all ordinary methods and outbound plugs are defined as public.

IF_<WINDOW> generated private interface for window controllers

<ATTRIBUTE> flag PUBLIC not checked

WD_CREATE_ACTION()

GET_<CONTROLLER>_CTR() for all controllers defined in same component WD_CPUSE_<COMPONENT_USAGE>() if component usage is added to used controller list WD_CPIFC_<COMPONENT_USAGE>() if interface controller of used component is used controller HANDLE<INBOUND_PLUG>() <EVENT_HANDLER_METHOD>()

For window controller all inbound plugs are defined as private.

Page 5: The Controller Interface
Page 6: The Controller Interface

Custom controllers similar to window controllers except no inbound or outbound plugs. Instead event and event handlers, both of which are defined in private interface.

IG_<CUSTOM_CTR> generated public interface for custom controllers

<ATTRIBUTE> flag PUBLIC checked WDCTX_<NODE>

WD_GET_API()

<ORDINARY_METHOD>()

 

IF_<CUSTOM_CTR> generated private interface for custom controllers

<ATTRIBUTE> flag PUBLIC not checked

WD_CREATE_ACTION()

GET_<CONTROLLER>_CTR() for all controllers defined in same component WD_CPUSE_<COMPONENT_USAGE>() if component usage is added to used controller list WD_CPIFC_<COMPONENT_USAGE>() if interface controller of used component is used controller <EVENT_HANDLER_METHOD>()

FIRE_<EVENT>_EVT

 

Page 7: The Controller Interface

(Z)IWCI_<COMPONENT> (globally visible)

WD_GET_API()

<ORDINARY_METHOD>() flag INTERFACE checked <SUPPLY_FUNCTION>() flag INTERFACE checked (automatically initializes context nodes with data)

Can be accessed by controllers in other components via WD_CPIFC_<COMPONENT_USAGE>

 

IG_COMPONENTCONTROLLER (global)

<ATTRIBUTE> flag PUBLIC checked WDCTX_<NODE>

<ORDINARY_METHOD>() flag INTERFACE not checked 

FIRE_<EVENT>_EVT flag INTERFACE checked

 

IF_COMPONENTCONTROLLER (local)

Page 8: The Controller Interface

<ATTRIBUTE> flag PUBLIC not checked

WD_CREATE_ACTION()

GET_<CONTROLLER>_CTR() for all controllers defined in same component WD_CPUSE_<COMPONENT_USAGE>() if component usage is added to used controller list WD_CPIFC_<COMPONENT_USAGE>() if interface controller of used component is used controller <EVENT_HANDLER_METHOD>()

FIRE_<EVENT>_EVT flag INTERFACE not checked

 

Generic Web Dynpro API

Page 9: The Controller Interface

 

IF_WD_CONTROLLER contains the functionality available for all controllers. Thus, this interface is embedded in the interfaces IF_WD_VIEW_CONTROLLER and IF_WD_COMPONENT.

Except for the View Controller, which has no public interface, the wd_get_api() is defined in the public interface of all the controllers. Therefore, it can be called from any controller that declares the usage of that controller. Is the following correct?

wd_this->wd_cpifc_<COMPONENT_USAGE>-wd_get_api()

Web Dynpro API for custom controllers (and embedded in view/window & component controllers)

IF_WD_CONTROLLER

NAME: string

GET_ACTION()

Page 10: The Controller Interface

GET_COMPONENT()GET_CONTEXT()GET_CONTROLLER_INFO()GET_MESSAGE()GET_MESSAGE_MANAGER()GET_PERSONALIZATION_MANAGER()IS_ALIVE()

GET_ACTION() Returns IF_WD_ACTION used to read & redefine action properties. Can only be called from view controller methods

GET_COMPONENT() Returns IF_WD_COMPONENT. The following are equivalent when not component controller:

WD_THIS->get_componentcontroller_ctr()->wd_get_api() WD_COMP_CONTROLLER->wd_get_api() WD_THIS->wd_get_api()->get_component

GET_CONTEXT() Returns IF_WD_CONTEXT. The following are equivalent ways to access controller's root node:

WD_CONTEXT WD_THIS->wd_get_api()->get_context()->ROOT_NODE

GET_CONTROLLER_INFO() Returns IF_WD_RR_CONTROLLER (controller's name)

GET_MESSAGE_MANAGER() Returns IF_WD_MESSAGE_MANAGER (methods used to report messages, clear the message stack or check existance of messages)

GET_PERSONALIZATION_MANAGER() Returns IF_WD_PERSONALIZATION_MANAGER (methods used to load, save or delete personalization variants. Not accessible from view or window controllers)

IS_ALIVE() Returns whether controller object has been cleared

Web Dynpro API for view & window controllers

IF_WD_CONTROLLER (see above)

IF_WD_NAVIGATION_SERVICES

PREPARE_DYNAMIC_NAVIGATION()DO_DYNAMIC_NAVIGATION()REMOVE_DYNAMIC_META_DATA()

Page 11: The Controller Interface

IF_WD_NAVIG_SERVICES_NEW

PREPARE_DYNAMIC_NAVIGATION()DO_DYNAMIC_NAVIGATION()

IF_WD_VIEW_CONTROLLER

FIRE_PLUG()GET_EMBEDDING_WINDOW_CTLR()GET_VIEW_INFO()REQUEST_FOCUS()REQUEST_FOCUS_ON_ACTION()GET_CURRENT_ACTION()GET_CURRENT_ACTION_INFO()IS_CURRENT_ACTION_VALIDATING()GET_VIEW_USAGE()GET_CONTEXT_MENU_MANAGER()

FIRE_PLUG() Fires any plug using it's name as string parameter

GET_EMBEDDING_WINDOW_CTLR() Returns IF_WD_WINDOW_CONTROLLER if the view or window is embedded in another window (methods allow access to the meta data description of the window controller, e.g., embedded views, navigation links, name of default view)

GET_VIEW_INFO() Returns IF_WD_RR_VIEW methods allow access to the meta data description of the view controller (e.g., view name, life span, description)

REQUEST_FOCUS() sets the focus to a certain UI element if the element has its value property bound to a context attribute. Can not be called from window controller.

REQUEST_FOCUS_ON_ACTION() sets the focus to a certain UI element if the element has the event property on_ bound to an action. Can not be called from window controller.

GET_CURRENT_ACTION() Returns IF_WD_ACTION used to determine which client side event was fired. Typically used in method wddobeforeaction(). Can not be called from window controller.

GET_CURRENT_ACTION_INFO() Returns WDAPI_ACTION used to determine which client side event was fired. Typically used in method wddobeforeaction().

IS_CURRENT_ACTION_VALIDATING() Returns ABAP_BOOL used to determine if the current action is of type Standard (ABAP_TRUE) or Validation-

Page 12: The Controller Interface

Independent (ABAP_FALSE). Used in connection with handling application errors. Can not be called from window controller.

GET_VIEW_USAGE() Returns IF_WD_RR_VIEW_USAGE methods allow access to the meta data about the view usage (view, name of the view usage, embedding container). In addition, there are methods to define or create temporary container assignments for the view usage and to create or delete temporary navigation links between outbound plugs. Can not be called from the window controller.

GET_CONTEXT_MENU_MANAGER() Returns IF_WD_CONTEXT_MENU_MANAGER methods allow access to the runtime objects of context menus. Can not be called from window controller.

PREPARE_DYNAMIC_NAVIGATION() & DO_DYNAMIC_NAVIGATION() Returns IF_WD_NAVIGATION_SERVICES or IF_WD_NAVIGATION_SERVICES_NEW methods allow the definition of navigation links dynamically. This is necessary if component usages are defined and instantiated at runtime. Then the inbound plugs of the related interface views do not exist at design time, which is the prerequisite to define static navigation links. If you dynamically create plugs, you must dynamically delete them. The methods in IF_WD_NAVIGATION_SERVICES_NEW return handles that may be used to delete the dynamically defined navigation links subsequently. If the methods of the interface IF_WD_NAVIGATION_SERVICES are used to create the navigation links, the method remove_dynamic_meta_data() has to be called to remove the links.

Web Dynpro API for component controllers

IF_WD_CONTROLLER (see above)

IF_WD_COMPONENT

ID: StringASSISTANCE_CLASS: CL_WD_COMPONENT_ASSISTANCE()

GET_ID()GET_WINDOW_MANAGER()GET_COMPONENT_INFO()GET_PORTAL_MANAGER()GET_CONFIGURATION_KEY()GET_PERSONALIZATION_MANAGER()GET_APPLICATION()CANCEL_NAVIGATION()ADD_EVENT_HANDLER()REMOVE_EVENT_HANDLER()GET_CMP_USAGE_GROUP()

Page 13: The Controller Interface

CREATE_CMP_USAGE_GROUP()HAS_CMP_USAGE_GROUP()REMOVE_CMP_USAGE_GROUP()REMOVE_PENDING_INPUT()

GET_ID() Returns unique ID (string) of the actual WD component

GET_WINDOW_MANAGER() Returns unique IF_WD_WINDOW_MANAGER. Used to create modal popups or external dialog screens.

GET_COMPONENT_INFO() Returns unique IF_WD_RR_COMPONENT. Used to access meta data description of the component and included entities.

GET_PORTAL_MANAGER() Returns unique IF_WD_PORTAL_INTEGRATION. Allows access to information about the portal type and version embedding the WD application. Contains methods to access portal functionality.

GET_APPLICATION() Returns unique IF_WD_APPLICATION.Used to access meta data description of the application.

CANCEL_NAVIGATION() Used to prevent navigation. Must be called before wddobeforenativation() is finished.

ADD_EVENT_HANDLER() Used to dynamically register an event handler method.

REMOVE_EVENT_HANDLER() Used to dynamically delete any dynamically defined registration of an event handler for an event.

xxx_CMP_USAGE_GROUP() Used to handle component usages that are defined dynamically. GET_ & CREATE_ return IF_WD_COMPONENT_USAGE_GROUP.

MESSAGE MANAGER API

Page 14: The Controller Interface

WD_THIS->wd_get_api->get_message_manager()

IF_WD_MESSAGE_MANAGER

Category TEXT REPORT_SUCCESS()REPORT_WARNING()REPORT_ERROR_MESSAGE()REPORT_FATAL_ERROR_MESSAGE()REPORT_ATTRIBUTE_ERROR_MESSAGE()REPORT_ELEMENT_ERROR_MESSAGE()

Category EXCEPTION REPORT_EXCEPTION()REPORT_FATAL_EXCEPTION()REPORT_ATTRIBUTE_EXCEPTION()REPORT_ELEMENT_EXCEPTION()

Category T100

Page 15: The Controller Interface

REPORT_T100_MESSAGE()REPORT_ATTRIBUTE_T100_MESSAGE()REPORT_ELEMENT_T100_MESSAGE()

IS_EMPTY()HAS_VAL_ERRORS_FOR_WINDOW()HAS_VALIDATION_ERRORS()CLEAR_MESSAGES()REMOVE_MESSAGE()GET_MESSAGES()GET_MESAGE_FOR_ID()

Standard Messages

1. report_success()2. report_t100_message() with MSGTY = S, I3. report_exception() with MESSAGE_TYPE = 0

Warnings

1. report_warning()2. report_t100_message() with MSGTY = W3. report_exception() with MESSAGE_TYPE = 1

Error Messages

1. report_error_message()2. report_t100_message() with MSGTY = E3. report_exception() with MESSAGE_TYPE = 2