Skip to content
Home / Apps / FND_FILE – create log and output file in Concurrent Program (Oracle Apps)

FND_FILE – create log and output file in Concurrent Program (Oracle Apps)

FND_FILE is a built-in package provided in Oracle Apps/E-Business Suite to write log and output files in PL/SQL concurrent program. This is actually a wrapper on UTL_FILE to write files on the Unix server. You can open the log and output file using navigation View -> Requests -> Find. Select the respective request on the summary page and click View Log or View Output to check the respective log or output file.

  • Log File – These are log files. A dump error message, debug message in this file.
  • Output File – This file you can have some output of processing of the concurrent program.

In this article, I will share how to use fnd_file to create a log and output file.

To explain this API, we will use PL/SQL Concurrent Program in Oracle Apps. It is a simple PL/SQL procedure that just writes dummy messages in log and output files.

FND_FILE

The fnd_file package contains all the procedures and functions to write log and output files. Here I am just going to explain fnd_file.put_line the procedure with an example. You can refer to the article from the Oracle Apps Developer Guide to check all procedures and functions available in the fnd_file package. This article is very detailed and does contain a working example.

Read:- PL/SQL APIs for Concurrent Processing

Below are global variables defined in package specification to denote log or output files.

Global Variables

FND_FILE.LOG – 1 – This is a constant variable to denote log file

FND_FILE.OUTPUT – 2  – This is a constant variable to denote log file

FND_FILE.PUT_LINE

This procedure writes a line of text to a file including a new line.

Syntax

procedure FND_FILE.PUT_LINE
  (which IN NUMBER,
   buff	 IN VARCHAR2);

which - Log file or output file. Use either FND_FILE.LOG or FND_FILE.OUTPUT.
buff - Text to write.

Example 1

In this example, a concurrent program is defined in the below procedure. This procedure used fnd_file.put_line to log output and log. Depending on which parameter message is written. Even though it is a wrapper on UTL_FILE, you do not have to explicitly open and close file. It is completely manager by Concurrent manager.

CREATE OR REPLACE PROCEDURE fnd_file_Demo(
 o_chr_errbuf VARCHAR2 ,
 o_chr_errcode VARCHAR2 )
IS
BEGIN
 --- Creating log mesage----
 fnd_file.put_line(fnd_file.log,'This is log file ');
 fnd_file.put_line(fnd_file.log,'You can put error, debug message here ' || SQLERRM);
 fnd_file.put_line(fnd_file.log,'You can also use built in API ' || fnd_message.get);
 
 ---Creating output message
 fnd_file.put_line(fnd_file.output,'This is output file');
 fnd_file.put_line(fnd_file.output,'You can use it to put summary information');
END;

Run the concurrent program and check the log and output file generated.

Sample log file

+---------------------------------------------------------------------------+
Start of log messages from FND_FILE
+---------------------------------------------------------------------------+
This is log file 
You can put error, debug message here ORA-0000: normal, successful completion
You can also use built in API 
+---------------------------------------------------------------------------+
End of log messages from FND_FILE
+---------------------------------------------------------------------------+

Sample output file

This is output file
You can use it to put summary information

Other Public Procedures/APIs

FND_FILE.PUT – This procedure writes text to a file. There is no newline inserted. Multiple calls to FND_FILE.PUT will produce concatenated text.

FND_FILE.NEW_LINE – This procedure writes line terminators (newline characters) to a file. It should be used with fnd_file.put if you want to write a message on different line.