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().
Check the below screenshot to check how I used the above code.