DBA Data[Home] [Help]

APPS.PO_DRAFT_MERGE_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 12

/* Bug 14046925 : Declaration of global varaibles for tracking error code in UPDATE_AWARD_WITH_MOD_VALUES and MergeReserve_Autonomous */
g_action varchar2(1000) := null;
Line: 53

PROCEDURE update_par_line_status(itemtype IN VARCHAR2,
                                 itemkey IN VARCHAR2,
                                 p_document_id IN NUMBER,
                                 p_draft_id IN NUMBER);
Line: 59

PROCEDURE update_delivery_event_attr(
   p_document_id        IN         NUMBER
,  p_draft_id           IN         NUMBER
);
Line: 88

               delete_attachments(entity_name,
              pk1,
              '',
              '',
              '',
              '',
	      'N',
	       NULL);
Line: 128

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));
Line: 139

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));
Line: 160

	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));
Line: 243

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 247

      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'));
Line: 261

	  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);
Line: 270

          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'));
Line: 298

             PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 303

             PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 308

             PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 314

          PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 320

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 324

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;
Line: 333

    UPDATE      po_drafts
    SET         mod_effective_date = sysdate
    WHERE       draft_id = p_draft_id
    AND         mod_effective_date is NULL;
Line: 340

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);
Line: 352

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: Start: 01';
Line: 353

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 363

    POR_AME_REQ_WF_PVT.update_action_history_approve(
				itemtype,
				itemkey,
				actid,
				funcmode,
				resultout);
Line: 370

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: End';
Line: 371

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 376

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: Exception';
Line: 377

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 394

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 405

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 411

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 416

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);
Line: 427

    x_progress := 'PO_DRAFT_MERGE_PKG.DELETE_PDF_ATTACHMENTS: Start: 01';
Line: 428

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 438

    x_progress := 'PO_DRAFT_MERGE_PKG.DELETE_PDF_ATTACHMENTS: End';
Line: 439

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 444

    x_progress := 'PO_DRAFT_MERGE_PKG.DELETE_PDF_ATTACHMENTS: Exception';
Line: 445

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 450

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);
Line: 461

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: Start: 01';
Line: 462

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 473

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: calling POR_AME_REQ_WF_PVT.update_action_history_reject ';
Line: 474

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 476

	x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: calling PO_REQAPPROVAL_ACTION.reject_doc';
Line: 477

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 478

    POR_AME_REQ_WF_PVT.update_action_history_reject(
				itemtype,
				itemkey,
				actid,
				funcmode,
				resultout);
Line: 492

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_MERGE: End';
Line: 493

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: End';
Line: 494

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 499

    x_progress := 'PO_DRAFT_MERGE_PKG.INSERT_ACT_HIST_REJECT: Exception';
Line: 500

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 513

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);
Line: 549

	savepoint UPDATE_AWARD_MOD_VALUES_SP;  -- Bug 14046925 : Adding savepoint
Line: 551

	x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: Start: 01';
Line: 552

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 577

          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 ;
Line: 591

             PO_REQAPPROVAL_ACTION.InsertHistForOwnerApprove(itemtype, itemkey,
                        l_draft_id, l_document_type, 'MODIFICATION');
Line: 609

            PO_REQAPPROVAL_ACTION.InsertHistForOwnerApprove(itemtype, itemkey,
                        l_document_id, l_document_type, l_document_subtype);
Line: 617

    po_wf_debug_pkg.Insert_debug(itemtype,itemkey, x_progress );
Line: 635

    po_wf_debug_pkg.Insert_debug(itemtype,itemkey,x_progress );
Line: 640

			 SELECT TEXT_LINE into g_error_message FROM po_online_report_text_gt WHERE  online_report_id = l_online_report_id
			 and rownum =1;
Line: 642

			 po_wf_debug_pkg.Insert_debug(itemtype,itemkey, g_action || g_error_message );
Line: 650

        	po_wf_debug_pkg.Insert_debug(itemtype,itemkey, x_progress );
Line: 662

        po_wf_debug_pkg.Insert_debug(itemtype,itemkey, x_progress );
Line: 667

          x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES:  ' || g_error_message;
Line: 668

	         PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 683

    ROLLBACK to UPDATE_AWARD_MOD_VALUES_SP;  -- Rolling back to savepoint in case of any errors
Line: 684

    x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: Exception';
Line: 685

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 709

End UPDATE_AWARD_WITH_MOD_VALUES;
Line: 721

        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;
Line: 730

        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;
Line: 760

   PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 764

        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;
Line: 932

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 953

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 960

			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;
Line: 969

		PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 974

	PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 981

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1018

PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'MergeReserve_Autonomous : Start');
Line: 1021

    /*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';
Line: 1023

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1031

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1035

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1049

          p_delete_processed_draft => FND_API.G_FALSE ,
          p_acceptance_action => NULL,
          x_return_status => l_return_status,
          p_caller => 'MERGE');
Line: 1055

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1059

          PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
Line: 1066

	    g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : update_mod_approved_date';
Line: 1067

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1068

        update_mod_approved_date(p_draft_id => p_draft_id,
                                p_document_id => p_document_id);
Line: 1073

        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;
Line: 1079

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1093

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
Line: 1096

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
Line: 1102

           PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_error_message);
Line: 1109

	      PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1116

          PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1125

              PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, x_progress);
Line: 1128

		  g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : PO_DRAFTS_PVT.update_revnum_headers_ext';
Line: 1129

	      PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1130

          PO_DRAFTS_PVT.update_revnum_headers_ext(p_draft_id =>p_draft_id,
                                            p_po_header_id  =>P_Document_Id);
Line: 1136

		g_action := 'PO_DRAFT_MERGE_PKG.MergeReserve_Autonomous : delete_entity_locks';
Line: 1137

		PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1138

        delete_entity_locks(p_draft_id => p_draft_id
          ,x_return_status => l_return_status);
Line: 1142

          x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: Deleting entity locks failed';
Line: 1143

          PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1147

        x_progress := 'PO_DRAFT_MERGE_PKG.UPDATE_AWARD_WITH_MOD_VALUES: deleting entity locks successful';
Line: 1148

        PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1152

		PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1166

			PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_error_message);
Line: 1171

		PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1194

          po_wf_debug_pkg.Insert_debug(itemtype,itemkey,' Skip Reserve Call, as Encumbrance is Not supported for CLM Agreements');
Line: 1197

          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||'.');
Line: 1199

		  PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1213

          po_wf_debug_pkg.Insert_debug(itemtype,itemkey,x_progress);
Line: 1218

				SELECT TEXT_LINE into g_error_message FROM po_online_report_text_gt WHERE  online_report_id = x_online_report_id
				and rownum=1;
Line: 1227

	PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_action);
Line: 1242

		PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,g_error_message);
Line: 1249

          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;
Line: 1261

          update_delivery_event_attr(
            p_document_id => p_document_id,
            p_draft_id => p_draft_id);
Line: 1267

       	-- 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);
Line: 1277

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1285

	PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1293

	PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1314

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1327

		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;
Line: 1349

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1403

  po_wf_debug_pkg.Insert_debug(itemtype, itemkey, x_progress);
Line: 1406

      SELECT 'Y'
      INTO   l_is_mod_document
      FROM   po_drafts
      WHERE  draft_id = l_draft_id
             AND draft_type = 'MOD';
Line: 1414

		PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 1422

             po_wf_debug_pkg.Insert_debug(itemtype, itemkey, x_progress);
Line: 1446

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;
Line: 1461

END delete_entity_locks;
Line: 1474

  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'
                      );
Line: 1488

  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'
                      );
Line: 1516

  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'
  );
Line: 1542

   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'
  );
Line: 1587

   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'
                          );
Line: 1602

   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'
                       );
Line: 1631

  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'
  );
Line: 1655

  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'
  );
Line: 1702

   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'
                           );
Line: 1717

   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'
                       );
Line: 1745

   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'
  );
Line: 1768

   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'
  );
Line: 1815

  UPDATE PO_DRAFTS
  SET status = 'COMPLETED'
  WHERE draft_id = p_draft_id;
Line: 1819

  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;
Line: 1827

  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 ;
Line: 1838

    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';
Line: 1854

    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,
        '' );
Line: 1924

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_progress);
Line: 1935

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,l_progress);
Line: 1951

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';
Line: 1959

PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'update_par_line_status start');
Line: 1962

  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;
Line: 1972

 PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'Exception in update_par_line_status - ' || sqlerrm);
Line: 1976

PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'Is PAR Enabled : ' || l_is_par_enabled );
Line: 1980

  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;
Line: 1985

  PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'No of PAR Lines updated : ' || SQL%ROWCOUNT);
Line: 1989

PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'update_par_line_status successful');
Line: 1993

   PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,'Exception in update_par_line_status - ' || sqlerrm);
Line: 1995

END update_par_line_status;
Line: 1999

 * 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;
Line: 2016

  d_module          VARCHAR2(70) := 'po.plsql.PO_DOCUMENT_ACTION_UTIL.update_delivery_event_attr';
Line: 2032

    SELECT clm_effective_date
    INTO   l_effective_date
    FROM   po_headers_all
    WHERE  po_header_id = p_document_id;
Line: 2041

    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;
Line: 2064

  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';
Line: 2086

    PO_LOG.stmt(d_module, d_progress, 'Updated Need By Date in po_line_locations_draft_all - No of rows updated :' , SQL%ROWCOUNT);
Line: 2089

  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') );
Line: 2117

    PO_LOG.stmt(d_module, d_progress, 'Updated Need By Date in po_line_locations_all- No of rows updated :' , SQL%ROWCOUNT);
Line: 2127

  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';
Line: 2150

    PO_LOG.stmt(d_module, d_progress, 'Updated Promised in po_line_locations_draft_all- No of rows updated :' , SQL%ROWCOUNT);
Line: 2153

  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') );
Line: 2182

    PO_LOG.stmt(d_module, d_progress, 'Updated Promised in po_line_locations_all- No of rows updated :' , SQL%ROWCOUNT);
Line: 2192

  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';
Line: 2214

    PO_LOG.stmt(d_module, d_progress, 'Updated POP Start Date in po_line_locations_draft_all - No of rows updated :' , SQL%ROWCOUNT);
Line: 2217

  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') );
Line: 2245

    PO_LOG.stmt(d_module, d_progress, 'Updated POP Start Date in po_line_locations_all - No of rows updated :' , SQL%ROWCOUNT);
Line: 2254

  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';
Line: 2276

    PO_LOG.stmt(d_module, d_progress, 'Updated POP End Date in po_line_locations_draft_all - No of rows updated :' , SQL%ROWCOUNT);
Line: 2279

  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') );
Line: 2307

    PO_LOG.stmt(d_module, d_progress, 'Updated POP End Date in po_line_locations_all - No of rows updated :' , SQL%ROWCOUNT);
Line: 2311

  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';
Line: 2353

    PO_LOG.stmt(d_module, d_progress, 'Updated POP End Date in po_line_locations_archive_all - No of rows updated :' , SQL%ROWCOUNT);
Line: 2361

      PO_LOG.stmt(d_module, d_progress, 'Exception in update_delivery_event_attr ' || sqlerrm);
Line: 2366

END update_delivery_event_attr;
Line: 2379

 * 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;
Line: 2402

  PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 2413

  PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 2422

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);