Vous êtes sur la page 1sur 7

Message Dictionary :

Message Dictionary lets you catalog messages for display from your application
without hardcoding them into your forms and programs.

Using Message Dictionary,


you can:
Define standard messages you can use in all your applications

Message Dictionary reduces redundant programming of standard messages by storing all of your
messages as entries in Message Dictionary. Once you define your messages in the Message
Dictionary, you can refer to them in your forms, concurrent programs, and other application
modules using a simple message name you define.

If you need to change your message, you only need to change it in one place.

Provide a consistent look and feel for messages within and across all your
applications
Define flexible messages that can include context-sensitive variable text
Change or translate the text of your messages without regenerating or recompiling
your application code

Message Name
A non-updatable internal identifier for a message in your application.
A message name, together with your application
name and language name, uniquely identifies your message text. You specify the
message name when you call Message Dictionary from a form or program module.

Message
Text your application displays or prints to an output file. (1800 characters)

Message Number
A number that appears with your message.

Variable Token
A keyword you create to represent a value when you define a message. You specify the
same variable token, along with its current value, when you call Message Dictionary
from your form or program module. Message Dictionary replaces each variable token in
your message with the current value you specify and then displays the message.

Implementing Message Dictionary


1. Create your message directories
2. Define your messages
3. Create your message files
4. Code logic to set up messages
5. Code logic to display messages
Create Your Message Directories
You must create your message directory 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

Define Your Messages


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.
Create Your Message Files
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:
1. Using the Application Developer responsibility, navigate to the Submit Requests
window.
2. Select the Generate Messages concurrent program in the Name field.
3. In the Parameters window, select the language code for the language file you want
to generate (for example, US for American English).
4. Provide the appropriate application name for the message file you wish to create.
Each application must have its own message file.
5. Select the mode for the program. To generate your runtime message file, choose
DB_TO_RUNTIME.
6. 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).
7. 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.

Code Logic to Set Up Messages


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).

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.

Client-side APIs for Retrieving and Setting up Messages

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.

Server-side APIs for Messaging


The following server-side routines are used to buffer a message so that a client-side PL/SQL
Procedure 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.

Code Logic to Display Messages


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).

Forms Server-side APIs for Displaying Messages


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.
ERROR
Displays an error message in a forms modal window or aconcurrent 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 formsmodal window. (Example: "Please choose
one of the following actions.")
HINT
Displays a message in the forms status line.
ERASE
Clears the forms status line.

Methods for Database Server-side Messaging


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.

Method 1: Set an error message on the server, to be displayed by the forms client that called the
server procedure.
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.
Important: 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.

Method 2: Set a message on the server, to be retrieved on the client side.


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.

Method 3: Get a message into a buffer on the server


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.

Message Dictionary APIs for PL/SQL Procedures


FND_MESSAGE.CLEAR
Summary procedure FND_MESSAGE.CLEAR;
Location FNDSQF library and database (stored procedure)
Description Clears the message stack of all messages.

FND_MESSAGE.DEBUG
Summary procedure FND_MESSAGE.DEBUG (value IN varchar2);
Location FNDSQF library
Description Immediately show a string. This procedure is normally used to show debugging
messages only, The string does not need to be defined in the Messages window.
( hardcoded into the form)

FND_MESSAGE.ERASE
Summary procedure FND_MESSAGE.ERASE;
Location FNDSQF library
Description Clears the Oracle Forms status line.

FND_MESSAGE.ERROR
Summary procedure FND_MESSAGE.ERROR;
Location FNDSQF library
Description Displays an error message in an Oracle Forms modal window or a concurrent
program log file.

FND_MESSAGE.GET
Summary function FND_MESSAGE.GET return varchar2;
Location FNDSQF library and database (stored function)
Description Retrieves a translated and token-substituted message from the message stack and
then clears that message from the message stack.

FND_MESSAGE.HINT
Summary procedure FND_MESSAGE.HINT;
Location FNDSQF library
Description Displays a message in the Oracle Forms status line.

FND_MESSAGE.QUESTION
Summary (button1 IN varchar2 default 'YES', button2 IN varchar2 default 'NO',
button3 IN varchar2 default 'CANCEL', default_btn IN number default 1,
cancel_btn IN number default 3, icon IN varchar2 default 'question' ) return
number;
Location FNDSQF library
Description Displays a message and up to three buttons in an Oracle Forms modal window.

FND_MESSAGE.RETRIEVE
Summary procedure FND_MESSAGE.RETRIEVE;
Location FNDSQF library
Description Retrieves a message from the database server, translates and substitutes tokens,
and sets the message on the message stack.

FND_MESSAGE.SET_NAME
Summary (application IN varchar2,
name IN varchar2);
Location FNDSQF library and database (stored procedure)
Description (Forms) Retrieves your message from Message Dictionary and sets it on the message
stack.

FND_MESSAGE.SET_STRING
Summary procedure FND_MESSAGE.SET_STRING
(value IN varchar2);
Location FNDSQF library
Description Takes an input string and sets it directly on the message stack.

FND_MESSAGE.SET_TOKEN
Summary procedure FND_MESSAGE.SET_TOKEN (token IN varchar2, value IN
varchar2, translate IN boolean default FALSE);
Location FNDSQF library and database (stored function)
Description (Forms) Substitutes a message token with a value you specify.
token - Specify the name of the token you want to substitute. This token name is
identical to the token name you use when you define your message using the
Messages form.
FND_MESSAGE.SET_NAME ('FND', 'WANT_TO_CONTINUE');
FND_MESSAGE.SET_TOKEN ('PROCEDURE', 'Compiling this flexfield');

FND_MESSAGE.SHOW
Summary procedure FND_MESSAGE.SHOW;
Location FNDSQF library
Description Displays an informational message in an Oracle Forms modal window or a
concurrent program log file.

FND_MESSAGE.WARN
Summary function FND_MESSAGE.WARN return boolean;
Location FNDSQF library
Description Displays a warning message in an Oracle Forms modal window and allows the
user to either accept or cancel the current operation.

Application Message Standards


Oracle Applications use messages to communicate with users. Typical messages include
warnings and error messages, brief instructions, and informative messages that advise
your user about the progress of concurrent requests, work done, and anything else of
interest or helpful to users. Forms-based applications display messages on the user's
screen; applications also print messages to output and log files.
Message Naming Standards
Message names are hardcoded into forms and programs and should never change.
Use descriptive words and make your message names meaningful
Message names can contain no more than 30 characters.
Make message names all uppercase. (Message names are not case sensitive,)
Do not use spaces in message names; use underscore characters instead to separate words.

Message Numbering Standards


Use a number for all errors and warnings, but not hints, notes or questions.

Vous aimerez peut-être aussi