The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE update_pending_signature (
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
p_po_header_id IN NUMBER);
PROCEDURE update_auth_status_approve(
p_document_id IN NUMBER,
p_item_type IN VARCHAR2,
p_item_key IN VARCHAR2);
PROCEDURE InsertActionHistoryPoAme(
p_document_id IN NUMBER,
p_draft_id IN VARCHAR2,
p_document_type IN VARCHAR2,
p_document_subtype IN VARCHAR2,
p_revision_num IN NUMBER,
p_employee_id IN NUMBER,
p_approval_group_id IN NUMBER,
p_action IN VARCHAR2,
p_note IN VARCHAR2 default null)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
SELECT MAX(sequence_num)
INTO l_sequence_num
FROM PO_ACTION_HISTORY
WHERE object_type_code = p_document_type --'PO'
AND object_sub_type_code = p_document_subtype --'STANDARD'
AND object_id = p_document_id;
po_forward_sv1.insert_action_history ( p_document_id,
p_document_type,
p_document_subtype,
l_sequence_num + 1,
p_action,
sysdate,
p_employee_id,
NULL,
p_note,
p_revision_num,
NULL,
fnd_global.conc_request_id,
fnd_global.prog_appl_id,
fnd_global.conc_program_id,
SYSDATE,
fnd_global.user_id,
fnd_global.login_id,
p_approval_group_id);
END InsertActionHistoryPoAme;
PROCEDURE UpdateActionHistoryPoAme(
p_document_id NUMBER,
p_draft_id NUMBER,
p_document_type IN VARCHAR2,
p_document_subtype IN VARCHAR2,
p_action VARCHAR2,
p_note VARCHAR2,
p_current_approver NUMBER)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
UPDATE po_action_history
SET action_code = p_action,
note = p_note,
action_date = sysdate
WHERE object_id = p_document_id
AND employee_id = p_current_approver
AND action_code IS NULL
AND object_type_code = p_document_type
AND object_sub_type_code = p_document_subtype
AND rownum =1;
UPDATE po_action_history
SET action_code = p_action, note = p_note, action_date = sysdate
WHERE object_id = p_document_id
AND action_code IS NULL
AND object_type_code = p_document_type
AND object_sub_type_code = p_document_subtype;
END UpdateActionHistoryPoAme;
l_insertion_type VARCHAR2(30);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Calling AME API with transaction id ' || l_transaction_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||'.'||l_progress||':'||
' g_next_approvers.count:'||g_next_approvers.count||
' l_completeYNO:'||l_completeYNO);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' BEFORE ESIGNER EXISTS');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' BEFORE update_pending_signature');
update_pending_signature(itemtype, itemkey, l_document_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||'.'||l_progress||':'||
' l_position_has_valid_approvers:'||l_position_has_valid_approvers||
' g_next_approvers.count:'||g_next_approvers.count);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||':'||l_progress||':'||SQLERRM);
SELECT person_id, full_name
INTO l_next_approver_id, l_next_approver_name
FROM ( SELECT person.person_id, person.full_name
FROM per_all_people_f person,
per_all_assignments_f asg,
wf_users wu
WHERE asg.position_id = g_next_approvers(l_approver_index).orig_system_id
AND wu.orig_system = ame_util.perorigsystem
AND wu.orig_system_id = person.person_id
AND TRUNC(SYSDATE) BETWEEN person.effective_start_date AND NVL(person.effective_end_date, TRUNC( SYSDATE))
AND person.person_id = asg.person_id
AND asg.primary_flag = 'Y'
AND asg.assignment_type IN ( 'E', 'C' )
AND ( person.current_employee_flag = 'Y' OR person.current_npw_flag = 'Y' )
AND asg.assignment_status_type_id NOT IN
( SELECT assignment_status_type_id
FROM per_assignment_status_types
WHERE per_system_status = 'TERM_ASSIGN' )
AND TRUNC(SYSDATE) BETWEEN asg.effective_start_date AND asg.effective_end_date
ORDER BY person.last_name)
WHERE ROWNUM = 1;
g_next_approvers.delete(l_approver_index);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress
||': g_next_approvers.name'
||g_next_approvers(l_approver_index).name);
SELECT TO_CHAR (l_document_id)||'-'||TO_CHAR (po_wf_itemkey_s.nextval)
INTO l_item_key
FROM sys.dual;
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress
||' g_next_approvers.orig_system:'
||g_next_approvers (l_approver_index).orig_system);
SELECT person_id , full_name
INTO l_next_approver_id, l_next_approver_name
FROM ( SELECT person.person_id , person.full_name
FROM per_all_people_f person ,
per_all_assignments_f asg,
wf_users wu
WHERE asg.position_id = g_next_approvers (l_approver_index).orig_system_id
AND wu.orig_system = ame_util.perorigsystem
AND wu.orig_system_id = person.person_id
AND TRUNC (sysdate) BETWEEN person.effective_start_date AND NVL (person.effective_end_date ,TRUNC (sysdate))
AND person.person_id = asg.person_id
AND asg.primary_flag = 'Y'
AND asg.assignment_type IN ('E','C')
AND ( person.current_employee_flag = 'Y' OR person.current_npw_flag = 'Y' )
AND asg.assignment_status_type_id NOT IN
( SELECT assignment_status_type_id
FROM per_assignment_status_types
WHERE per_system_status = 'TERM_ASSIGN'
)
AND TRUNC (sysdate) BETWEEN asg.effective_start_date AND asg.effective_end_date
ORDER BY person.last_name )
WHERE ROWNUM = 1;
SELECT employee_id
INTO l_next_approver_id
FROM fnd_user
WHERE user_id = g_next_approvers (l_approver_index).orig_system_id
AND TRUNC (sysdate) BETWEEN start_date AND NVL (end_date ,sysdate + 1);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_next_approver_user_name:'||l_next_approver_user_name);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' g_production_Indexes.Count:'||g_production_Indexes.Count);
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' j:' || j);
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' g_production_Indexes(j):' || g_production_Indexes(j));
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' l_approver_index:' || l_approver_index);
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' g_variable_Names(j):' || g_variable_Names(j));
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' g_variable_Values(j):' || g_variable_Values(j));
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' Esigner exists (into post approval grp)');
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress||' No Production Rules');
PO_WF_DEBUG_PKG.insert_debug ( itemtype, itemkey, l_log_head||':'||l_progress
||' g_next_approvers.api_insertion:'
||g_next_approvers(l_approver_index).api_insertion);
IF (g_next_approvers (l_approver_index).api_insertion = 'Y') THEN
n_varval (5) := 1;
PO_WF_DEBUG_PKG.insert_debug (itemtype, itemkey, l_log_head||':'||l_progress
||' RESP:'||n_varval(6)
||' APPL_ID:'||n_varval(7));
g_next_approvers.delete;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
SELECT employee_id
INTO l_forwardee.orig_system_id
FROM fnd_user
WHERE user_name = l_forwardee.name;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' p_response'||p_response
||' l_forwardee.name:'||l_forwardee.name);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' p_response'||p_response
||' l_forwardee.orig_system:'||l_forwardee.orig_system);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_forwardee.orig_system_id:'||l_forwardee.orig_system_id);
SELECT name
INTO l_forwardee.name
FROM ( SELECT name
FROM wf_roles
WHERE orig_system = l_forwardee.orig_system
AND orig_system_id = l_forwardee.orig_system_id
ORDER BY start_date )
WHERE ROWNUM = 1;
SELECT name
INTO l_current_approver.name
FROM ( SELECT name
FROM wf_roles
WHERE orig_system = l_current_approver.orig_system
AND orig_system_id = l_current_approver.orig_system_id
ORDER BY start_date )
WHERE ROWNUM = 1;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_current_approver.name:'||l_current_approver.name);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_current_approver.orig_system:'||l_current_approver.orig_system);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_current_approver.orig_system_id:'||l_current_approver.orig_system_id);
ame_api2.updateApprovalStatus(
applicationIdIn => applicationId,
transactionIdIn => l_ame_transaction_id,
transactionTypeIn => l_transaction_type,
approverIn => l_current_approver,
forwardeeIn => l_forwardee);
ame_api2.updateApprovalStatus(
applicationIdIn => applicationId,
transactionIdIn => l_ame_transaction_id,
transactionTypeIn => l_transaction_type,
approverIn => l_current_approver);
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PROCEDURE insert_action_history(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'insert_action_history';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_log_head||':'||l_progress);
InsertActionHistoryPoAme(
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_revision_num => l_revision_num,
p_employee_id => l_next_approver_id,
p_approval_group_id => l_approval_group_id,
p_action => l_action );
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END insert_action_history;
PROCEDURE update_action_history_forward(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'Update_Action_History_Forward';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
UpdateActionHistoryPoAme (
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note =>l_note,
p_current_approver => l_current_approver);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Exception:'||sqlerrm);
END Update_Action_History_Forward;
PROCEDURE update_action_history_approve(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'Update_Action_History_Approve';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Doc Info:'||TO_CHAR(l_document_id)||'-'
||TO_CHAR(l_draft_id)||'-'||l_document_type
||'-'||l_document_subtype);
UpdateActionHistoryPoAme (
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note =>l_note,
p_current_approver => l_current_approver);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END Update_Action_History_Approve;
PROCEDURE update_action_history_reject(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'Update_Action_History_Reject';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Doc Info:'||TO_CHAR(l_document_id)||'-'
||TO_CHAR(l_draft_id)||'-'||l_document_type
||'-'||l_document_subtype);
UpdateActionHistoryPoAme (
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note =>l_note,
p_current_approver => l_current_approver);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END Update_Action_History_Reject;
PROCEDURE update_action_history_timeout(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'Update_Action_History_Timeout';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Doc Info:'||TO_CHAR(l_document_id)
||'-'||TO_CHAR(l_draft_id)||'-'
||l_document_type||'-'||l_document_subtype);
UpdateActionHistoryPoAme (
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note =>l_note,
p_current_approver => l_current_approver);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END Update_Action_History_Timeout;
PROCEDURE update_action_history_app_fwd(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'update_action_history_app_fwd';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Doc Info:'||TO_CHAR(l_document_id)
||'-'||TO_CHAR(l_draft_id)||'-'
||l_document_type||'-'||l_document_subtype);
UpdateActionHistoryPoAme (
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note => l_note,
p_current_approver => l_current_approver);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END update_action_history_app_fwd;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Returned from process_response_internal');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Process_Response_App_Forward completed');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Completed');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Completed');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Completed');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Completed');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||' funcmode:'||funcmode);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_action:'||l_action);
SELECT original_recipient,
DECODE(more_info_role, NULL, recipient_role, more_info_role)
INTO l_original_recipient, l_current_recipient_role
FROM wf_notifications
WHERE notification_id = WF_ENGINE.context_nid
AND (more_info_role IS NOT NULL OR recipient_role <> original_recipient );
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||
l_progress||' l_new_recipient_id:'||l_new_recipient_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_current_recipient_id:'||l_current_recipient_id);
UpdateActionHistoryPoAme(
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note => wf_engine.context_user_comment,
p_current_approver => l_current_recipient_id );
InsertActionHistoryPoAme(
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_revision_num => l_revision_num,
p_employee_id => l_new_recipient_id,
p_approval_group_id => l_approval_group_id,
p_action => NULL );
SELECT fu.user_id
INTO l_responder_id
FROM fnd_user fu,
wf_notifications wfn
WHERE wfn.notification_id = l_nid
AND wfn.original_recipient = fu.user_name;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_preserved_ctx:'||l_preserved_ctx);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_responder_id:'||l_responder_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_session_user_id:'||l_session_user_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_session_resp_id:'||l_session_resp_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_session_appl_id:'||l_session_appl_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_preparer_resp_id:'||l_preparer_resp_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_preparer_appl_id:'||l_preparer_appl_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Completed');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT nls_language, nls_territory
INTO l_language, l_territory
FROM fnd_languages
WHERE language_code = l_language_code;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Error when fetching language:'||sqlerrm);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_request_id:'||l_request_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Exception when submitting the request');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' fnd_message:'||l_msg);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Exception:'||sqlerrm);
SELECT fl.file_name, dbms_lob.getlength(fl.file_data)
FROM fnd_documents d,
fnd_attached_documents ad,
fnd_doc_category_usages dcu,
fnd_attachment_functions af,
fnd_lobs fl
WHERE ( (ad.pk1_value = TO_CHAR(l_po_header_id) AND ad.entity_name = 'PO_HEADERS') OR
(ad.pk1_value = (SELECT To_Char(vendor_id)
FROM po_headers_all
WHERE po_header_id = l_po_header_id) AND ad.entity_name = 'PO_VENDORS') OR
(ad.pk1_value IN (SELECT To_Char(po_line_id)
FROM po_lines_all
WHERE po_header_id = l_po_header_id ) AND ad.entity_name = 'PO_LINES') OR
(ad.pk1_value IN (SELECT To_Char(from_header_id)
FROM po_lines_all
WHERE po_header_id = l_po_header_id
AND from_header_id IS NOT NULL ) AND ad.entity_name = 'PO_HEADERS') OR
(ad.pk1_value IN (SELECT To_Char(from_line_id)
FROM po_lines_all
WHERE po_header_id = l_po_header_id
AND from_line_id IS NOT NULL ) AND ad.entity_name = 'PO_LINES') OR
(ad.pk1_value IN (SELECT To_Char(line_location_id)
FROM po_line_locations_all
WHERE po_header_id = l_po_header_id
AND shipment_type IN ('PRICE BREAK', 'STANDARD', 'PREPAYMENT')) AND ad.entity_name = 'PO_SHIPMENTS') OR
(ad.pk2_value IN (SELECT To_Char(item_id)
FROM po_lines_all
WHERE po_header_id = l_po_header_id
AND TO_CHAR(PO_COMMUNICATION_PVT.getInventoryOrgId()) = ad.pk1_value
AND item_id IS NOT NULL ) AND ad.entity_name = 'MTL_SYSTEM_ITEMS') )
AND d.document_id = ad.document_id
AND dcu.category_id = d.category_id
AND dcu.attachment_function_id = af.attachment_function_id
AND d.datatype_id = 6
AND af.function_name = 'PO_PRINTPO'
AND d.media_id = fl.file_id
AND dcu.enabled_flag = 'Y'
GROUP BY fl.file_name, dbms_lob.getlength(fl.file_data)
ORDER BY fl.file_name;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT pv.language
INTO l_supp_lang
FROM po_vendor_sites_all pv, po_headers_all ph
WHERE ph.po_header_id = l_header_id
AND ph.vendor_site_id = pv.vendor_site_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Error while fetching vendor site language:'||sqlerrm);
SELECT nls_language
INTO l_language
FROM fnd_languages
WHERE language_code = l_language_code;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Error while fetching the language code:'||sqlerrm);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Checking for supplier file attachments');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' No Supplier file attachments');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_attachments_exist:'||l_attachments_exist);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Check for duplicate filenames');
SELECT 'Y'
INTO l_duplicate_filenames
FROM dual
WHERE EXISTS ( SELECT fl.file_name
FROM fnd_documents d,
fnd_attached_documents ad,
fnd_doc_category_usages dcu,
fnd_attachment_functions af,
fnd_lobs fl
WHERE ( (ad.pk1_value = TO_CHAR(l_document_id) AND ad.entity_name = 'PO_HEADERS') OR
--
(ad.pk1_value = TO_CHAR((SELECT vendor_id
FROM po_headers_all
WHERE po_header_id = l_document_id))
AND ad.entity_name = 'PO_VENDORS') OR
--
(ad.pk1_value IN (SELECT po_line_id
FROM po_lines_all
WHERE po_header_id = l_document_id)
AND ad.entity_name = 'PO_LINES') OR
--
(ad.pk1_value IN (SELECT from_header_id
FROM po_lines_all
WHERE po_header_id = l_document_id
AND from_header_id IS NOT NULL) AND ad.entity_name = 'PO_HEADERS') OR
--
(ad.pk1_value IN (SELECT from_line_id
FROM po_lines_all
WHERE po_header_id = l_document_id
AND from_line_id IS NOT NULL) AND ad.entity_name = 'PO_LINES') OR
--
(ad.pk1_value IN (SELECT line_location_id
FROM po_line_locations_all
WHERE po_header_id = l_document_id
AND shipment_type IN ('PRICE BREAK', 'STANDARD', 'PREPAYMENT'))
AND ad.entity_name = 'PO_SHIPMENTS') OR
--
(ad.pk2_value IN (SELECT item_id
FROM po_lines_all
WHERE po_header_id = l_document_id
AND TO_CHAR(PO_COMMUNICATION_PVT.getInventoryOrgId()) = ad.pk1_value
AND item_id IS NOT NULL) AND ad.entity_name = 'MTL_SYSTEM_ITEMS'))
AND d.document_id = ad.document_id
AND dcu.category_id = d.category_id
AND dcu.attachment_function_id = af.attachment_function_id
AND d.datatype_id = 6
AND af.function_name = 'PO_PRINTPO'
AND d.media_id = fl.file_id
AND dcu.enabled_flag = 'Y'
GROUP BY fl.file_name
HAVING COUNT(*)>1);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' No duplicate attachments');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Duplicate filenames found');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_error_flag:'||l_error_flag);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||'Exception when detecting duplicates');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' sqlerrm:'||sqlerrm);
SELECT nls_territory
INTO l_territory
FROM fnd_languages
WHERE nls_language = l_supp_lang;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_request_id:'||l_request_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Exception when submitting the request');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' fnd_message:'||l_msg);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Exception:'||sqlerrm);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_forward_to_username_response:'||l_forward_to_username_response);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_current_approver:'||l_current_approver);
InsertActionHistoryPoAme(
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_revision_num => l_revision_num,
p_employee_id => l_current_approver,
p_approval_group_id => l_approval_group_id,
p_action => 'FORWARD');
InsertActionHistoryPoAme(
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_revision_num => l_revision_num,
p_employee_id => l_current_approver,
p_approval_group_id => l_approval_group_id,
p_action => NULL);
SELECT wfi.item_type,
wfi.item_key,
wfn.recipient_role,
wfn.original_recipient
FROM wf_items wfi,
wf_item_activity_statuses wfias,
wf_notifications wfn
WHERE wfi.parent_item_key = itemkey
AND wfi.item_type = itemtype
AND wfias.item_type = wfi.item_type
AND wfias.item_key = wfi.item_key
AND wfias.activity_status = 'NOTIFIED'
AND wfias.notification_id IS NOT NULL
AND wfias.notification_id = wfn.notification_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_ame_transaction_id:'||l_ame_transaction_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_transaction_type:'||l_transaction_type);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' Index:'||TO_CHAR(i));
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' orig_system:'|| l_approver_list(i).orig_system);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' orig_system_id:'|| l_approver_list(i).orig_system_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' authority:'|| l_approver_list(i).authority);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' approval_status:'|| l_approver_list(i).approval_status);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' api_insertion:'|| l_approver_list(i).api_insertion);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' group_or_chain_id:'|| l_approver_list(i).group_or_chain_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' beatByFirstResponderStatus:'||ame_util.beatByFirstResponderStatus);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' oamGenerated:'||ame_util.oamGenerated);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_approver_group_id:'||l_approver_group_id);
AND l_approver_list(i).api_insertion = ame_util.oamGenerated
AND l_approver_list(i).group_or_chain_id = l_approver_group_id) THEN
l_orig_system := l_approver_list(i).orig_system;
SELECT person_id
INTO l_person_id
FROM ( SELECT person.person_id
FROM per_all_people_f person,
per_all_assignments_f asg,
wf_users wu
WHERE asg.position_id = l_orig_system_id
AND wu.orig_system = ame_util.perorigsystem
AND wu.orig_system_id = person.person_id
AND TRUNC(SYSDATE) BETWEEN person.effective_start_date AND NVL(person.effective_end_date, TRUNC( SYSDATE) )
AND person.person_id = asg.person_id
AND asg.primary_flag = 'Y'
AND asg.assignment_type IN ( 'E', 'C' )
AND ( person.current_employee_flag = 'Y' OR person.current_npw_flag = 'Y' )
AND asg.assignment_status_type_id NOT IN
(SELECT assignment_status_type_id
FROM per_assignment_status_types
WHERE per_system_status = 'TERM_ASSIGN' )
AND TRUNC(SYSDATE) BETWEEN asg.effective_start_date AND asg.effective_end_date
ORDER BY person.last_name )
WHERE ROWNUM = 1;
SELECT employee_id
INTO l_person_id
FROM fnd_user
WHERE user_id = l_orig_system_id
AND TRUNC(SYSDATE) BETWEEN start_date AND NVL(end_date, SYSDATE + 1);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' l_person_id:'||l_person_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_child_approver_empid:'||l_child_approver_empid);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_child_approver_groupid:'||l_child_approver_groupid);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress
||' l_child_wf_cur.item_key:'||l_child_wf_cur.item_key);
UpdateActionHistoryPoAme (
p_document_id => l_po_header_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => 'NO ACTION',
p_note => l_note,
p_current_approver => l_person_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' child item_key:'||l_child_wf_cur.item_key);
UpdateActionHistoryPoAme (
p_document_id => l_po_header_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => 'NO ACTION',
p_note => l_note,
p_current_approver => l_person_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
PROCEDURE update_resp_verf_failed(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'update_resp_verf_failed';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
END update_resp_verf_failed;
PROCEDURE update_resp_verf_failed_reject(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_progress VARCHAR2(3) := '000';
l_api_name VARCHAR2(500) := 'update_resp_verf_failed_reject';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT parent_item_type, parent_item_key
INTO l_parent_item_type, l_parent_item_key
FROM wf_items
WHERE item_type = itemtype
AND item_key = itemkey;
END update_resp_verf_failed_reject;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
PROCEDURE update_action_history_reminder(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_no_of_reminder NUMBER;
l_api_name VARCHAR2(500) := 'update_action_history_reminder';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
UpdateActionHistoryPoAme(
p_document_id => l_document_id,
p_draft_id => l_draft_id,
p_document_type => l_document_type,
p_document_subtype => l_document_subtype,
p_action => l_action,
p_note => NULL,
p_current_approver => l_current_approver);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END update_action_history_reminder;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress||' Start');
SELECT HR.PERSON_ID
INTO x_user_id
FROM FND_USER FND, PO_WORKFORCE_CURRENT_X HR
WHERE FND.USER_NAME = l_forward_to_username_response
AND FND.EMPLOYEE_ID = HR.PERSON_ID
AND ROWNUM = 1;
SELECT LEVEL,
item_type,
item_key,
end_date
FROM wf_items
START WITH item_type = t_item_type
AND item_key = t_item_key
CONNECT BY PRIOR item_type = parent_item_type
AND PRIOR item_key = parent_item_key
ORDER BY LEVEL DESC;
UPDATE po_headers_all
SET authorization_status = decode(approved_date, NULL, 'INCOMPLETE',
'REQUIRES REAPPROVAL'),
wf_item_type = p_item_type,
wf_item_key = p_item_key,
approved_flag = decode(approved_date, NULL, 'N', 'R'),
pending_signature_flag = 'N',
acceptance_required_flag = 'N',
acceptance_due_date = Null,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id,
last_update_date = sysdate,
ame_approval_id = DECODE(ame_transaction_type,
NULL,NULL,
po_ame_approvals_s.NEXTVAL)
WHERE po_header_id = p_document_id;
SELECT DISTINCT poh.employee_id
FROM po_action_history poh
WHERE poh.object_id = p_po_header_id
AND poh.employee_id IS NOT NULL
AND poh.sequence_num >= (SELECT MAX(sequence_num)
FROM po_action_history poh1
WHERE poh1.object_id = p_po_header_id
AND poh1.action_code = 'SUBMIT')
UNION
SELECT agent_id
FROM po_headers_all
WHERE po_header_id = p_po_header_id;
SELECT segment1
INTO l_document_number
FROM po_headers_all
WHERE po_header_id = p_document_id;
SELECT acceptance_id
INTO l_acceptance_id
FROM po_acceptances
WHERE po_header_id=p_document_id;
SELECT psc.user_name
INTO l_supp_contact_user_name
FROM po_supplier_contacts_val_v psc,
po_headers_all poh
WHERE psc.vendor_contact_id= poh.vendor_contact_id
AND psc.vendor_site_id= poh.vendor_site_id
AND po_header_id=p_document_id;
SELECT wf_item_type, wf_item_key
INTO l_item_type,l_item_key
FROM po_headers_all
WHERE po_header_id = p_document_id;
p_message => 'Authorization status update complete' );
UpdateActionHistoryPoAme(
p_document_id => p_document_id,
p_draft_id => p_draft_id,
p_document_type => p_document_type,
p_document_subtype => p_document_sub_type,
p_action => 'NO ACTION',
p_note => l_note,
p_current_approver => NULL);
p_message => 'Updated the existing NULL actions with NO ACTION');
InsertActionHistoryPoAme (
p_document_id => p_document_id,
p_draft_id => p_draft_id,
p_document_type => p_document_type,
p_document_subtype => p_document_sub_type,
p_revision_num => p_revision_num,
p_employee_id => p_current_employee_id,
p_approval_group_id => NULL,
p_action => 'WITHDRAW',
p_note => p_note);
p_message => 'Inserted WITHDRAW action in action history');
SELECT nvl(SEND_WITHDRW_NOTF_FLAG,'N')
INTO l_send_notf_flag
FROM po_doc_style_headers ds,
po_headers_all poh
WHERE poh.po_header_id = p_document_id
AND poh.style_id = ds.style_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' 001 ');
ame_api2.updateApprovalStatus ( applicationIdIn => applicationId,
transactionIdIn => l_ame_transaction_id,
transactionTypeIn => l_transaction_type,
approverIn => g_next_approvers(l_approver_index),
updateItemIn => TRUE);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||' 002 :'||' updated ame for '||
g_next_approvers(l_approver_index).name || ' with null status');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' return e_signer_flag=' || e_signer_flag);
SELECT person_id , full_name
INTO l_next_approver_id, l_next_approver_name
FROM ( SELECT person.person_id , person.full_name
FROM per_all_people_f person ,
per_all_assignments_f asg ,
wf_users wu
WHERE asg.position_id = ApproverList(l_approver_index).orig_system_id
AND wu.orig_system = ame_util.perorigsystem
AND wu.orig_system_id = person.person_id
AND TRUNC (sysdate) BETWEEN person.effective_start_date AND NVL (person.effective_end_date ,TRUNC (sysdate))
AND person.person_id = asg.person_id
AND asg.primary_flag = 'Y'
AND asg.assignment_type IN ('E','C')
AND ( person.current_employee_flag = 'Y' OR person.current_npw_flag = 'Y' )
AND asg.assignment_status_type_id NOT IN
( SELECT assignment_status_type_id
FROM per_assignment_status_types
WHERE per_system_status = 'TERM_ASSIGN'
)
AND TRUNC (sysdate) BETWEEN asg.effective_start_date AND asg.effective_end_date
ORDER BY person.last_name )
WHERE ROWNUM = 1;
SELECT employee_id
INTO l_next_approver_id
FROM fnd_user
WHERE user_id = ApproverList(l_approver_index).orig_system_id
AND TRUNC (sysdate) BETWEEN start_date AND NVL (end_date ,sysdate + 1);
SELECT displayed_field
INTO l_approver_category
FROM po_lookup_codes
WHERE lookup_type = 'PO_APPROVER_TYPE'
AND lookup_code = l_approver_category;
-- Insert record in x_approver_tab
x_approver_tab.extend;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' 001 ');
SELECT displayed_field
INTO l_response_code
FROM Po_Lookup_Codes
WHERE Lookup_Type = 'ERECORD_RESPONSE'
AND Lookup_Code = l_esigner_response;
SELECT displayed_field
INTO l_reason_code
FROM Po_Lookup_Codes
WHERE Lookup_Type = 'ERECORD_REASON'
AND Lookup_Code = 'ERES_REASON';
SELECT displayed_field
INTO l_signer_type
FROM Po_Lookup_Codes
WHERE Lookup_Type = 'ERECORD_SIGNER_TYPE'
AND Lookup_Code = Decode(l_signer,'BUYER','CUSTOMER');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' 002 ');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' l_response_code ' || l_response_code
|| ' l_reason_code' || l_reason_code || ' l_signer_type' || l_signer_type || ' l_event_name' || l_event_name
|| ' l_requester' ||l_requester || ' l_user_name' || l_user_name || ' l_notif_id ' || l_notif_id) ;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' 003');
PO_WF_DEBUG_PKG.INSERT_DEBUG(itemtype, itemkey, 'End erecords_exception:PO_AME_WF_PVT.CREATE_ERECORD ');
PO_WF_DEBUG_PKG.INSERT_DEBUG(itemtype, itemkey, 'ERROR RETURNED '||l_msg_data || 'error is ' || SQLERRM || ' code is ' || SQLCODE);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, 'PO_AME_WF_PVT.check_for_esigner_exists: ' || l_esigner_exists);
PROCEDURE update_pending_signature(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
p_po_header_id IN NUMBER)
IS
l_api_name VARCHAR2(100) := 'update_pending_signature';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 001');
UPDATE po_headers_all
SET pending_signature_flag='E'
WHERE po_header_id = p_po_header_id
AND NVL(acceptance_required_flag,'N') <>'S';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_log_head || ' no os rows updated' || SQL%ROWCOUNT);
END update_pending_signature;
PROCEDURE update_auth_status_approve(
p_document_id IN NUMBER,
p_item_type IN VARCHAR2,
p_item_key IN VARCHAR2)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
l_api_name VARCHAR2(500) := 'update_auth_status_approve';
PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key, l_log_head || ' 001');
PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key, l_log_head || ' 002 Updating status for Userid-' || l_user_id
|| ' LoginId-' || l_login_id || ' and DocumentId' || p_document_id);
UPDATE po_headers poh
SET poh.authorization_status = po_document_action_pvt.g_doc_status_approved
,poh.approved_flag = 'Y'
,poh.approved_date = sysdate
,poh.last_update_date = sysdate
,poh.last_updated_by = l_user_id
,poh.last_update_login = l_login_id
,poh.pending_signature_flag = 'N'
,poh.acceptance_required_flag = 'N'
,acceptance_due_date = Null
WHERE poh.po_header_id = p_document_id;
PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key, l_log_head || ' 003 : After updating po_headers_all ');
UPDATE po_line_locations_all poll
SET poll.approved_flag = 'Y'
,poll.approved_date = sysdate
,poll.last_update_date = sysdate
,poll.last_updated_by = l_user_id
,poll.last_update_login = l_login_id
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND nvl (poll.approved_flag,'N') <> 'Y';
PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key, l_log_head || ' After updating po_line_locations_all' );
END update_auth_status_approve;
PROCEDURE update_auth_status_esign(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout OUT NOCOPY VARCHAR2)
IS
l_document_id NUMBER;
l_api_name VARCHAR2(500) := 'update_pending_signature';
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 001');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 002 Updating status DocumentId' || l_document_id);
update_auth_status_approve(
p_document_id => l_document_id,
p_item_type => itemtype,
p_item_key => itemkey);
PO_DELREC_PVT.create_update_delrec (
p_api_version => 1.0,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_action => 'APPROVE',
p_doc_type => l_document_type,
p_doc_subtype => l_document_subtype,
p_doc_id => l_document_id,
p_line_id => NULL,
p_line_location_id => NULL);
SELECT max(action_date)
INTO l_acceptance_date
FROM PO_ACCEPTANCES
WHERE Po_Header_Id = l_document_id
AND Revision_Num = l_revision_num
AND Signature_Flag = 'Y'
AND ACCEPTING_PARTY IN ('B','S')
AND ACCEPTED_FLAG= 'Y';
PO_CONTERMS_WF_PVT.UPDATE_CONTRACT_TERMS(
p_po_header_id => l_document_id,
p_signed_date => l_acceptance_date,
x_return_status => l_return_status,
x_msg_data => l_msg_data,
x_msg_count => l_msg_count);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' in binding excpetion with error messsage ' || x_error_msg);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head||':'||l_progress);
END update_auth_status_esign;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 001');
SELECT wf_item_key
INTO l_po_itemkey
FROM po_headers_all poh
WHERE poh.po_header_id = l_document_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 002 result : ' || l_result);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 001 ');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' l_esigners_exists ' || l_esigner_exists);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' l_esigners_exists ' || l_esigner_exists);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 001 ');
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' supressing approver name ' || l_approver_list(l_approver_index).name);
PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey, l_log_head || ' 001 ');