Sunday, January 11, 2009

Invoke the Concurrent Request Output as web page

Hi All,
Many a times, I have seen requirement from Client to invoke the concurrent program output by clicking on a button. It isn't that difficult to submit a program and get the output opened in a separate page when a specific button is clicked.
Try out the following code in order to invoke the output of a Concurrent Program as an HTML page.
BEGIN
SELECT file_name, file_node_name
INTO l_outfile_name, l_outfile_node_name
FROM fnd_conc_req_outputs
WHERE concurrent_request_id = your_request_ID;

SELECT mime_type
INTO l_mime_type
FROM fnd_mime_types_vl
WHERE file_format_code = 'PDF';

l_svc := fnd_conc_private_utils.get_fs_svc_name(l_outfile_node_name);
l_id := fnd_webfile.create_id(l_outfile_name, l_svc, 10, l_mime_type, l_request_id, 'BINARY', 'Y');
IF (l_id IS NULL)
THEN
fnd_message.retrieve;
fnd_message.error;
END IF;

fnd_profile.get('APPS_WEB_AGENT', l_base);
l_pos := INSTR( l_base, '/', 1, 3);

IF (l_pos > 0)
THEN
l_base := SUBSTR(l_base, 1, l_pos - 1);
END IF;

url := l_base '/OA_CGI/FNDWRR.exe?' 'temp_id=' l_id;
fnd_utilities.open_url(url);
END;

Enjoy,
Viral Dhruv

1 comment:

Satya said...

yes Brother This will Work, Because FNDCONC pll(editor Packages) does the same,

But One small thing can you clarify me.....
Here i got an URL for a PDF File that is stored in some where in middle tier. and i'm opening this URL from a form....
Then A balnk browser stays ideal and then PDF file is opening in ACROBAT READER separatly, But this will not hapen when you click on VIEW OUTPUT on SRS From, PDF will open in the Browser itself.

Do you have any idea....

and one more is, for same file this code will generate different URLs (Temp_id will Change)......
Here Can't we use the Old URL multiple times, if we use it says AUTHENTICATION FAILED, because of the ID life time,even though if we change life time of the ID it'll not work.

Do you have any Idea.... let me know ....

Thanks,
Satya.