OracleAppsDNA

How to use Oracle Message Dictionary – 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.,

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


Steps to Create a Message from OAF Page:

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

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 ('XX', 'XX_TEST_MESSGAE_OADNA');
  msg := fnd_message.get;
  dbms_output.put_line(msg);
END;
/

where ‘XX’ is the application short name in which the message is defined and ‘XX_TEST_MESSGAE_OADNA’ 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.

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 runtime by the code that raises the message. For example, the following token &USR_NAME is replaced by a user name when the user receives this message on their screen:

DECLARE
  l_user_name VARCHAR2(200);
  msg         VARCHAR2(2000);
BEGIN
  --
  SELECT description
  INTO l_user_name
  FROM fnd_user
  WHERE user_name = 'STHALLAM';
  --
  fnd_message.set_name ('XX', 'XX_USER_GREETINGS');
  fnd_message.set_token('USR_NAME', l_user_name);
  msg := fnd_message.get;
  dbms_output.put_line(msg);
END;
/
Exit mobile version