14 April 2009

Oracle Application : Open FND Attachment

PL/SQL code to open FND Attachment

 gfm_agent VARCHAR2(255);
 Get the web context : gfm_agent := fnd_web_config.gfm_agent;
 Get the attachment id.
Sample SQL :
SELECT
media_id
FROM
FND_ATTACHED_DOCS_FORM_VL
WHERE
function_name=decode(0,1,null,'OEXOEBSO')
AND function_Type=decode(0,1,null,'O')
AND (security_type=4 OR publish_flag='Y')
AND ((entity_name= 'OE_ORDER_HEADERS'
AND pk1_value = cp_header_id ))
AND category_description = 'Signed Agreement';


 Construct URL to open the attachment.
fnd_gfm.construct_download_URL(gfm_agent,l_media_id, FALSE);
replace(replace(l_url,'&','%38'),'%','%37');
 Open the attachment.
fnd_utilities.open_url ( l_url);

1 comment:

Nageswar Astaputra said...

Hi Kiran, thanks for your nice information. I need some more info from you regarding the attachments. I have few couple of templates and in that i added few variables. I enabled attachments in Messages and for a particular message i will add this attachment. I have few set of message tokens. I need to insert the token values in few places of attached template. How to read the attachment and how to insert the message token in the template.

For example in template.

This is to certify that &EMP_NAME has got his employment visa and he need to go to medical test on &DATE.

I need to insert message token in &EMP_NAME and &DATE. Please help me out how to read the attachment and insert the message tokens into it. I would be very much grateful to you.

Regards,
Nageswar