Show TOC

Working with the Assistance classLocate this document in the navigation structure

Use

You can create a uniquely assigned assistance class for each Web Dynpro component. This class should inherit from the abstract class CL_WD_COMPONENT_ASSISTANCE. Creating an assistance class for a component provides the following benefits:

  • You can store coding there that is required within the component, but is not linked directly with the layout or with the function of a controller. This could be, for example, a call of the application layer or UI-based editing of the data.

    Note

    Method calls of the assistance class are much better from a performance point of view than calls of methods of a Web Dynpro controller.

  • The second important function of the assistance class is the management of dynamic texts.

    Texts that are combined at runtime only and/or contain variables can be stored in the text pool of the assistance class as text symbols.

The assistance class is automatically instantiated when a component is called. The instance is available to each controller of the component through the attribute WD_ASSIST.

Shared Use of an Assistance Class Instance

It is also possible within component usage to make the assistance class instance of the main component available to the component being used. To do this, when you create the instance of the used component, you have to specify the reference to the current instance of the assistance class of the main component as the value for the ASSISTANCE_CLASS parameter (that is, the reference variable wd_assist). In the SWPD_DEMO collection in your system, you can find the Web Dynpro application DEMO_COMMON_ASSISTANCE in which you can perform the implementation in the WDDOINIT method of the component controller of the main component DEMO_COMMON_ASSISTANCE1.

Working with Text Symbols in Web Dynpro ABAP

The class CL_WD_COMPONENT_ASSISTANCE provides central functions through which a Web Dynpro component can access text symbols of the assistance class. Using the instance attribute WD_ASSIST as well as the method IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( ), you can access text symbols of the assistance class from within each controller of your component. When the method is called, the three-digit ID of the text symbol is passed to the KEY parameter.

method MY_CONTROLLER_METHOD .
data: my_text type string.
my_text = WD_ASSIST->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( KEY = '001').
...
endmethod.
            
Caution

The way text symbols are accessed from a Web Dynpro component is different to how they are accessed in ABAP objects.

You can maintain text symbols in the assistance class from any controller. To do this, choose Start of the navigation path Goto Next navigation step Text Symbols End of the navigation path.

Note

As a rule, every ABAP class can serve as an assistance class. However, the services integrated in the Web Dynpro framework are available only if the assistance class is derived from the class CL_WD_COMPONENT_ASSISTANCE.

The assistance class must not have any required parameters in the constructor.

You can use the Class Builder to find information about the methods available in the class.