Attachment Download Function
Using the Fnd_lobs table in conjunction with the FND_GFM package to download files, you can download files that already exist in the Fnd_lobs table, or you can manually write some content into the Fnd_lobs table, and then display in the browser:
--1. Download the existing files in the fnd_lobs table:
DECLARE
V_file_id NUMBER;
Url VARCHAR2 (500);
The BEGIN
--Get the file_id of the file which you want to download in fnd_lobs
V_file_id: = XXXXXX;
- Get The Download URL
Url: = fnd_gfm. Construct_download_url (fnd_web_config gfm_agent,
V_file_id,
TRUE);
Fnd_utilities. Open_url (url);
The END;
--2. Manually write contents into the fnd_lobs table and display in the browser: DECLARE db_file NUMBER;
Mime_type VARCHAR2(255) := 'text/plain';
Out_string VARCHAR2(32767) := 'Just some plain text that is stored';
Web_server_prefix VARCHAR2 (500);
Url VARCHAR2 (500);
The BEGIN
Db_file := fnd_gmm.file_create (content_type => mime_type,
Program_name = > "export");
Fnd_gfm. File_write_line (db_file out_string);
Db_file: = fnd_gfm file_close (db_file);
Url: = fnd_gfm. Construct_download_url (fnd_web_config gfm_agent,
Db_file,
TRUE);
Fnd_utilities. Open_url (url);
The END;
Oracle EBS Attachment download feature