Identify changed data on screen in Web dynpro ABAP
AT times we require to check whether the editable fields are actually changed in value by the user or not.AS we all know that the values in the web dynpro component are stored in the context via nodes and attributes, there is a way to acheive this without much of coding. This documents gives the step by step procedure for the same.
The component here has a node which in turn has an attribute associated with it.
The purpose of this attribute is to bind it with an input field, now we will create the layout after creating this node in the context.
The layout of view is as below
On the click of this button we will be checking whether user has entered something in the input field or not, this can be modified as a “SAVE” button on screen wherein we can now check whether user has actually entered something or not or user has actually entered a new value here or not.
For this We will Enable the context change log in the WDDOINIT of component controller, please note that since the node was created in the component controller we write the code in WDDOINIT of the component controller, in case this was declared in view the below code has to be written in WDDOINIT of the view
create a method in component controller , here its named as “GET_CHANGE_LOG” and code as below. this method will be called from the view.
The table IT_LIST will have values when the field is changed from the previous value else that would be “INITIAL”.
Below are the test results:
Execute the application and press the button without entering any value
The internal table IT_LIST would be having no enteries.
Now enter some value in the input field and press the button
This time the internal table would have an entry as the context value was changed from previous held blank value
Hope you found this information usefull.
Thanks and Regards,
“Keep learning n stay young”