cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance Class

Former Member
0 Kudos

Hi Experts,

In my web dynpro application, for messages i want to use assistance class for messages, so i dont need to instantitate for every message. Is there any way I can get the class for messages which I can use as assistance class.

Thanks,

Edited by: Abap WD on Oct 20, 2008 9:29 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
uday_gubbala2
Active Contributor
0 Kudos

Hi,

Instead of using texts defined in the OTR, it is possible to define the texts as text elements in an ABAP class. To access the text element values, a public method of the class can be used. A class offering methods to read the text elements is already available in each SAP NetWeaver AS 7.0, having the name

CL_WD_COMPONENT_ASSISTANCE. Each class inheriting from this parent class will have the method get_text( ). Passing the identifier of the text symbol to the method will return the text in the language sy-langu. To use this class in a Web Dynpro component, it has to be instantiated in each controller. However, an easier and more consistent way is to let the Web Dynpro runtime create the instance only once. This is done by writing the class name in the Assistance Class field, which can be found on the Properties tab for the Web Dynpro component. The steps involved are:

1) Edit the Web Dynprpo component. Navigate to the Properties tab of the component.

2) Enter a class name in the Assistance Class field.

3) Double-click the class name. If the class does not exist, it will be created. The class will be derived from the parent class CL_WD_COMPONENT_ASSISTANCE.

Text symbols can be added to the class by choosing Gotou2192Text Symbols.

Once you have assigned the assistance class to the component, an attribute, WD_ASSIST, is added to the attribute list of each controller. This attribute is set by the Web Dynpro runtime to the assistance class instance. Using WD_ASSIST, a text can be accessed as follows:

Using the text element identifier CAR:

DATA: lv_text TYPE string.
lv_text = wd_assist->if_wd_component_assistance~get_text( key = 'CAR' ).

Using a constant CARRID, having the text element identifier CAR as its value:

DATA: lv_text TYPE string.
lv_text = wd_assist->if_wd_component_assistance~get_text( key = wd_assist->carrid ).

Regards,

Uday