Start of Content Area

Background documentation Working with the Assistance Class  Locate the document in its SAP Library 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 

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 provide the assistance class instance of the main component and of the component being used. To do this, when you create the instance of the used component you have to specify the reference to the active instance of the assistance class of the main component as the value for the parameter ASSISTANCE_CLASS (that is, the reference variable wd_assist). In the SWPD_DEMO collection in your system you can find the Web Dynpro DEMO_COMMON_ASSISTANCE1 application in which you can perform the implementation in the WDDOINIT method of the component controller of the DEMO_COMMON_ASSISTANCE1 main component.

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 _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: data: my_text type string.

 

   my_text = WD_ASSIST->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( KEY = '001' ).

  

..

endmethod.

 

Caution 

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

Text symbols in the assistance class can be maintained from any controller. To do this, choose Goto Text Symbols.

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 must not have any required parameters in the constructor.

 

 

End of Content Area