, , ,

How to use Oracle Message Dictionary in Oracle Apps – FND MESSAGES?

How to use Oracle Message Dictionary in Oracle Apps – FND MESSAGES?

Oracle Message Dictionary provides flexibility to store pre-formatted text as part of its catalog to display them as error/warning/note messages in Forms, Log Files, OAF Pages, Reports, etc.,

These messages mainly provide information about business rule errors, such as missing or incorrect data, and how to resolve them, warn about the consequences of intended actions, inform about the status of an application, pages, or business objects, and indicate that processes and actions are performing or are completed.

Advantages of Message Dictionary:

  1. Change or translate the message text to different languages without regenerating or recompiling the code.
  2. It provides consistent look and feel of the message text, since it is pre-formatted.

Steps to Create a Message from Oracle Forms:

Navigate to Application Developer responsibility –> Application –> Messages

Create a Message from Oracle Forms

Steps to Create a Message from OAF Page:

Navigate to Functional Administrator responsibility –> Core Services –> Messages

Create a Message from OAF Page

Purpose of different fields on Messages form

COMPONENT NAME DESCRIPTION
Name Every message must have a unique name. You should include a unique prefix that makes it easier to find your custom messages and that helps to avoid name conflicts with non-custom messages.
Language Select the language that your message is written in.
Application Select the application that the message belongs, this will usually be the custom application.
Current Message Text Message text is required. This is a brief statement of the operation attempted and the problem that occurred as a result, or information that the user needs to know. The maximum field size for messages stored in the Message Dictionary is 240 characters.
Number A unique and persistent message number can be included with each message. When displayed, the number takes the format of (Application ShortnameNumber). If the message does not have a message number, the formatted number is not displayed.
Type The message type indicates which message components are applicable, determines whether implicit logging and incident creation occurs, and determines the logging level if the message is logged.
Maximum Length Maximum number of display characters the translators can use to translate the message.
Description Description of the Message.
Alert Category This will allow user interfaces and other programs to filter exception messages based on category. The types are Product, System, Security and User.
Alert Severity This will allow user interfaces and other programs to filter exception messages based on severity. The types can be: Critical, Error or Warning.
Log Severity This group indicates the Log severity levels like: Unexpected, Error, Exception, Event, Procedure, Statement or Off.

How to use Message Dictionary in PL/SQL Procedures

Oracle has provided FND_MESSAGE API to Set, Retrieve, Clear the messages in Message Stack.

Below is a small example to get the message text:

DECLARE
  msg VARCHAR2(2000);
BEGIN
  fnd_message.set_name ('FND', 'XX_TEST_ORACLE_ERP_APPS_GUIDE');
  msg := fnd_message.get;
  dbms_output.put_line(msg);
END;
/

where ‘FND’ is the application short name in which the message is defined and ‘XX_TEST_ORACLE_ERP_APPS_GUIDE’ the name of the message.

FND_MESSAGE.SET_NAME : this Sets a message name in the global area without actually retrieving the message from Message Dictionary.

FND_MESSAGE.GET : Retrieves a translated and token-substituted message from the message stack and then clears that message from the message stack. GET returns up to 2000 bytes of message.

Learn More about FND Message Functions, Click Here

Tokens to change Message content dynamically

Tokens are identified in the message text by their use of ampersand (&) or curly brackets ({}) and all uppercase letters. The token values are supplied at run time by the code that raises the message. For example, the following token &USER is replaced by a user name when the user receives this message on their screen:

New User Creation

DECLARE
  l_user_name VARCHAR2(200);
  msg         VARCHAR2(2000);
BEGIN
  --
  SELECT user_name
  INTO l_user_name
  FROM fnd_user
  WHERE user_id = '84857';
  --
  fnd_message.set_name ('FND', 'XX_TEST_CREATE_USER');
  fnd_message.set_token('USER', l_user_name);
  msg := fnd_message.get;
  dbms_output.put_line(msg);
END;
/

Using Fnd Message on OAF page

Below line can be used to show FND_MESSAGE from oaf page  which is created using Application Developer responsibility.
import oracle.apps.fnd.common.MessageToken;
public class xxcusHelloWorldMainCO extends HelloWorldMainCO {
 
    public void processFormRequest(OAPageContext pageContext,
                                   OAWebBean webBean) {
 
     if (pageContext.getParameter("Go") != null) {
String getUserName = String.valueOf(pageContext.getUserName());
     MessageToken[] msgtoken = {new MessageToken("USER",getUserName) };
throw new OAException("FND", "XX_TEST_CREATE_USER", msgtoken, OAException.ERROR, null);
    }
}
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply