In this article we’ll represent how to using fnd message in oaf page to leveraging Oracle Message Dictionary to display an exception in Oracle Apps oaf pages. let’s get started.
First of all FND MESSAGES : Oracle Message Dictionary provides flexibility to store string messages as part of its catalog to display them in Forms, Log Files, OAF Pages, Reports, etc.
By using the messages in the Message Dictionary, you can define standard messages that you can use in all your applications, provide consistency for messages within and across all your applications, define flexible messages, and change or translate the text of your messages without regenerating or recompiling your application code.
There is a different types of oracle message dictionary (FND_MESSAGES) like (Error Messages, Warning Messages, Information Messages, UI String Messages).
Now let’s put some code to use FND_MESSAGE inside oaf pages:
import oracle.apps.fnd.common.MessageToken;
public class xxHelloWorldMainCO extends HelloWorldMainCO {
public void processFormRequest(OAPageContext pageContext,
OAWebBean webBean) {
if (pageContext.getParameter("Go") != null) {
String getEmpName = String.valueOf(pageContext.getEmpName());
MessageToken[] msgtoken = {new MessageToken("EMP",getEmpName) };
// This code to display message using token
throw new OAException("FND", "XX_CREATE_EMPLOYEE", msgtoken,
OAException.INFORMATION, null);
// This code to display message without token
throw new OAException("FND", "XX_CREATE_EMPLOYEE", null,
OAException.ERROR, null);
}
}
Note: Token is basically some variable to use inside your message to displayed dynamically at run time.
Hope this help.