Free Oracle Magazine Profit:The Executive's Guide to Oracle Applications

Enter your e-mail address to receive notifications when there are new posts

Profit Magazine: The Executive's Guide to Oracle Applications

Oracle API Availability - Input/Output

Posted on August 11th, 2007 by Sanjit Anand |Print This Post Print This Post |Email This Post Email This Post

What is FND_FILE

An API that contains procedures to write text to log and output files which can be viewed once the Concurrent program get completed in output or log . These procedures can only be used within PL/SQL Procedures which, are concurrent programs.

Internally its uses the oracle supplied database package UTL_FILE

  • utl_file_dir parameter must be set to include the log and out directories for the applications that will run concurrent requests using FND_FILE
  • Database owner must have write privileges on those directories
  • Take a note that FND_FILE supports a maximum buffer line size of 32K for both log and output files.

Here are the list of Options available within API.

  • FND_FILE.PUT

Useful for writing text to a file without a new line character. Multiple calls will concatenate the text .
Does not include new line character

FND_FILE.PUT (which IN NUMBER, buff IN VARCHAR2)
Which - Means LOG file or OUTPUT file.

  • FND_FILE.LOG
  • FND_FILE.OUTPUT

Buff - Means text to write.

Usage
FND_File.Put(FND_File.Log, ‘This text written to Log file’);

FND_File.Put(FND_File.Output, ‘This text written to Log file’);

  • FND_FILE.PUT_LINE

This is used to write a line of text to a file followed by a new line character

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

Usage
FND_File.Put_Line(FND_File.Out, ‘This text written to Out file’);

  • FND_FILE.NEW_LINE

FND_FILE.NEW_LINE( which IN NUMBER, LINES IN NATURAL:= 1)
Writes line terminators (new line characters) to a file.
Eg. FND_FILE.NEW_LINE(FND_FILE.LOG,2)

  • FND_File.PUT_NAMES

This is used to sets temporary log and out file names and directory, which normally used during test and debug phase.

FND_FILE.PUT_NAMES(p_log in varchar2,
p_out in varchar2,
p_dir in varchar2)
Usage
FND_File.Put_Names(‘Order123.log’, ‘Order123.out’, ‘/usr/temp/outfiles’);

Example
BEGIN
fnd_file.put_names(’test.log’, ‘test.out’,'‘/usr/temp/outfiles’’);
fnd_file.put_line(fnd_file.output,’Called stored procedure’);
/* add logic, etc… */

fnd_file.put_line(fnd_file.output, ‘transaction locked at point A’);
/* More logic, etc… */

  • FND_FILE.CLOSE
    This will closes open files.

This is normally used only during test and debug phase

Usage:
FND_File.Close;

Posted in API Integration | Email This Post Email This Post | Print This Post Print This Post

One Response
  1. Kurian James Says:

    Thanks a Lot!!!

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.