Tuesday, June 10, 2008

Web Dynpro ABAP Runtime APIs

The application developer can use Web Dynpro APIs as a set of interfaces for an efficient design of controller programming. APIs can be accessed in several ways. For a complete list of all classes and interfaces of the framework and the access methods, refer to the reference manual in this documentation.

The runtime interfaces offer multiple methods for different programming areas. These include, for example:

· Access to the window manager API IF_WD_WINDOW_MANAGER for creation of popups using existing Web Dynpro windows

· Access to the portal integration API IF_WD_PORTAL_INTEGRATION

· Context processing

· Creating messages

More areas apply when using dynamic programming. Examples:

· Dynamic manipulation of the layout

· Dynamic navigation control

Example for Accessing a Runtime API

The runtime API of the different controller types are mentioned in the chapter Reference Variable WD_THIS. Depending on the type of the controller, the return value of the method WD_GET_API of the local controller interface is a reference variable of the interface

· IF_WD_VIEW_CONTROLLER (for all view controllers),

· IF_WD_COMPONENT (for all component controllers) or

· IF_WD_CONTROLLER (for all interface controllers or custom controllers).

This graphic is explained in the accompanying text The following example is the source code of the access to the runtime API of the type of the local controller - in this case, a view controller:

method MY_VIEW_CONTROLLER_METHOD .

data: L_RUNTIMEAPI type ref to IF_WD_VIEW_CONTROLLER.

L_RUNTIMEAPI = WD_THIS->WD_GET_API( ) .

.

endmethod.

In this example method, you can use the methods of the runtime API IF_WD_VIEW_CONTROLLER using the attribute L_RUNTIMEAPI.

This graphic is explained in the accompanying text You can also access the runtime API of the type of a used controller. Example:

method MY_CONTROLLER_METHOD .

data: L_COMP_INTF type ref to IG_COMPONENTCONTROLLER,

L_RUNTIMEAPI type ref to IF_WD_COMPONENT.

L_COMP_INTF = WD_THIS->GET_COMPONENTCONTROLLER_CTR( ).

L_RUNTIMEAPI = L_COMP_INTF->WD_GET_API( ) .

.

endmethod.

In this case, a reference variable of the component-global interface of the component controller is created. A reference variable of the runtime API of the component controller is then created using the method WD_GET_API.

This graphic is explained in the accompanying textSince the attribute WD_COMP_CONTROLLER of the type IG_COMPONENTCONTROLLER is already created by the development environment for each view controller, the source code for the access to the runtime API of the component controller is shorter:

method MY_VIEW_CONTROLLER_METHOD .

data: L_RUNTIMEAPI type ref to IF_WD_COMPONENT.

L_RUNTIMEAPI = WD_COMP_CONTROLLER->WD_GET_API( ) .

.

endmethod.

All the other APIs of the Web Dynpro runtime are made accessible in different ways. Two examples:

· The API IF_WD_VIEW can exclusively be accessed using the attribute VIEW of the method WDDOMODIFYVIEW of the local view controller interface.

· The APIs IF_WD_CONTEXT_NODE and IF_WD_CONTEXT_NODE_INFO can be accessed using the attribute WD_CONTEXT of the type IF_WD_CONTEXT. They are required to set the Fixed Values of Attributess.

For a complete list of all classes and interfaces of the framework and the access methods, refer to the reference manual in this documentation.

No comments:

Archive