The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* Bug 14046925 : Declaration of global varaibles for tracking error code in UPDATE_AWARD_WITH_MOD_VALUES and MergeReserve_Autonomous */
g_action varchar2(1000) := null;
PROCEDURE update_par_line_status(itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
p_document_id IN NUMBER,
p_draft_id IN NUMBER);
PROCEDURE update_delivery_event_attr(
p_document_id IN NUMBER
, p_draft_id IN NUMBER
);
delete_attachments(entity_name,
pk1,
'',
'',
'',
'',
'N',
NULL);
select pld.po_line_id as po_line_id
from po_headers_draft_all phd,
po_lines_draft_all pld
where phd.draft_id = p_draft_id
and phd.po_header_id = pld.po_header_id
and exists (select 1
from fnd_attached_documents
where entity_name = 'PO_LINES'
and pk1_value = to_char(pld.po_line_id) || '-' || to_char(p_draft_id));
select plld.po_line_id as po_line_id,
plld.line_location_id as line_location_id
from po_headers_draft_all phd,
po_line_locations_draft_all plld
where phd.draft_id = p_draft_id
and phd.po_header_id = plld.po_header_id
and exists (select 1
from fnd_attached_documents
where entity_name = 'PO_SHIPMENTS'
and pk1_value = to_char(plld.line_location_id) || '-' || to_char(p_draft_id));
select 'Y'
into l_header_attach_exist
from dual
where exists (select 'header attachments exist'
from fnd_attached_documents
where entity_name = 'PO_HEADERS'
and pk1_value = to_char(p_document_id) || '-' || to_char(p_draft_id));
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
select 'Y'
into l_mod_attach_exist
from dual
where exists (select 'attachments exist for mod'
from fnd_attached_documents
where pk1_value LIKE '%-'|| to_char(p_draft_id)
and entity_name in ('PO_HEADERS','PO_HEADERS_DEL','PO_LINES','PO_LINES_DEL','PO_SHIPMENTS','PO_SHIPMENTS_DEL'));
SELECT 'Y'
INTO l_attach_with_orig_attach_id
FROM DUAL
WHERE EXISTS (SELECT 'mod attachments exist with orig attach id not null'
FROM fnd_attached_documents
WHERE pk1_value LIKE '%-'|| to_char(p_draft_id)
AND entity_name in ('PO_HEADERS','PO_HEADERS_DEL','PO_LINES','PO_LINES_DEL','PO_SHIPMENTS','PO_SHIPMENTS_DEL')
AND ORIG_ATTACH_DOC_ID IS NOT NULL);
SELECT 'Y'
INTO l_attach_locks_exist
FROM DUAL
WHERE EXISTS (SELECT 'attachment locks exist'
FROM po_entity_locks
WHERE lock_by_draft_id = p_draft_id
AND entity_name IN ('PO_HEADERS_ATTACH','PO_LINES_ATTACH','PO_LINE_LOCATIONS_ATTACH'));
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
procedure update_mod_approved_date(p_draft_id IN NUMBER,
p_document_id IN NUMBER)
IS
BEGIN
UPDATE po_headers_draft_all
SET approved_date = sysdate
WHERE draft_id = p_draft_id
AND po_header_id = p_document_id;
UPDATE po_drafts
SET mod_effective_date = sysdate
WHERE draft_id = p_draft_id
AND mod_effective_date is NULL;
procedure INSERT_ACT_HIST_MERGE(
itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2
)
is
x_progress varchar2(1000);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: Start: 01';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
POR_AME_REQ_WF_PVT.update_action_history_approve(
itemtype,
itemkey,
actid,
funcmode,
resultout);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: End';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: Exception';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
procedure DELETE_PDF_ATTACHMENTS(
itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2
)is
x_progress varchar2(1000);
x_progress := 'PO_DRAFT_MERGE_PKG.DELETE_PDF_ATTACHMENTS: Start: 01';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.DELETE_PDF_ATTACHMENTS: End';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.DELETE_PDF_ATTACHMENTS: Exception';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
procedure INSERT_ACT_HIST_REJECT(
itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2
)is
x_progress varchar2(1000);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: Start: 01';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: calling POR_AME_REQ_WF_PVT.update_action_history_reject ';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: calling PO_REQAPPROVAL_ACTION.reject_doc';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
POR_AME_REQ_WF_PVT.update_action_history_reject(
itemtype,
itemkey,
actid,
funcmode,
resultout);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: End';
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: End';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: Exception';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Procedure UPDATE_AWARD_WITH_MOD_VALUES(
itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out NOCOPY varchar2) is
l_control_action varchar2(30);
savepoint UPDATE_AWARD_MOD_VALUES_SP; -- Bug 14046925 : Adding savepoint
x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: Start: 01';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
SELECT fu.employee_id
INTO l_preparer_id
FROM fnd_user fu, PO_HEADERS_MERGE_V ph
WHERE fu.user_id = ph.OWNER_USER_ID
AND ph.po_header_id = l_document_id
AND ph.draft_id = l_draft_id ;
PO_REQAPPROVAL_ACTION.InsertHistForOwnerApprove(itemtype, itemkey,
l_draft_id, l_document_type, 'MODIFICATION');
PO_REQAPPROVAL_ACTION.InsertHistForOwnerApprove(itemtype, itemkey,
l_document_id, l_document_type, l_document_subtype);
po_wf_debug_pkg.Insert_debug(itemtype,itemkey, x_progress );
po_wf_debug_pkg.Insert_debug(itemtype,itemkey,x_progress );
SELECT TEXT_LINE into g_error_message FROM po_online_report_text_gt WHERE online_report_id = l_online_report_id
and rownum =1;
po_wf_debug_pkg.Insert_debug(itemtype,itemkey, g_action || g_error_message );
po_wf_debug_pkg.Insert_debug(itemtype,itemkey, x_progress );
po_wf_debug_pkg.Insert_debug(itemtype,itemkey, x_progress );
x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: ' || g_error_message;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
ROLLBACK to UPDATE_AWARD_MOD_VALUES_SP; -- Rolling back to savepoint in case of any errors
x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: Exception';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
End UPDATE_AWARD_WITH_MOD_VALUES;
select nvl(pld.control_action, 'NULL') as control_action,
pld.po_line_id as po_line_id
from po_headers_draft_all phd,
po_lines_draft_all pld
where phd.draft_id = l_draft_id
and phd.po_header_id = pld.po_header_id
and pld.control_action is not NULL;
select nvl(plld.control_action, 'NULL') as control_action,
plld.po_line_id as po_line_id,
plld.line_location_id as po_line_location_id
from po_headers_draft_all phd,
po_line_locations_draft_all plld
where phd.draft_id = l_draft_id
and phd.po_header_id = plld.po_header_id
and plld.control_action is not NULL;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
select phd.type_lookup_code,
nvl(phd.control_action, 'NULL'),
phd.po_header_id,
pd.mod_effective_date
into v_type_code,
l_control_Action,
p_document_id,
l_date
from po_headers_draft_all phd,
po_drafts pd
where phd.draft_id = l_draft_id
and phd.draft_id = pd.draft_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
SELECT clm_flag
INTO l_is_clm_document
FROM po_doc_style_headers psh,
po_headers_all poh
WHERE psh.style_id = poh.style_id
AND poh.po_header_id = l_document_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'MergeReserve_Autonomous : Start');
/*fed fields : update IDV total_amt_ordered for header and line and total qty ordered for line*/
g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : PO_DOCUMENT_ACTION_UTIL.upd_idv_qty_amt_hdr';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
p_delete_processed_draft => FND_API.G_FALSE ,
p_acceptance_action => NULL,
x_return_status => l_return_status,
p_caller => 'MERGE');
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : update_mod_approved_date';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
update_mod_approved_date(p_draft_id => p_draft_id,
p_document_id => p_document_id);
SELECT 'PURCHASING', TYPE_LOOKUP_CODE, STYLE_ID
INTO l_functional_area_code, l_document_type_code, l_document_style_id
FROM po_headers_all
WHERE PO_HEADER_ID = p_document_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_error_message);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : PO_DRAFTS_PVT.update_revnum_headers_ext';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
PO_DRAFTS_PVT.update_revnum_headers_ext(p_draft_id =>p_draft_id,
p_po_header_id =>P_Document_Id);
g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : delete_entity_locks';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
delete_entity_locks(p_draft_id => p_draft_id
,x_return_status => l_return_status);
x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: Deleting entity locks failed';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: deleting entity locks successful';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_error_message);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
po_wf_debug_pkg.Insert_debug(itemtype,itemkey,' Skip Reserve Call, as Encumbrance is Not supported for CLM Agreements');
po_wf_debug_pkg.Insert_debug(itemtype,itemkey,'Calling do Reserve with doctype: '||p_doc_type||' - sub: '||p_doc_subtype||'- document id: '||p_document_id||' - Ovrride: '||p_override_funds||'- Emp: '||p_employee_id||'.');
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
po_wf_debug_pkg.Insert_debug(itemtype,itemkey,x_progress);
SELECT TEXT_LINE into g_error_message FROM po_online_report_text_gt WHERE online_report_id = x_online_report_id
and rownum=1;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_error_message);
SELECT clm_flag
INTO l_is_clm_document
FROM po_doc_style_headers psh,
po_headers poh
WHERE psh.style_id = poh.style_id
AND poh.po_header_id = p_document_id;
update_delivery_event_attr(
p_document_id => p_document_id,
p_draft_id => p_draft_id);
-- Update those PAR Line status to PO_CREATED
IF p_draft_id <> -1 THEN
update_par_line_status(itemtype => itemtype,
itemkey => itemkey,
p_document_id => p_document_id,
p_draft_id => p_draft_id);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
SELECT uda_template_id
INTO l_uda_template_id
FROM po_headers_draft_all
WHERE po_header_id = l_po_hdr_id
AND draft_id = l_draft_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
po_wf_debug_pkg.Insert_debug(itemtype, itemkey, x_progress);
SELECT 'Y'
INTO l_is_mod_document
FROM po_drafts
WHERE draft_id = l_draft_id
AND draft_type = 'MOD';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
po_wf_debug_pkg.Insert_debug(itemtype, itemkey, x_progress);
PROCEDURE delete_entity_locks( p_draft_id IN NUMBER
,x_return_status IN OUT NOCOPY VARCHAR2)
IS
BEGIN
DELETE FROM po_entity_locks
WHERE lock_by_draft_id = p_draft_id;
END delete_entity_locks;
select fad.ORIG_ATTACH_DOC_ID , fd.datatype_id ,fad.attached_document_id
from fnd_attached_documents fad , fnd_documents fd
where fad.entity_name = p_entity_name
and fad.pk1_value = to_char(p_header_id) || '-' || to_char(p_draft_id)
AND fad.ORIG_ATTACH_DOC_ID IS NOT NULL
AND fd.document_id = fad.document_id
AND fad.category_id NOT IN (SELECT category_id
FROM fnd_document_categories_vl
WHERE application_id = 201 AND name = 'CUSTOM5340'
);
select fad.attached_document_id, fd.datatype_id , fad.ORIG_ATTACH_DOC_ID
from fnd_attached_documents fad , fnd_documents fd
where fad.entity_name = 'PO_HEADERS'
and fad.pk1_value = to_char(p_header_id) || '-' || to_char(p_draft_id)
AND fad.ORIG_ATTACH_DOC_ID IS NULL
AND fd.document_id = fad.document_id
AND fad.category_id NOT IN (SELECT category_id
FROM fnd_document_categories_vl
WHERE application_id = 201 AND name = 'CUSTOM5340'
);
fnd_attached_documents3_pkg.delete_row
( X_attached_document_id => l_rec.ORIG_ATTACH_DOC_ID,
X_datatype_id => l_rec.datatype_id,
delete_document_flag => 'Y'
);
fnd_attached_documents3_pkg.delete_row
( X_attached_document_id => l_rec.ORIG_ATTACH_DOC_ID,
X_datatype_id => l_rec.datatype_id,
delete_document_flag => 'Y'
);
select pld.po_line_id as po_line_id, fad.attached_document_id , fad.ORIG_ATTACH_DOC_ID ,fd.datatype_id
from fnd_attached_documents fad, po_lines_draft_all pld , fnd_documents fd
where pld.draft_id = p_draft_id
and fad.entity_name = p_entity_name
and fad.pk1_value = to_char(pld.po_line_id) || '-' || to_char(p_draft_id)
AND ORIG_ATTACH_DOC_ID IS NOT NULL
AND fd.document_id = fad.document_id
AND fad.category_id NOT IN (SELECT category_id
FROM fnd_document_categories_vl
WHERE application_id = 201 AND name = 'CUSTOM5340'
);
select pld.po_line_id as po_line_id, fad.attached_document_id , fad.ORIG_ATTACH_DOC_ID ,fd.datatype_id
from fnd_attached_documents fad, po_lines_draft_all pld , fnd_documents fd
where pld.draft_id = p_draft_id
and fad.entity_name = 'PO_LINES'
and fad.pk1_value = to_char(pld.po_line_id) || '-' || to_char(p_draft_id)
AND ORIG_ATTACH_DOC_ID IS NULL
AND fd.document_id = fad.document_id
AND fad.category_id NOT IN (SELECT category_id
FROM fnd_document_categories_vl
WHERE application_id = 201 AND name = 'CUSTOM5340'
);
fnd_attached_documents3_pkg.delete_row
( X_attached_document_id => l_rec.ORIG_ATTACH_DOC_ID,
X_datatype_id => l_rec.datatype_id,
delete_document_flag => 'Y'
);
fnd_attached_documents3_pkg.delete_row
( X_attached_document_id => l_rec.ORIG_ATTACH_DOC_ID,
X_datatype_id => l_rec.datatype_id,
delete_document_flag => 'Y'
);
select plld.line_location_id as line_location_id, fad.attached_document_id , fad.ORIG_ATTACH_DOC_ID ,fd.datatype_id
from fnd_attached_documents fad, po_line_locations_draft_all plld , fnd_documents fd
where plld.draft_id = p_draft_id
and fad.entity_name = p_entity_name
and fad.pk1_value = to_char(plld.line_location_id) || '-' || to_char(p_draft_id)
AND ORIG_ATTACH_DOC_ID IS NOT NULL
AND fd.document_id = fad.document_id
AND fad.category_id NOT IN (SELECT category_id
FROM fnd_document_categories_vl
WHERE application_id = 201 AND name = 'CUSTOM5340'
);
select plld.line_location_id as line_location_id, fad.attached_document_id , fad.ORIG_ATTACH_DOC_ID ,fd.datatype_id
from fnd_attached_documents fad, po_line_locations_draft_all plld , fnd_documents fd
where plld.draft_id = p_draft_id
and fad.entity_name = 'PO_SHIPMENTS'
and fad.pk1_value = to_char(plld.line_location_id) || '-' || to_char(p_draft_id)
AND ORIG_ATTACH_DOC_ID IS NULL
AND fd.document_id = fad.document_id
AND fad.category_id NOT IN (SELECT category_id
FROM fnd_document_categories_vl
WHERE application_id = 201 AND name = 'CUSTOM5340'
);
fnd_attached_documents3_pkg.delete_row
( X_attached_document_id => l_rec.ORIG_ATTACH_DOC_ID,
X_datatype_id => l_rec.datatype_id,
delete_document_flag => 'Y'
);
fnd_attached_documents3_pkg.delete_row
( X_attached_document_id => l_rec.ORIG_ATTACH_DOC_ID,
X_datatype_id => l_rec.datatype_id,
delete_document_flag => 'Y'
);
UPDATE PO_DRAFTS
SET status = 'COMPLETED'
WHERE draft_id = p_draft_id;
UPDATE PO_LINES_DRAFT_ALL
SET draft_line_status = 'COMPLETED'
WHERE draft_id = p_draft_id
AND po_header_id = po_po_header_id
AND draft_line_status is NULL;
SELECT fu.employee_id
INTO l_preparer_id
FROM fnd_user fu, PO_HEADERS_MERGE_V ph
WHERE fu.user_id = ph.OWNER_USER_ID
AND ph.po_header_id = po_po_header_id
AND ph.draft_id = p_draft_id ;
SELECT sequence_num,
object_revision_num,
approval_path_id
INTO l_sequence_num,
l_object_rev_num,
l_approval_path_id
FROM po_action_history
WHERE object_id = p_draft_id
AND object_type_code = p_document_type
AND sequence_num = (SELECT max(sequence_num)
FROM po_action_history
WHERE object_id = p_draft_id
AND Object_Type_Code = p_document_type
AND object_sub_type_code = 'POST_AWARD_REQUEST')
AND object_sub_type_code = 'POST_AWARD_REQUEST';
INSERT into PO_ACTION_HISTORY
(object_id,
object_type_code,
object_sub_type_code,
sequence_num,
last_update_date,
last_updated_by,
creation_date,
created_by,
action_code,
action_date,
employee_id,
note,
object_revision_num,
last_update_login,
request_id,
program_application_id,
program_id,
program_update_date,
approval_path_id,
offline_code)
VALUES
(p_draft_id,
'PO', -- doc_type
'POST_AWARD_REQUEST', -- doc_subtype
l_sequence_num + 1,
sysdate,
fnd_global.user_id,
sysdate,
fnd_global.user_id,
'APPROVE', -- action_code
sysdate, --action_date
p_employee_id,
NULL,
l_object_rev_num,
fnd_global.login_id,
0,
0,
0,
'',
l_approval_path_id,
'' );
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_progress);
PROCEDURE update_par_line_status(itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
p_document_id IN NUMBER,
p_draft_id IN NUMBER)
IS
l_is_par_enabled VARCHAR2(1) := 'N';
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'update_par_line_status start');
SELECT par_enabled_flag
INTO l_is_par_enabled
FROM po_headers_draft_all pha,
po_doc_style_headers pds
WHERE pha.style_id = pds.style_id
AND pha.po_header_id = p_document_id
AND pha.draft_id = p_draft_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'Exception in update_par_line_status - ' || sqlerrm);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'Is PAR Enabled : ' || l_is_par_enabled );
UPDATE po_lines_draft_all
SET draft_line_status = 'PO_CREATED'
WHERE po_header_id = p_document_id
AND mod_draft_id = p_draft_id;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'No of PAR Lines updated : ' || SQL%ROWCOUNT);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'update_par_line_status successful');
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'Exception in update_par_line_status - ' || sqlerrm);
END update_par_line_status;
* Procedure: update_delivery_event_attr
* Requires:
* IN PARAMETERS:
* p_document_id: po_header_id
* p_draft_id: draft_id
*
* Effects: Updates need by date, promised date and POP dates
* as per the delivery event.
* Returns: None
*
*/
PROCEDURE update_delivery_event_attr(
p_document_id IN NUMBER
, p_draft_id IN NUMBER
)
IS
d_progress NUMBER;
d_module VARCHAR2(70) := 'po.plsql.PO_DOCUMENT_ACTION_UTIL.update_delivery_event_attr';
SELECT clm_effective_date
INTO l_effective_date
FROM po_headers_all
WHERE po_header_id = p_document_id;
SELECT pd.MOD_EFFECTIVE_DATE
INTO l_effective_date
FROM po_headers_all pha, po_drafts pd
WHERE pha.po_header_id = p_document_id
AND pha.po_header_id = pd.document_id
AND pd.draft_id = p_draft_id;
UPDATE po_line_locations_draft_all poll
SET poll.need_by_date = po_core_s3.Add_period(l_effective_date,
poll.clm_delivery_period,
poll.clm_delivery_period_uom)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.need_by_date IS NULL
AND poll.clm_period_perf_start_date IS NULL
AND poll.clm_delivery_period IS NOT NULL
AND poll.clm_delivery_period_uom IS NOT NULL
AND poll.clm_pop_duration IS NULL
AND poll.draft_id = p_draft_id
AND poll.change_status = 'NEW';
PO_LOG.stmt(d_module, d_progress, 'Updated Need By Date in po_line_locations_draft_all - No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_all poll
SET poll.need_by_date = po_core_s3.Add_period(l_effective_date,
poll.clm_delivery_period,
poll.clm_delivery_period_uom)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.need_by_date IS NULL
AND poll.clm_period_perf_start_date IS NULL
AND poll.clm_delivery_period IS NOT NULL
AND poll.clm_delivery_period_uom IS NOT NULL
AND poll.clm_pop_duration IS NULL
AND ( p_draft_id = -1
OR EXISTS (SELECT 'Y'
FROM po_line_locations_draft_all polld
WHERE polld.po_header_id = poll.po_header_id
AND polld.line_location_id =
poll.line_location_id
AND polld.draft_id = p_draft_id
AND polld.change_status = 'NEW') );
PO_LOG.stmt(d_module, d_progress, 'Updated Need By Date in po_line_locations_all- No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_draft_all poll
SET poll.promised_date = po_core_s3.Add_period(l_effective_date,
poll.clm_promise_period,
poll.clm_promise_period_uom),
poll.last_accept_date = po_core_s3.Add_period(l_effective_date,
poll.clm_promise_period,
poll.clm_promise_period_uom)
+ Nvl(DAYS_LATE_RECEIPT_ALLOWED,0)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.promised_date IS NULL
AND poll.clm_promise_period IS NOT NULL
AND poll.clm_promise_period_uom IS NOT NULL
AND poll.draft_id = p_draft_id
AND poll.change_status = 'NEW';
PO_LOG.stmt(d_module, d_progress, 'Updated Promised in po_line_locations_draft_all- No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_all poll
SET poll.promised_date = po_core_s3.Add_period(l_effective_date,
poll.clm_promise_period,
poll.clm_promise_period_uom),
poll.last_accept_date = po_core_s3.Add_period(l_effective_date,
poll.clm_promise_period,
poll.clm_promise_period_uom)
+ Nvl(DAYS_LATE_RECEIPT_ALLOWED,0)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.promised_date IS NULL
AND poll.clm_promise_period IS NOT NULL
AND poll.clm_promise_period_uom IS NOT NULL
AND ( p_draft_id = -1
OR EXISTS (SELECT 'Y'
FROM po_line_locations_draft_all polld
WHERE polld.po_header_id = poll.po_header_id
AND polld.line_location_id =
poll.line_location_id
AND polld.draft_id = p_draft_id
AND polld.change_status = 'NEW') );
PO_LOG.stmt(d_module, d_progress, 'Updated Promised in po_line_locations_all- No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_draft_all poll
SET poll.CLM_PERIOD_PERF_START_DATE = po_core_s3.Add_period(l_effective_date,
poll.clm_delivery_period,
poll.clm_delivery_period_uom)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.need_by_date IS NULL
AND poll.clm_period_perf_start_date IS NULL
AND poll.clm_delivery_period IS NOT NULL
AND poll.clm_delivery_period_uom IS NOT NULL
AND poll.clm_pop_duration IS NOT NULL
AND poll.clm_pop_duration_uom IS NOT NULL
AND poll.draft_id = p_draft_id
AND poll.change_status = 'NEW';
PO_LOG.stmt(d_module, d_progress, 'Updated POP Start Date in po_line_locations_draft_all - No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_all poll
SET poll.CLM_PERIOD_PERF_START_DATE = po_core_s3.Add_period(l_effective_date,
poll.clm_delivery_period,
poll.clm_delivery_period_uom)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.need_by_date IS NULL
AND poll.clm_period_perf_start_date IS NULL
AND poll.clm_delivery_period IS NOT NULL
AND poll.clm_delivery_period_uom IS NOT NULL
AND poll.clm_pop_duration IS NOT NULL
AND poll.clm_pop_duration_uom IS NOT NULL
AND ( p_draft_id = -1
OR EXISTS (SELECT 'Y'
FROM po_line_locations_draft_all polld
WHERE polld.po_header_id = poll.po_header_id
AND polld.line_location_id =
poll.line_location_id
AND polld.draft_id = p_draft_id
AND polld.change_status = 'NEW') );
PO_LOG.stmt(d_module, d_progress, 'Updated POP Start Date in po_line_locations_all - No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_draft_all poll
SET poll.CLM_PERIOD_PERF_END_DATE = po_core_s3.Add_period(poll.clm_period_perf_start_date,
poll.CLM_POP_DURATION,
poll.CLM_POP_DURATION_UOM)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.need_by_date IS NULL
AND poll.clm_period_perf_start_date IS NOT NULL
AND poll.clm_delivery_period IS NOT NULL
AND poll.clm_delivery_period_uom IS NOT NULL
AND poll.clm_pop_duration IS NOT NULL
AND poll.clm_pop_duration_uom IS NOT NULL
AND poll.draft_id = p_draft_id
AND poll.change_status = 'NEW';
PO_LOG.stmt(d_module, d_progress, 'Updated POP End Date in po_line_locations_draft_all - No of rows updated :' , SQL%ROWCOUNT);
UPDATE po_line_locations_all poll
SET poll.CLM_PERIOD_PERF_END_DATE = po_core_s3.Add_period(poll.clm_period_perf_start_date,
poll.CLM_POP_DURATION,
poll.CLM_POP_DURATION_UOM)
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND poll.need_by_date IS NULL
AND poll.clm_period_perf_start_date IS NOT NULL
AND poll.clm_delivery_period IS NOT NULL
AND poll.clm_delivery_period_uom IS NOT NULL
AND poll.clm_pop_duration IS NOT NULL
AND poll.clm_pop_duration_uom IS NOT NULL
AND ( p_draft_id = -1
OR EXISTS (SELECT 'Y'
FROM po_line_locations_draft_all polld
WHERE polld.po_header_id = poll.po_header_id
AND polld.line_location_id =
poll.line_location_id
AND polld.draft_id = p_draft_id
AND polld.change_status = 'NEW') );
PO_LOG.stmt(d_module, d_progress, 'Updated POP End Date in po_line_locations_all - No of rows updated :' , SQL%ROWCOUNT);
FOR poll in (SELECT poll.po_header_id,
poll.po_line_id,
poll.line_location_id,
poll.need_by_date,
poll.promised_date,
poll.last_accept_date,
poll.clm_period_perf_start_date,
poll.clm_period_perf_end_date
FROM po_line_locations_all poll
WHERE poll.po_header_id = p_document_id
AND poll.po_release_id IS NULL
AND EXISTS (SELECT 'ADC/ANA Delivery Event used'
FROM po_lines_all pol
WHERE pol.po_header_id = poll.po_header_id
AND pol.po_line_id = poll.po_line_id
AND pol.clm_delivery_event_code IN ( 'ADC', 'ANA' ))
AND ( p_draft_id = -1
OR EXISTS (SELECT 'Y'
FROM po_line_locations_draft_all polld
WHERE polld.po_header_id = poll.po_header_id
AND polld.line_location_id =
poll.line_location_id
AND polld.draft_id = p_draft_id
AND polld.change_status = 'NEW')))
LOOP
UPDATE po_line_locations_archive_all polla
SET polla.need_by_date = poll.need_by_date,
polla.promised_date = poll.promised_date,
polla.last_accept_date = poll.last_accept_date,
polla.clm_period_perf_start_date = poll.clm_period_perf_start_date,
polla.clm_period_perf_end_date = poll.clm_period_perf_end_date
WHERE polla.po_header_id = poll.po_header_id
AND polla.po_line_id = poll.po_line_id
AND polla.line_location_id = poll.line_location_id
AND polla.latest_external_flag = 'Y';
PO_LOG.stmt(d_module, d_progress, 'Updated POP End Date in po_line_locations_archive_all - No of rows updated :' , SQL%ROWCOUNT);
PO_LOG.stmt(d_module, d_progress, 'Exception in update_delivery_event_attr ' || sqlerrm);
END update_delivery_event_attr;
* Effects: Calls process_dod_awd_mod_doc_num to update doc number.
*
* Returns: None
*
*/
PROCEDURE docnum_post_apprvl_autonomous(
itemtype IN VARCHAR2
, itemkey IN VARCHAR2
, p_document_id IN NUMBER
, p_draft_id IN NUMBER
, p_uda_template_id IN NUMBER
)
IS
pragma AUTONOMOUS_TRANSACTION;
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);