on 08-19-2008 9:32 AM
Hi Brothers,
I am implementing a function that is supposed to put all changes made in a table into a node. I wrote the following code, which unfortunately provides only the changes I made since the last roundtrip (press of "Validate" Button that causes the function to be executed).
The reason is that the isChangedByClient flag seems to be reset between roundtrips...
Is there a way to avoid this, that is to keep the isChangedByClient set and thus remember all changes??
public void onActionValidateChangesCustomer(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionValidateChangesCustomer(ServerEvent)
// remove all elements from node
wdContext.nodeChangedCustomerRows().invalidate();
// iterate over all rows of customer table
for( int i=0; i < wdContext.nodeE_Customer().size(); i++ ){
// check weather a row has changed
IE_CustomerElement e = wdContext.nodeE_Customer().getE_CustomerElementAt(i);
if (e.isChangedByClient()){
// copy the changed row to the ChangedCustomerRow node
WDCopyService.copyCorresponding(wdContext.nodeE_Customer().getE_CustomerElementAt(i),
wdContext.currentChangedCustomerRowsElement());
wdContext.nodeChangedCustomerRows().addElement(new __Bic__Mrbkunde());
// move from current to new one
wdContext.nodeChangedCustomerRows().moveNext();
}
wdContext.nodeE_Customer().moveNext();
}
// trigger the RFC
wdThis.wdGetInfoObjectCustController().executeZ_Customer_Front_Controller();
// reset changed flag
//wdContext.wdGetAPI().resetChangedByClient();
//@@end
}
I appreciate helpfull posts.
Thanks, Johannes
Hi,
According to Javadoc its must be keep until a reset call:
"Returns true if the changedByClient has been set for this element. This flag will be set by the framework when an update from the client arrives. It remains true until you reset all flags in the complete context via IWDContext.resetChangedByClient().
Since this flag is kept per element, but each attribute may actually live in a different element, Web Dynpro always marks both the mapped element and the origin element marked if an attribute is changed. This has the consequence that IWDContext.resetChangedByClient() must always be called from the context in which you will look for client changes.
Returns:
true if the changedByClient has been set for this element or false otherwise."
Maybe you can try a workaround, trying to set the changed newly using the method change.
if (e.isChangedByClient()){
// copy the changed row to the ChangedCustomerRow node
WDCopyService.copyCorresponding(wdContext.nodeE_Customer().getE_CustomerElementAt(i),
wdContext.currentChangedCustomerRowsElement());
wdContext.nodeChangedCustomerRows().addElement(new __Bic__Mrbkunde());
// Here set the changed to whole element
e.changed(null);
// move from current to new one
wdContext.nodeChangedCustomerRows().moveNext();
}
Maybe you will need to combine isChangedByClient and isChange
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think it is a bug because javadoc says that a parameter null set all attribute as change.
But the important is that the problem was solved.
Best regargs
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.