There are several steps to implementing Message Dictionary in your application:
On most operating systems, you should create a special subdirectory to hold your Message Dictionary files for your application. You must create your message directory (or some other location for your messages if your operating system does not support directories) before you define your messages so Oracle Application Object Library can store your message files. In general, name your subdirectory mesg, and create it directly under your application's base directory (exactly how you create a location for your Message Dictionary files depends on your operating system). You should have a mesg directory for your application on each machine where you have a directory structure for your application (concurrent processing servers, forms server machines).
See: Setting Up Your Application Framework
Use the Messages window to define your message information. You can include variable tokens in your message text when you define your messages. Message Dictionary inserts your values in the message automatically when it displays your message.
You can modify your messages at any time using the Messages window. If you want to change your message text, you need only change it once, instead of the many times your application may call it. You do not need to regenerate your forms or recompile your programs when you change your messages.
See: Message Standards and Messages Window.
Use the Generate Messages concurrent program to generate your runtime message files, such as US.msb.
To use the program to generate your message files:
Using the Application Developer responsibility, navigate to the Submit Requests window.
Select the Generate Messages concurrent program in the Name field.
In the Parameters window, select the language code for the language file you want to generate (for example, US for American English).
Provide the appropriate application name for the message file you wish to create. Each application must have its own message file.
Select the mode for the program. To generate your runtime message file, choose DB_TO_RUNTIME.
To generate human-readable text files that can be edited and loaded back into the database (or into different databases), you must use the FNDLOAD utility with the configuration file FNDMDMSG.lct.
For more information, see the Oracle Applications System Administrator's Guide.
Leave the Filename parameter blank, as the message generator will create a file with a standard name (such as US.msb) in the mesg directory for your application on the server side (or an equivalent location for your platform).
Make a copy of the resulting file (which is on the server side), and transfer the copy to the appropriate mesg directory for your application on other machines as needed (concurrent processing servers, forms server machines). The file should have the same name (such as US.msb) in each location.
On UNIX systems, you can also use a command line interface to generate your message files (such as US.msb):
FNDMDGEN <Oracle ID> 0 Y <language codename> <application shortname> DB_TO_RUNTIME
where Oracle ID is the username and password of the APPS schema and language codename is a language code such as US.
To generate human-readable text files that can be edited and loaded back into the database (or into different databases), you must use the FNDLOAD utility with the configuration file FNDMDMSG.lct.
Generating a message and showing it to a user is a two-step process: first you must set up the message (on the client side) or retrieve it from the server side, and then you must display it to the user (or write it to a file for a concurrent program). This section covers the setup part of the process.
When your application calls Message Dictionary, Message Dictionary finds the message associated with your application and the message name you specify, and replaces any variable tokens with your substitute text. If a concurrent process generates the message, depending on which routine it calls, Message Dictionary either writes the message to the concurrent program log or out file, or returns your message to your concurrent program so your program can write it to the log or out file. You can call Message Dictionary from any form or C concurrent program.
The following routines in the FND_MESSAGE package are used in client-side (that is, Oracle Forms) PL/SQL procedures to retrieve and set up messages for subsequent display.
| SET_NAME | Retrieves your message from Message Dictionary and sets it on the message stack. |
| SET_STRING | Takes an input string and sets it on the message stack. |
| SET_TOKEN | Substitutes a message token with a value you specify. |
| RETRIEVE | Retrieves a message from the server-side message buffer, translates and substitutes tokens, and sets the message on the message stack. |
| GET (function) | Retrieves a message from the message stack and returns a VARCHAR2. |
| CLEAR | Clears the message stack. |
The following server-side routines are used to buffer a message (and if necessary, token/value pairs) so that a client-side PL/SQL Procedure (that is, one called from Oracle Forms) can retrieve and display it. Only one message can be buffered on the server.
| SET_NAME | Sets a message name in the global area without actually retrieving the message from Message Dictionary. |
| SET_TOKEN | Adds a token/value pair to the global area without actually doing the substitution. |
| CLEAR | Clears the message stack. |
Once you have set up or retrieved the message and substituted any tokens, you can then display it to a user (on the forms server side; that is, in forms) or write it to a file (on the database server side for a concurrent program).
The following routines are used in PL/SQL procedures in forms and libraries to display messages. Each of these routines displays the message placed on the message stack by the most recent FND_MESSAGE.SET_NAME or FND_MESSAGE.RETRIEVE call in your program.
The FND_MESSAGE.ERROR, FND_MESSAGE.SHOW, FND_MESSAGE.WARN, and FND_MESSAGE.QUESTION routines each display a message in a forms modal window (on the client side). The primary difference between these routines is the icon they display next to the message in a forms modal window. For each routine, the icon is designed to convey a particular meaning. You should choose which routine to use based on the type of message you wish to display. For example, you should use the FND_MESSAGE.ERROR routine to display error messages, the FND_MESSAGE.SHOW routine to display informational messages, and so on.
Note that the look of the icons that the FND_MESSAGE.ERROR, FND_MESSAGE.SHOW, FND_MESSAGE.WARN, and FND_MESSAGE.QUESTION routines display is platform-dependent.
| ERROR | Displays an error message in a forms modal window or a concurrent program log file. (Example: "Invalid value entered.") |
| SHOW | Displays an informational message in a forms modal window or a concurrent program log file. (Example: "To complete this function, please enter the following... ") |
| WARN | Displays a warning message in a forms modal window and allows the user to either accept or cancel the current operation. (Example: "Do you wish to proceed with the current operation?") |
| QUESTION | Displays a message and up to three buttons in a forms modal window. (Example: "Please choose one of the following actions.") |
| HINT | Displays a message in the forms status line. |
| ERASE | Clears the forms status line. |
Database server-side PL/SQL currently has no I/O abilities by itself. Therefore, it relies on the environment that called the server-side routine to output the message.
There are three distinct, non-interchangeable methods for displaying messages that were set on the server:
On the server, use FND_MESSAGE.SET_NAME and FND_MESSAGE.SET_TOKEN to set the message. Then call APP_EXCEPTION.RAISE_EXCEPTION (an APPCORE routine) to raise the application error PL/SQL exception. This exception is trapped when the server procedure is exited and control resumes on the client side in the standard Oracle Forms ON_ERROR trigger. The ON-ERROR trigger retrieves the message from the server and displays it.
Attention: All forms built to integrate with Oracle Applications should have a form-level ON-ERROR trigger that calls APP_STANDARD.EVENT('ON-ERROR'). APP_STANDARD.EVENT('ON-ERROR') in the ON-ERROR trigger automatically detects application errors raised on the server and retrieves and displays those error messages in a forms alert box.
On the server, use FND_MESSAGE.SET_NAME and FND_MESSAGE.SET_TOKEN to set the message. Return a result code to the calling client code to indicate that a message is waiting. If there is a message waiting, the client calls FND_MESSAGE.RETRIEVE to pull the message from the server to the client, placing the message on the client's message stack. The client calls FND_MESSAGE.ERROR, FND_MESSAGE.SHOW, FND_MESSAGE.HINT, or FND_MESSAGE.WARN to display the message, or FND_MESSAGE.GET to retrieve the message to a buffer.
Use the FND_MESSAGE.SET_NAME, FND_MESSAGE.SET_TOKEN, and FND_MESSAGE.GET routines to get the message into a buffer. Or, use FND_MESSAGE.GET_STRING to get a single message into a string.
If you call Message Dictionary routines from your concurrent programs, the messages are treated differently according to the routine you use, as shown in the following table:
| Routine | Output Destination | Message Numbers | Messages Displayed |
|---|---|---|---|
| SHOW | out file | Not printed | One; top of stack |
| ERROR | log file | Printed if nonzero | One; top of stack |