cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting changes in the context

Former Member
0 Kudos
77

hi,

I have a form to update the personal data.The existing data is fetched by using a RFC.Now My requirement is as follows:

The UI elements are bound to the view context elements wihich are populated by the model.

Now I need to call the update RFC ONLY IF the user has made any changes to ANY of the data in the screen.

Is there a way to know if the data in the screen is changed?

thanx,

Bhupesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try the following ways: get current Element based on the node(which is bound to view). In the Element has one method 'isChanged()', which return boolean. Based on that you can findout the chnage.

This might solve your problem.

Kind Regards,

S.Saravanan.

Former Member
0 Kudos

Thanx for ur answers.

Saravan,

isChangedByClient() seems to be more appropriate to detect any changes made by the user.

thanx,

Bhupesh

Former Member
0 Kudos

Hi,

I think it's better to determine this from the model object itself, rather than the node.

ARFC model objects generated from BAPIs an be typecasted to <i>ICMIModificationCount</i>.

So you will need to check the <i>modCount()</i> for every model object as soon as the view is loaded. Save this count somewhere. This should be much better than iterating through all your node elements and checking if they have been modified.

Now when you want to find out if the view has been changes or not, check the saved value with the current <i>modcount</i>. If they are not equal, then there has been a modification.

Regards,

Satyajit.

Former Member
0 Kudos

Satyajit,

My condolences -- as it recently happens on WD forum, the most correct (simple and working) answer is not rewarded at all

VS

Former Member
0 Kudos

Thanx Satyajit for giving me a different solution.I tried it out .My requirement is a bit different though.I need to check for the nodes separately as I need to fire separate RFCs for updating different node data.

Thanx much anyway,

Bhupesh

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

You can check the Element by check

wdContext.current<node>Element().isChanged();

Kind Regards

Mukesh

former_member215843
Active Participant
0 Kudos

Hi,

with Web Dynpro ABAP there is a concept for detecting changes the user has made. Please refer to the dodumentation or have a look at the example component DEMO_CONTEXT_CHANGES.

Regina

Former Member
0 Kudos

HI,

You have to check the old value with the new value for detecting

Regards

Saravanan K