We can display an exception as a message in a dialog page using the APIs in the oracle.apps.fnd.framework.webui.OADialogPage class and OAPageContext interface. The OADialogPage class holds properties for the generic dialog page.
Consider below example, where on clicking on 'Save' button after making changes on the page, it navigates to a dialog page.
This is just like asking for confirmation before saving.
Depending upon user's action (Yes or No) on dialog page, we can commit or rollback the transaction.
Below is sample code for implementing this functionality:
// in processFormRequest() method:
// On clicking save button, we create a dialog page and redirect there.
if (pageContext.getParameter("saveBtn") != null) {
OAException descMesg =
new OAException("FND", "FND_CUSTM_SAVE_CHANGES");
OAException instrMesg =
new OAException("FND", "FND_CUSTM_SAVE_CHANGES");
OADialogPage dialogPage =
new OADialogPage(OAException.WARNING, descMesg, instrMesg, "",
"");
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
// here we are setting names of buttons of dialog page
dialogPage.setOkButtonItemName("SaveYes");
dialogPage.setNoButtonItemName("SaveNo");
pageContext.redirectToDialogPage(dialogPage);
}
// if user clicks Yes button, we are committing
// records and show confirmation message
else if (pageContext.getParameter("SaveYes") != null) {
am.invokeMethod("saveRecords");
throw new OAException("Data has been saved successfully.",
OAException.CONFIRMATION);
}
// if user clicks No button, we undo the changes
// i.e. rollback the transaction
else if (pageContext.getParameter("SaveNo") != null) {
am.invokeMethod("undoChanges");
}
// In AMImpl.java:
// these are method for committing and rollbacking the transactions:
public void saveRecords() {
getOADBTransaction().commit();
}
public void undoChanges() {
getOADBTransaction().rollback();
}

