Co
nfi
de
nti
al - URL Attachment
Ora
cle
Res
tric R12: Attach URL to AP Invoice through API/Script
ted Background:
This post illustrates implementing attachment functionality in Oracle Applications
through fnd_webattch.add_attachment API
Script:
declare
v_category_id NUMBER;
v_description VARCHAR2(200) := 'Attach the url to AP Inv';
v_invoice_image_url VARCHAR2(200) := '[Link]
v_function_name VARCHAR2(50) := 'APXINWKB';--Invoice Form
v_entity_name VARCHAR2(50) := 'AP_INVOICES';
v_invoice_id NUMBER;
v_user_id NUMBER := fnd_global.user_id;
begin
/*Set Org Context. Give Org_id accordingly*/
mo_global.set_policy_context('S',&Org_id);
/*Getting Category_id of "FromSupplier".
Change it according to your requirement*/
SELECT category_id into v_category_id
FROM fnd_document_categories
WHERE name = 'FromSupplier';
/*Give appropriate Invoice number*/
SELECT invoice_id into v_invoice_id
FROM ap_invoices_all
WHERE invoice_num = '&Inv_num';
fnd_webattch.add_attachment(
seq_num => 100
,category_id => v_category_id
,document_description => v_description
,datatype_id => 5 --url
,text => NULL
,file_name => NULL
,url => v_invoice_image_url
,function_name => v_function_name
,entity_name => v_entity_name
,pk1_value => v_invoice_id
,pk2_value => NULL
,pk3_value => NULL
,pk4_value => NULL
,pk5_value => NULL
,media_id => NULL
,user_id => v_user_id
Co );
nfi EXCEPTION
de WHEN OTHERS THEN
nti
raise_application_error (-20002, 'An error has occurred inserting
attaching an url to the invoice.');
al -
end;
Ora
cle
Res
tric
ted
Co
nfi
de
nti
al -
Ora Test:
cle Invoice Workbench > View > Attachments
Res
tric
ted
Co
nfi
de
nti
al -
Ora
cle
Res
tric
ted