DCP

Wednesday 28 June 2017

Duplicate PO Emails being sent out to Supplier that is registered on iSupplier Portal



Known Oracle Issue: Metalink Note References:
How Suppliers Can Avoid E-mail Notifications? (Doc ID 461963.1)

Fix: Customize PO Approval Workflow:

Open up Email PO Process.


This Process calls Function: Send Notification all web Suppliers










CREATE OR REPLACE PACKAGE XXPO_REQAPPROVAL_INIT1 AS
procedure Send_WS_Notif_Yes_No(     itemtype        in varchar2,
                              itemkey         in varchar2,
                              actid           in number,
                              funcmode        in varchar2,
                              resultout       out NOCOPY varchar2    ) ;
END;
/
                           
CREATE OR REPLACE PACKAGE BODY XXPO_REQAPPROVAL_INIT1 AS
procedure Send_WS_Notif_Yes_No(     itemtype        in varchar2,
                              itemkey         in varchar2,
                              actid           in number,
                              funcmode        in varchar2,
                              resultout       out NOCOPY varchar2    )  IS
l_send_notif varchar2(1):= 'N';                             
BEGIN                             
   l_send_notif := 'N'; 
   resultout := wf_engine.eng_completed || ':' || l_send_notif ;
END;
END;
/

  


Friday 16 June 2017

Extract PO Attachments

CREATE OR REPLACE PROCEDURE dsdpo_extract_po_files
AS

  v_file     utl_file.file_type;
  v_line     varchar2(1000);
  v_blob_len number;
  v_pos      number;
  v_buffer   raw(32764);
  v_amt      binary_integer := 32764;

  cursor cur_files
  is
    SELECT ad.entity_name, ad.seq_num Seq , ad.pk1_value, h.segment1, fl.file_name, fl.file_data
    FROM fnd_documents d,
    fnd_attached_documents ad,
    fnd_documents_vl dtl,
    po_headers_all h,
    fnd_lobs fl,
    fnd_document_datatypes fdd
    WHERE d.document_id = ad.document_id
    AND ad.entity_name = 'PO_HEAD'
    AND ad.pk1_value = to_char(h.po_header_id)
--    AND h.segment1 = '436223'
    AND d.document_id = dtl.document_id
    AND fl.file_id = d.media_id
    AND fdd.user_name = 'File'
    and h.po_header_id in(

    select po_header_id from apps.po_headers_all
    where vendor_id =7951
    and creation_date >'01-JAN-2012' and type_lookup_code='STANDARD')
    and dtl.file_name like '%.pdf';

begin
  -- File Attachments
  for c_file in cur_files
  loop
    v_file := utl_file.fopen('/applcsf/ebsdev/temp','dsd_'||c_file.file_name, 'wb', 32764);

    v_blob_len := dbms_lob.getlength(c_file.file_data);
    v_pos := 1;
    while v_pos < v_blob_len
    loop
      dbms_lob.read(c_file.file_data,v_amt,v_pos,v_buffer);
      utl_file.put_raw(v_file,v_buffer,true);
      v_pos := v_pos + v_amt;
    end loop;
    utl_file.fclose(v_file);
  end loop;

end;