Message Handling in Web Dynpro
( Assistance Class )
Step 1 : Go to SE80 and create a web dynpro component ‘ZWD_MSG_HANDLE’
1.a) Select ‘YES’
1.b) Provide description and Press ‘Enter’
1.c) Provide name package name and save it
Step 2 : Creating Assistance Class.
2.a) Double click on component name
2.b) Ensure Editing mode (Ctrl + F1)
2.c) Provide an assistance class name starts with ‘Z’ and double click on it
2.d) Select ‘Yes’
2.e) Provide Package name
The following screen will appear
2.f) Slect menu path Goto->Text Elements
2.g) Provide message texts, save(Ctrl + S) , activate(Ctrl+F3) and Go back(F3).
Step 3 : Double click on main view to create context attribute and to design layout
3.a) Right Click the context to create an attribute
3.b) Provide attribute name and data type
3.c) Goto ‘Layout’ tab
Creating Label ‘Name’
Creating Input Field
Binding the context attribute value ‘NAME’ to input field
Creating Push button and creating event ‘Validate’
Step 4 : Goto ‘Method’ tab and double click on method ‘ONACTIONVALIDATE’
4.a) Select Code Wizard(Ctrl + F7)
Read the value of the context attribute ‘NAME’
The variable ‘lv_name’ holds the input value
Declare a variable named ‘msg’ which will hold message texts
Using code wizard(Ctrl + F7), Select radio button ‘Generate Message’ and choose a method ‘REPORT_ERROR_MESSAGE’ from the F4 help and press Enter
Delete the below selected lines
When user does not enter input value, Using instance object wd_assist, assign the error message text to variable ‘msg’ and call the method 'report_message_error', Otherwise assign success message text to variable ‘msg’ and call the method 'report_success'.
Activate the whole web dynpro component.
Step 5 : Create web dynpro application, enter description and save it
Right click on created application and choose ‘test’
OUTPUT :
When input field is empty
When input value is provided
By
R.Karthick,
Kaavian Systems.