Sample Code to open BSA Attachment.
PROCEDURE WHEN_MOUSE_DOUBLECLICK AS
lv_trg_item VARCHAR2(2000):= :SYSTEM.TRIGGER_ITEM;
l_doc_id NUMBER := :AGREE_CNTR.HEADER_ID;
l_bsa_doc_type VARCHAR2(2) := OE_CONTRACTS_UTIL.get_G_BSA_DOC_TYPE();
l_layout_template_id NUMBER := :AGREE_CNTR.LAYOUT_TEMPLATE_ID;
gfm_agent VARCHAR2(255);
l_media_id NUMBER:=Null;
l_url VARCHAR2(2000);
CURSOR cur_att (cp_header_id NUMBER) IS
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';
BEGIN
IF lv_trg_item ='AGREE_CNTR.TEMPLATE' THEN
IF :AGREE_CNTR.STATUS = 'Executed' THEN
gfm_agent := fnd_web_config.gfm_agent;
OPEN cur_att(l_doc_id);
FETCH cur_att INTO l_media_id;
CLOSE cur_att;
IF l_media_id IS NOT NULL THEN
l_url := fnd_gfm.construct_download_URL(gfm_agent,l_media_id, FALSE);
l_url := replace(replace(l_url,'&','%38'),'%','%37');
fnd_utilities.open_url ( l_url);
END IF;
RETURN;
ELSE
l_bsa_doc_type := wfa_html.conv_special_url_chars(l_bsa_doc_type);
l_doc_id := wfa_html.conv_special_url_chars(l_doc_id);
l_layout_template_id := wfa_html.conv_special_url_chars(l_layout_template_id);
fnd_function.execute(function_name=> 'ONT_PRINT',
other_params =>
'docId='|| l_doc_id
|| '&docType='|| l_bsa_doc_type
|| '&layoutTemplateId='|| l_layout_template_id );
RETURN;
END IF;
END IF;
END WHEN_MOUSE_DOUBLECLICK;
No comments:
Post a Comment