Wednesday, 28 September 2016

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.

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

The layout of view is as below

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

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.

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

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.

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

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

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

The internal table IT_LIST would be having no enteries.

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

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

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials

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

UI Web Dynpro ABAP, All SAP Modules, SAP Tutorials and Materials
SAP Online Guides, Tutorials, Materials and Certifications.

Related Posts

2 comments:

  1. 🔊 Curious about that mysterious clicking noise from your Android phone?
    📱 Don't worry, you're not alone! Discover the common causes and easy fixes in our in-depth guide

    ReplyDelete
  2. Discover the incredible advantages of the Bajaj Finance Credit Card in Hindi!
    🌟 Whether you're looking for cashback rewards, travel perks, or exclusive discounts, this card has it all. Click here bajaj finance card benefits in hindi bajaj finance credit card to learn more about the impressive benefits and make the most of your financial journey with Bajaj Finance today! 💳💰

    ReplyDelete