How to handle messages? SAP ABAP Web Dynpro

The messages that we display in Web Dynpro applications can be created in many ways.For example,we can create messages:

  • As dynamic texts stored in the text pool of the assistance class
  • As texts from database table T100

Itis not recommendable to enter specific language text in coding.

Dynamic Texts Stored in the Text Pool of the Assistance Class

One of the most important functions of the ssistance classes is the management of the dynamic texts.
In the Web Dynpro ABAP'the CL_WD_COMPONENT_ASSISTANCE class provides central functions through which a WD component can access text symbols of the assistance class.

We create a WD component,a registration form for a user.

WD component structure

The user has to fill a registration form with two mandatory fields:name and date of birth.If the user fills the form with the requested data,we show an information message to inform him that the data are saved.If the user doesn’t fill a mandatory field,we show an error message.The layout and the context node are presented.

To be able to work with dynamic texts stored in the text pool of the assistance class,we have to firstly create an assistance class. We can use class builder, Transaction SE24 ,to create a usual ABAP class.An Assistance class is ausual ABAP class that inherits from the super-class CL_WD_COMPONENT_ASSISTANCE.This super-class provides to our YCL_ASSISTANCECLASS class two additional methods.

The Layout and the context node

Creation of an assistance class

To maintain text symbols in the assistance class,we choose from the Assistance Class Maintenance menu Goto->Text Elements .Each new text symbol has an identification symbol(a three-digit ID)and a corresponding text.

Text symbols

To be able to have access to the text symbols of the assistance class by using the instance attribute WD_ASSIST,we have to assign the assistance class to our component.For each Web Dynpro component,we can create only a uniquely assigned assistance class.

Assistance class assigned to a WD component

When the user presses the REGISTRATION button,the Framework triggers the event handler method onactionregistration.

Coding of event handler method

To have access to the text symbols of the assistance class,we have to create a local variable of STRING type(text_success TYPE string).At runtime,when the method if_wd_component_assistance


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

SAP ABAP Web Dynpro Topics