FND Messages In Oracle HRMS
Here i am Explaining how to create Fnd Messages via E-Business suite and the implementation of message retrieval via the pl/sql API package provided with Oracle Applications.
Creating an Oracle E-Business Suite Message
To create a message in the E-Business suite message library you will need the “Application Developer” responsibility.
Navigate to Application Developer > Application > Messages. This will launch a form
Enter a unique name for your message
Eg: XX_CUSTOMER_MSG
Select the language that your message is written in and the application that the message belongs
Enter the message text in the “Current Message Text” box.
Eg: This is my first message
Click the save icon.
Retrieving a message using PL/SQL:
In order to retrieve the message from the database we need to use a standard API’s in the FND_MESSAGE package.
An E-Business suite message should be retrieved as follows:
1. Clear the current session of any message variables that may already be set
2. Tell E-Business suite which message you wish to retrieve
3. Retrieve the actual message string
4. Clear the session (Optional)
Below is the PL/SQL Block to retrive the message
DECLARE
my_message VARCHAR2(100);
BEGIN
–Initialize Apps Session
fnd_global.apps_initialize( user_id => 1234
,resp_id => 1235
,resp_appl_id => 1236
);
/*–Note: You will get the uer_id, resp_id and Resp_appl_id using below Query
select fnd.user_id ,
fresp.responsibility_id,
fresp.application_id
from fnd_user fnd,
fnd_responsibility_tl fresp
where fnd.user_name = ‘OEAG’
and fresp.responsibility_name = ‘Custom HRMS
*/
–Clear the existing session
FND_MESSAGE.CLEAR;
–Tell e business suite which message you want (custom application short name/message name)
FND_MESSAGE.SET_NAME(‘XXERP’,’XX_CUSTOMER_MSG’);
–Retrieve the message
my_message := FND_MESSAGE.GET;
–Output the message
DBMS_OUTPUT.PUT_LINE(my_message);
END;
Output for the Above Block Is : This is my first message
Using Tokens in the message:
The Oracle E-Business suite allows the substitution of tokens within a message string to enable the programmer to add dynamic content to the message at run time.
Open the E-Business Suite message create a New Message
Navigate to Application Developer > Application > Messages. This will launch a form
Enter a unique name for your message
Eg: XX_UNAME_TOKEN_MSG
Select the language that your message is written in and the application that the message belongs
Enter the message text in the “Current Message Text” box.
Eg: This is my second message and the Token User name is &USERNAME
Click the save icon.
Note: In order to insert a token into a message it is necessary to prefix the token with a ampersand e.g. &USERNAME
Retrieving message With Token Substitution
Here USERNAME is called as TOKEN, we will Add the value dynamically
Example Block is below:
DECLARE
my_message VARCHAR2(100);
BEGIN
–Initialize Apps Session
fnd_global.apps_initialize( user_id => 1234
,resp_id => 1235
,resp_appl_id => 1236
);
/*–Note: You will get the uer_id, resp_id and Resp_appl_id using below Query
select fnd.user_id ,
fresp.responsibility_id,
fresp.application_id
from fnd_user fnd,
fnd_responsibility_tl fresp
where fnd.user_name = ‘OEAG’
and fresp.responsibility_name = ‘Custom HRMS Responsibility’;
*/
–Clear the existing session
FND_MESSAGE.CLEAR;
–Tell e business suite which message you want (Application short name/message name)
FND_MESSAGE.SET_NAME(‘
–Set the username message token with the current applications user
FND_MESSAGE.SET_TOKEN(‘USERNAME’,FND_GLOBAL.USER_NAME);
–Retrieve the message
my_message := FND_MESSAGE.GET;
–Output the message
DBMS_OUTPUT.PUT_LINE(my_message);
END;
Out put for above block is :
Downloading and Uploading Messages using the Generic Loader
To download our example message we would use the following command at the Unix prompt on the mid-tier:
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_UNAME_TOKEN_MSG.ldt
FND_NEW_MESSAGES APPLICATION_SHORT_NAME=’PER’ MESSAGE_NAME=”XX_UNAME_TOKEN_MSG”
To Upload our example message we would use the following command at the Unix prompt on the mid-tier:
FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_UNAME_TOKEN_MSG.ldt
Leave a Reply
Want to join the discussion?Feel free to contribute!