You can manage the pending state.
cancelPending cancels pending changes for a particular instance or instances (via cancelPendingObjects from the database class). However, if submitPending has already been invoked, only the pending state and original state (for update) are removed. The operation replay record generated by the submitPending remains. This means that the operation replay record is uploaded to SAP Mobile Server upon synchronization. If the EIS honors the operation replay, the changes are propagated back to the device during the download. The Object API framework forgoes operation replay completion processing when it finds that there are no pending/original states for the instance. Hence, cancelPending is not the inverse operation of submitPending.
Customer customer = Customer.findById(101); if (errorHappened) { customer.cancelPending(); } else { customer.submitPending(); }
// load the customer MBO with customer ID 100 Customer customer = Customer.findByPrimaryKey(100); // Change phone number of that customer customer.setPhone("8005551212"); // use one transaction to do save and submitPending com.sybase.persistence.LocalTransaction tx = SMP101DB.beginTransaction(); try { customer.save(); customer.submitPending(); tx.commit(); } catch (Exception e) { tx.rollback(); }