How to download a file in DOCMAN and send an email with an attachment in IFS with PLSQL
- Rumesh Aponso (RMAX)

- Nov 13, 2024
- 1 min read
Updated: Nov 22, 2024
DECLARE
sender_ VARCHAR2(200) := 'RMAX';
from_ VARCHAR2(200) := 'RMAX';
to_list_ VARCHAR2(200) := 'rmax@onenote.com';
lu_name_ VARCHAR2(800) := 'PurchaseOrderLinePart';
this_key_ref_ VARCHAR2(800) := '';
rcode_ VARCHAR2(10) := '';
file_name_ VARCHAR2(500) := '';
attachments_ Command_SYS.Attachment_Arr;
doc_type_ edm_file_storage_tab.doc_type%TYPE;
CURSOR get_po_lines IS
SELECT order_no, line_no, release_no
FROM purchase_order_line_tab
WHERE order_no = '1';
CURSOR get_doc_info IS
SELECT doc_class, doc_no, doc_sheet, doc_rev, file_data
FROM edm_file_storage_tab t
WHERE doc_no IN (SELECT doc_no
FROM doc_reference_object
WHERE key_ref = this_key_ref_);
BEGIN
FOR po_line_ IN get_po_lines LOOP
this_key_ref_ := Client_SYS.Get_Key_Reference(lu_name_, 'ORDER_NO', po_line_.order_no, 'LINE_NO', po_line_.LINE_NO, 'RELEASE_NO', po_line_.release_no);
FOR doc_info_ IN get_doc_info LOOP
Edm_File_API.Reference_Exist(rcode_, doc_info_.doc_class, doc_info_.doc_no, doc_info_.doc_sheet, doc_info_.doc_rev, 'VIEW');
IF (rcode_ = 'TRUE') THEN
doc_type_ := 'VIEW';
ELSE
doc_type_ := 'ORIGINAL';
END IF;
file_name_ := Edm_File_API.Get_New_Local_File_Name(doc_info_.doc_class, doc_info_.doc_no, doc_info_.doc_sheet, doc_info_.doc_rev, doc_type_, '1');
Command_SYS.Add_Attachment(attachments_, file_name_, doc_info_.file_data);
END LOOP;
END LOOP;
Command_SYS.Mail(sender_ => sender_,
from_ => from_,
to_list_ => to_list_,
subject_ => 'Test',
text_ => 'This is a mail with attachement',
attachments_ => attachments_);
END;



Comments