Show TOC

Background documentationWorking with the Assistance class Locate this document in the navigation structure

 

For each Web Dynpro component, you can create a uniquely assigned assistance class. 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 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.

    End of the note.
  • 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.

Syntax Syntax

  1. method MY_CONTROLLER_METHOD .
  2. data: my_text type string.
  3. my_text = WD_ASSIST->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( KEY = '001').
  4. ...
  5. endmethod.
End of the code.

Caution Caution

Accessing text symbols from a Web Dynpro component is different from the procedure for ABAP objects (see Text Symbols in General ABAP Programming).

End of the caution.

You can maintain text symbols in the assistance class from any controller. To do this, choose   Goto   Text Symbols  .

Note 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.

Note that the assistance class may not have any required parameters in the constructor.

End of the note.

For information about the methods available in the class, you can use the Class Builder.