Skip to Content
Author's profile photo shitanshu sahai

Identify changed data on screen in Web dynpro ABAP

Hi,

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.

Capture1.PNG

The layout of view is as below

Capture5.PNG

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

Capture2.PNG

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.

Capture3.PNG

Capture4.PNG

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

Capture7.PNG

The internal table IT_LIST would be having no enteries.

Capture6.PNG

Now enter some value in the input field and press the button

Capture9.PNG

This time the internal table would have an entry as the context value was changed from previous held blank value

Capture8.PNG

Hope you found this information usefull.

Thanks and Regards,

Shitanshu Sahai

“Keep learning n stay young”

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.