Sei sulla pagina 1di 4

How to Attach Report Output as an attachment in Oracle Apps

How to Attach Report Output as an


attachment in Oracle Apps
29/08/2011

Oracle Apps 11i

JIGNESH B PATEL & TIMIR GUPTE


Jignesh2.p@tcs.com Timir.gupte@tcs.com

1
How to Attach Report Output as an attachment in Oracle Apps

How to Attach Report Output as an attachment in


Oracle Apps

Objective :

This article describes the process of attaching report output as an attachment in Oracle
Apps.

Process :

1) Run the existing report by Submitting the Request from Oracle Apps.

2) Check for the Request id for that particular request

3) Pass the Request Id from step 2 and Output File Type to the below
query to fetch output file name:

SELECT SUBSTR(OUTFILE_NAME,1,INSTR(OUTFILE_NAME,'/', -1)) ||


FCP.CONCURRENT_PROGRAM_NAME || '_' ||
FCR.REQUEST_ID || '_1'||'FILE TYPE' OUTFILE_NAME
FROM fnd_concurrent_requests FCR,
FND_CONSURRENT_PROGRAMS_VL FCP,
WHERE FCR.CONCURRENT_PROGRAM_ID =
FCP.CONCURRENT_PROGRAM_ID
AND STATUS_CODE <> ‘E’
AND FCR.REQUEST_ID = 'REQUEST ID'

2
How to Attach Report Output as an attachment in Oracle Apps

4) Pass the Output file name from step 3 to below command and execute
it in Oracle Apps. This command would give file id after inserting the
file as an blob into fnd_lobs.

FNDGFU apps/xxpassword 0 Y
PROGRAM_NAME=FND_ATTACH
PROGRAM_TAG=CS:100
CONTENT_TYPE=PDF
PLS_CALLBACK=XXCRM_LOADFILE_BLOB LANGUAGE=US $5

Note : i) $5 is input as an file name


ii) PLS_CALLBACK=XXCRM_LOADFILE_BLOB is an callback
procedure which has only single parameter file id which is generated
after successful execution of above command.

FND_WEBATTCH.Add_Attachment

(seq_num => ‘sequence retrieved from step 2’,


category_id => '1',
document_description => ‘Document Description’,
datatype_id => '6',
TEXT => NULL,
file_name => ‘file name’,
url => NULL,
function_name => ‘Function Name’,
entity_name => ‘Entity Name’,
pk1_value => ‘Argument 1 Passed to Concurrent
Request’,
pk2_value => NULL,
pk3_value => NULL,
pk4_value => NULL,
pk5_value => NULL,
MEDIA_ID => ‘file id retrieved from step 5’,
user_id => 0,
usage_type => 'O');

commit;

3
How to Attach Report Output as an attachment in Oracle Apps

5) Attachment to the Particular Function is done by following command :

FND_WEBATTCH.Add_Attachment
(seq_num => ‘sequence retrieved from step 2’,
category_id => '1',
document_description => ‘Document Description’,
datatype_id => '6',
TEXT => NULL,
file_name => ‘file name’,
url => NULL,
function_name => ‘Function Name’,
entity_name => ‘Entity Name’,
pk1_value => l_INCIDENT_ID,
pk2_value => NULL,
pk3_value => NULL,
pk4_value => NULL,
pk5_value => NULL,
MEDIA_ID => ‘file id retrieved from step 1’,
user_id => 0,
usage_type => 'O');

commit;

Source Code :
Source Code for this process is attached here with.

fndlob.prog XXCRM_LOADFILE_B XXCRM_RUNFNDLOB


LOB.prc _PRC.prc

Potrebbero piacerti anche