If you are getting the above error message while trying to Query a Region in OAF. Add the below simple code in the Controller of the Region/Page after you call the AMMethod.
OAF Error Message:
"The search cannot be executed because the table has pending changes that would be lost"
OAAdvancedTableBean table = (OAAdvancedTableBean) webBean.findChildRecursive ("CustomersAdvTable");
// When handling a user initiated search, we always need to execute
// the query so we pass "false" to queryData().
table.queryData(pageContext, false);
Check the below screenshot to check how I used the above code.
http://jneelmani.blogspot.com/2009/11/oaf-search-cannot-be-executed-because.html