How to Create DBC file in oracle apps R12 EBS?

The .dbc file is mostly used to define database parameters,stands for database connect descriptor file, used to connect-to database, it authenticate users against database in FND_USER table.

DBC file is quite important as whenever Java or any other program like forms want to connect to database it uses dbc file.

For OAF page development, we need to get the DBC file of development environment.

Method 1:

//Login as Application user
Navigate to $INST_TOP/admin/install directory and run adgendbc.sh script.

sh adgendbc.sh

Run the command adgendbc.sh, It will generate .dbc file under $INST_TOP/appl/fnd/12.0.0/secure

Method 2:

//Login as Application user

java oracle.apps.fnd.security.AdminAppServer apps/apps ADD FNDNAM=apps GWYUID=applsyspub/pub TWO_TASK= SECURE_PATH=$FND_TOP/secure GUEST_USER_PWD=guest/oracle APPS_JDBC_DRIVER_TYPE=THIN DB_HOST=vis.oracleerpappsguide.com DB_PORT=1521

Method 3: (Via Browser URL)

Below locations we can find in DBC files in system.
For 11i:

cd $FND_TOP/secure

For R12:

cd $FND_SECURE

In case, if we don’t have access to the server we can get it with other easy way.

Open a web browser and go to the homepage Application URL and append “/OA_HTML/jsp/fnd/aoljtest.jsp” to it like below.

http://vis.oracleerpappsguide.com:8000/OA_HTML/jsp/fnd/aoljtest.jsp

This will open the below page and enter the required details.

Enter DB Details

If all the details are correct entered you will get an overview page with all details, and at bottom of screen you will get a link “Enter AOL/J Setup Test”. click that link.

DB Instance Details

This will redirect you to page from where you can Locate DBC file under connection test from left side Menu list.

DBC File
On the right side you will get the contents of the DBC file. Copy/paste this to a VISION.dbc file and place it in your JDeveloper JDEV_USER_HOME/dbc_files/secure.

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

These messages mainly provide information about business rule errors, such as missing or incorrect data, and how to resolve them, warn about the consequences of intended actions, inform about the status of an application, pages, or business objects, and indicate that processes and actions are performing or are completed.

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

Create a Message from Oracle Forms

Steps to Create a Message from OAF Page:

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

Create a Message from OAF Page

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

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

Learn More about FND Message Functions, Click Here

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

New User Creation

DECLARE
  l_user_name VARCHAR2(200);
  msg         VARCHAR2(2000);
BEGIN
  --
  SELECT user_name
  INTO l_user_name
  FROM fnd_user
  WHERE user_id = '84857';
  --
  fnd_message.set_name ('FND', 'XX_TEST_CREATE_USER');
  fnd_message.set_token('USER', l_user_name);
  msg := fnd_message.get;
  dbms_output.put_line(msg);
END;
/

Using Fnd Message on OAF page

Below line can be used to show FND_MESSAGE from oaf page  which is created using Application Developer responsibility.
import oracle.apps.fnd.common.MessageToken;
public class xxcusHelloWorldMainCO extends HelloWorldMainCO {
 
    public void processFormRequest(OAPageContext pageContext,
                                   OAWebBean webBean) {
 
     if (pageContext.getParameter("Go") != null) {
String getUserName = String.valueOf(pageContext.getUserName());
     MessageToken[] msgtoken = {new MessageToken("USER",getUserName) };
throw new OAException("FND", "XX_TEST_CREATE_USER", msgtoken, OAException.ERROR, null);
    }
}