Calling messages: Following standard procedure can be called to show predefined oracle applications message through forms or concurrent programs.

FND_MESSAGE.CLEAR – Clears the message stack of all the messages.

FND_MESSAGE.DEBUG – Immediately displays the string passed to it as input parameter.

FND_MESSAGE.ERASE – Clears the oracle Forms status line.

FND_MESSAGE.ERROR – Displays an error message in an Oracle Forms modal window or a concurrent program log file. (Example: “Invalid value entered.”). It takes its message from the stack, displays the message, and then clears all the messages from the message stack.

FND_MESSAGE.GET – Retrieves a translated and token–substituted message from the message stack and then clears that message from the message stack. This could be used for getting a translated message for a forms built–in or other function. Assumes you have already called FND_MESSAGE.SET_NAME and, if necessary,
FND_MESSAGE.SET_TOKEN. It returns up to 2000 bytes of message.

FND_MESSAGE.HINT – Displays a message in the Oracle Forms status line. It takes its message from the stack, displays the message, and then clears that message from the message stack. The user may still need to acknowledge the message if another message immediately comes onto the message line.

FND_MESSAGE.QUESTION – Displays a message and up to three buttons in an Oracle Forms modal window. (Example: “Please choose one of the following actions: ”) It takes its message from the stack, and clears that message. After the user selects a button, It returns the number of the button selected.
For each button, you must define or use an existing message in Message Dictionary (under the Oracle Application Object Library application) that contains the text of the button. This routine looks for your button name message in the Oracle Application Object Library messages, so when you define your message, you must associate it with Oracle Application Object Library (the “FND” application) instead of your application.

FND_MESSAGE.RETRIEVE – Retrieves a message from the database server, translates and substitutes tokens, and sets the message on the message stack.

FND_MESSAGE.SET_NAME – Retrieves your message from Message Dictionary and sets it on the message stack. You call it once for each message you use in your client–side PL/SQL procedure. You must call this procedure before you call FND_MESSAGE.SET_TOKEN.

FND_MESSAGE.SET_STRING – Takes an input string and sets it directly on the message stack. The string does not need to be defined in the Messages window. These strings may be hard coded into the form and are not translated like messages defined in Message Dictionary.

FND_MESSAGE.SET_TOKEN – Substitutes a message token with a value you specify. You call FND_MESSAGE.SET_TOKEN once for each token/value pair in a message. The optional translate parameter can be set to TRUE to indicate that the value should be translated before substitution. (The value should be translated if it is, itself, a Message Dictionary message name.)

FND_MESSAGE.SHOW – Displays an informational message in an Oracle Forms modal window or a concurrent program log file. (Example: “To complete this function, please enter the following… ”). It takes its message from the stack, displays the message, and then clears only that message from the message stack.

FND_MESSAGE.WARN – Displays a warning message in an Oracle 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?”) FND_MESSAGE.WARN returns TRUE if the user accepts the message (that is, clicks OK), or FALSE if the user cancels. It takes its message from the stack, displays the message, and clears that message from the message stack.
Most frequently used procedures are FND_MESSAGE.SET_NAME and FND_MESSAGE.SET_TOKEN

Example
/*Here FND_MESSAGE.SET_NAME is used to retrieve the message and put it on the message stack. Message name is ‘WANT TO CONTINUE’.*/

FND_MESSAGE.SET_NAME (’FND’, ‘WANT TO CONTINUE);

/*Next FND_MESSAGE.SET_TOKEN is used to replace the token ‘PROCEDURE’ with text ‘Compiling this flexfield’.

FND_MESSAGE.SET_TOKEN (’PROCEDURE’, ’Compiling this flexfield’);

IF FND_MESSAGE.WARN THEN
/* User want to continue */

ELSE
/* User want to cancel*/

END;

Requirement: From OAF page i have to call a custom procedure for some activity.

Solution:
Create a button through OAF personalization like below. Concurrent program name is XXPRCTEST. I register this under Application Developer.

ID: TestBtn
Prompt: Submit Report
OA.jsp?akRegionCode=FNDCPPROGRAMPAGE&akRegionApplicationId=0&programApplName=FND&programRegion=Hide&scheduleRegion=Hide¬ifyRegion=Hide&printRegion=Hide&&programName=XXPRCTEST
Target Frame: _blank

This will open a new submit window.