DBA Data[Home] [Help]

APPS.PO_REQAPPROVAL_INIT1 SQL Statements

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

Line: 36

      SELECT REQUISITION_HEADER_ID,
        DESCRIPTION,
        AUTHORIZATION_STATUS,
        TYPE_LOOKUP_CODE,
        PREPARER_ID,
        SEGMENT1,
        CLOSED_CODE,
        EMERGENCY_PO_NUM,
        NVL(CONTRACTOR_REQUISITION_FLAG, 'N'),
        NVL(CONTRACTOR_STATUS, 'NULL'),
        NOTE_TO_AUTHORIZER
      FROM po_requisition_headers_all
      WHERE REQUISITION_HEADER_ID = p_requisition_header_id;
Line: 73

      p_update_sign VARCHAR2 DEFAULT 'N');
Line: 106

  PROCEDURE InsertActionHistSubmit
    (
      itemtype      VARCHAR2,
      itemkey       VARCHAR2,
      p_doc_id      NUMBER,
      p_doc_type    VARCHAR2,
      p_doc_subtype VARCHAR2,
      p_employee_id NUMBER,
      p_action      VARCHAR2,
      p_note        VARCHAR2,
      p_path_id     NUMBER,
      p_draft_id    NUMBER DEFAULT -1); -- Mod Project
Line: 127

  PROCEDURE UpdateActionHistory
    (
      p_doc_id      IN NUMBER,
      p_doc_type    IN VARCHAR2,
      p_doc_subtype IN VARCHAR2,
      p_action      IN VARCHAR2 ) ;
Line: 206

    PROCEDURE Insert_Acc_Rejection_Row
      (
        itemtype IN VARCHAR2,
        itemkey  IN VARCHAR2,
        actid    IN NUMBER,
        flag     IN VARCHAR2);
Line: 221

      * This procedure basically checks if archive_on_print option is selected, and if yes
      * call procedure PO_ARCHIVE_PO_SV.ARCHIVE_PO to archive the PO
      *************************************************************************************/
    PROCEDURE archive_po
      (
        p_document_id      IN NUMBER,
        p_document_type    IN VARCHAR2,
        p_document_subtype IN VARCHAR2);
Line: 271

      OPEN l_refcur FOR 'select distinct fu.user_name

from fnd_user fu

where fu.user_name in ('|| p_super_set || ')

and fu.user_name not in (' || p_subset || ')';
Line: 341

      SELECT role_name
      FROM
        (SELECT role_name
        FROM wf_user_roles
        WHERE role_name IN
          (SELECT role_name
          FROM wf_user_roles
          WHERE user_name IN
            (SELECT user_name FROM po_wf_user_tmp
            )
        AND role_name LIKE 'ADHOC%'
        AND NVL(EXPIRATION_DATE,SYSDATE+1) > SYSDATE
        GROUP BY role_name
        HAVING COUNT(role_name) = p_num_users
          )
        GROUP BY role_name
        HAVING COUNT(role_name) = p_num_users
        )
      WHERE ROWNUM < 2;
Line: 361

      DELETE po_wf_user_tmp; -- delete rows in the global temp table
Line: 378

        INSERT INTO po_wf_user_tmp
          (user_name
          ) VALUES
          (l_user_name
          );
Line: 395

      DELETE po_wf_user_tmp;
Line: 418

      SELECT function_id
      FROM fnd_form_functions
      WHERE function_name = p_function_name;
Line: 473

  OPEN l_refcur FOR 'select distinct fu.user_name

from fnd_user fu, fnd_user_resp_groups furg

where fu.user_id = furg.user_id

and furg.responsibility_id in

(

SELECT

responsibility_id

FROM fnd_responsibility fr

WHERE menu_id in

( SELECT fme.menu_id

FROM fnd_menu_entries fme

START WITH fme.function_id ='|| p_function_id ||'

CONNECT BY PRIOR menu_id = sub_menu_id

)

and (end_date is null or end_date > sysdate) '|| ' and fr.responsibility_id not in (select responsibility_id from fnd_resp_functions

where action_id= '|| p_function_id || ' and rule_type=' || l_f || ' )' || ' )

and fu.user_name in (' || p_namelist || ')

and (furg.end_date is null or furg.end_date > sysdate )' ;
Line: 669

    UpdateSourcingRule     VARCHAR2,
    MassUpdateReleases     VARCHAR2,
    RetroactivePriceChange VARCHAR2,
    OrgAssignChange        VARCHAR2,             -- GA FPI
    CommunicatePriceChange VARCHAR2,             -- 
    p_Background_Flag      VARCHAR2 DEFAULT 'N', -- 
    p_Initiator            VARCHAR2 DEFAULT NULL,
    p_xml_flag             VARCHAR2 DEFAULT NULL,
    /* Bug6708182 FPDS-NG ER. */
    /* Added */
    FpdsngFlag         VARCHAR2 DEFAULT 'N' ,
    p_source_type_code VARCHAR2 DEFAULT NULL
    /* End Added*/
    ,
    DraftId NUMBER DEFAULT -1 -- Mod Project
    ,p_bypass_checks_flag VARCHAR2 DEFAULT 'N'  /*Bug 11727653: BYPASSING MULTIPLE SUBMISSION CHECKS IN WORKFLOW*/
  )
IS
  l_responsibility_id        NUMBER;
Line: 765

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

    SELECT TO_CHAR(PO_WF_ITEMKEY_S.NEXTVAL) INTO l_seq_for_item_key FROM sys.dual;
Line: 817

      SELECT COUNT(*)
      INTO x_wf_created
      FROM wf_items
      WHERE item_type = l_itemtype
      AND item_key    = l_itemkey;
Line: 835

        PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,x_progress);
Line: 839

          UPDATE po_releases_all
          SET xml_flag         = 'Y',
            edi_processed_flag = 'N'
          WHERE po_release_id  = DocumentID;
Line: 844

          UPDATE po_headers_all
          SET xml_flag         = 'Y',
            edi_processed_flag = 'N'
          WHERE po_header_id   = DocumentID;
Line: 851

          UPDATE po_releases_all SET xml_flag = 'N' WHERE po_release_id = DocumentID;
Line: 853

          UPDATE po_headers_all SET xml_flag = 'N' WHERE po_header_id = DocumentID;
Line: 866

		      SELECT draft_type
      		INTO l_draft_type
      		FROM po_drafts
      		WHERE draft_id = DraftID;
Line: 876

        PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,x_progress);
Line: 883

        SELECT decode(authorization_status,
		                    'REJECTED', 0,
					                  ame_approval_id),
               ame_transaction_type
        INTO l_ame_approval_id,
             l_ame_transaction_type
        FROM po_headers_all
        WHERE po_header_id = DocumentID;
Line: 894

            select po_ame_approvals_s.nextval into l_ame_approval_id from dual;
Line: 895

            update po_headers_all
            set ame_approval_id = l_ame_approval_id,
			             ame_transaction_type = l_ame_transaction_type
            where  po_header_id = DocumentID;
Line: 903

      		SELECT decode(pd.status,
		                    'REJECTED', 0,
					                 phda.ame_approval_id),
               phda.ame_transaction_type
        INTO l_ame_approval_id,
             l_ame_transaction_type
        FROM po_headers_draft_all phda,
             po_drafts pd
        WHERE phda.po_header_id = DocumentID
              AND phda.draft_id = DraftID
              AND phda.draft_id = pd.draft_id;
Line: 916

            select po_ame_approvals_s.nextval into l_ame_approval_id from dual;
Line: 917

            update po_headers_draft_all
            set    ame_approval_id = l_ame_approval_id
            where  po_header_id = DocumentID
            and draft_id = DraftID;
Line: 948

	SELECT pov.vendor_name, pvs.vendor_site_code
        INTO l_vendor, l_vendor_site_code
        FROM po_vendors pov,
          po_headers poh,
          po_vendor_sites_all pvs
        WHERE pov.vendor_id    = poh.vendor_id
        AND poh.po_header_id   = DocumentId
        AND poh.vendor_site_id = pvs.vendor_site_id;
Line: 958

	SELECT MULTI_MOD_REQUEST_ID
	INTO l_multi_mod_req_id
	FROM PO_MULTI_MOD_DOCS
	WHERE DRAFT_ID = DraftID;
Line: 963

	SELECT MULTI_MOD_REQUEST_TYPE
	INTO l_multi_mod_req_type
	FROM PO_MULTI_MOD_REQUESTS
	WHERE MULTI_MOD_REQUEST_ID = l_multi_mod_req_id;
Line: 972

		SELECT pv.vendor_name, pvs.vendor_site_code
		INTO l_new_vendor, l_new_vendor_site_code
		FROM po_headers_draft_all phda,
		     po_vendors pv,
		     po_vendor_sites_all pvs
		WHERE draft_id = DraftID
		AND phda.vendor_id = pv.vendor_id
		AND phda.vendor_site_id = pvs.vendor_site_id;
Line: 1000

    PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,x_progress);
Line: 1004

      PO_WF_UTIL_PKG.SetItemAttrText( itemtype => l_itemtype , itemkey => l_itemkey , aname => 'INSERT_ACTION_HIST_FLAG' , avalue => 'N' );
Line: 1012

      PO_WF_UTIL_PKG.SetItemAttrText( itemtype => l_itemtype , itemkey => l_itemkey , aname => 'INSERT_ACTION_HIST_FLAG' , avalue => 'Y' );
Line: 1024

    PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,x_progress);
Line: 1046

    /* DEBUG */ PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,x_progress);
Line: 1078

      SELECT PRH.segment1
      INTO l_document_number
      FROM po_requisition_headers PRH
      WHERE PRH.requisition_header_id = DocumentID;
Line: 1097

          SELECT clm_document_number
          INTO l_clm_document_number
          FROM po_headers_all
          WHERE po_header_id = DocumentID;
Line: 1108

            SELECT modification_number
            INTO l_modification_number
            FROM po_drafts
            WHERE draft_id = DraftID;
Line: 1120

      PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,'l_modification_number: '||l_modification_number);
Line: 1132

        SELECT poh.acceptance_required_flag,
          poh.acceptance_due_date,
          poh.agent_id
        INTO x_acceptance_required_flag,
          x_acceptance_due_date,
          x_agent_id
        FROM po_headers poh
        WHERE poh.po_header_id = DocumentID;
Line: 1141

        SELECT por.acceptance_required_flag,
          por.acceptance_due_date,
          por.agent_id
        INTO x_acceptance_required_flag,
          x_acceptance_due_date,
          x_agent_id
        FROM po_releases por,
          po_headers_all poh -- 
        WHERE por.po_release_id = DocumentID
        AND por.po_header_id    = poh.po_header_id;
Line: 1159

      Added setItemAttrNumber() for 'BUYER_USER_ID' to be used later in PO_Mass_Update_PO_PVT.
      */
      BEGIN
                select user_id
                into emp_user_id
                from fnd_user
                where employee_id = x_agent_id
                and rownum = 1
                and sysdate < nvl(end_date, sysdate + 1);
Line: 1180

          SELECT global_agreement_flag
          INTO l_ga_flag
          FROM po_headers_all
          WHERE po_header_id = DocumentID;
Line: 1192

          SELECT revision_num,
            DECODE(TYPE_LOOKUP_CODE, 'BLANKET',FND_MESSAGE.GET_STRING('POS','POS_POTYPE_BLKT'),
			'CONTRACT',FND_MESSAGE.GET_STRING('POS','POS_POTYPE_CNTR'),
			'STANDARD',FND_MESSAGE.GET_STRING('POS','POS_POTYPE_STD'),
			'PLANNED',FND_MESSAGE.GET_STRING('POS','POS_POTYPE_PLND')),
            NVL(CONTERMS_EXIST_FLAG,'N'), --
            segment1                      -- Bug 3284628
          INTO l_revision_num,
            l_doc_display_name,
            l_conterms_exist_flag, --
            l_document_number      -- Bug 3284628
          FROM po_headers
          WHERE po_header_id = DocumentID;
Line: 1206

          SELECT 0,
            FND_MESSAGE.GET_STRING('PO','PO_MODIFICATION'),
            NVL(CONTERMS_EXIST_FLAG,'N'),
            segment1
          INTO l_revision_num,
            l_doc_display_name,
            l_conterms_exist_flag,
            l_document_number
          FROM po_headers_draft_all
          WHERE po_header_id = DocumentID
          AND draft_id       = DraftId;
Line: 1233

        SELECT POR.revision_num,
          POR.release_num,
          DECODE(POR.release_type, 'BLANKET', FND_MESSAGE.GET_STRING('POS','POS_POTYPE_BLKTR'), 'SCHEDULED',FND_MESSAGE.GET_STRING('POS','POS_POTYPE_PLNDR')),
          POH.segment1 -- Bug 3284628
        INTO l_revision_num,
          l_release_num,
          l_doc_display_name,
          l_document_number -- Bug 3284628
        FROM po_releases POR,
          po_headers_all POH -- 
        WHERE POR.po_release_id = DocumentID
        AND POR.po_header_id    = POH.po_header_id; -- JOIN
Line: 1294

        SELECT org_id
         INTO l_org_id
         FROM po_headers_all
        WHERE po_header_id = DocumentID;
Line: 1305

			  SELECT CLM_CONTRACT_OFFICER
				INTO l_clm_contract_officer
			   FROM po_headers_all
			   WHERE po_header_id = DocumentID;
Line: 1316

			  SELECT CLM_CONTRACT_OFFICER
				INTO l_clm_contract_officer
			   FROM po_drafts
			   WHERE draft_id = DraftID;
Line: 1340

      PO_WF_UTIL_PKG.SetItemAttrText ( itemtype => l_itemtype, itemkey => l_itemkey, aname => 'UPDATE_SOURCING_RULE', avalue => updatesourcingrule);
Line: 1343

      PO_WF_UTIL_PKG.SetItemAttrText ( itemtype => l_itemtype, itemkey => l_itemkey, aname => 'MASSUPDATE_RELEASES', avalue => MassUpdateReleases);
Line: 1358

          SELECT 'Y'
          INTO l_drop_ship_flag
          FROM dual
          WHERE EXISTS
            (SELECT 'Release DropShip Shipment Exists'
            FROM po_line_locations
            WHERE po_release_id = DocumentId
            AND drop_ship_flag  = 'Y'
            );
Line: 1368

          SELECT 'Y'
          INTO l_drop_ship_flag
          FROM dual
          WHERE EXISTS
            (SELECT 'PO DropShip Shipment Exists'
            FROM po_line_locations
            WHERE po_header_id = DocumentId
            AND drop_ship_flag = 'Y'
            );
Line: 1393

          SELECT NVL(consigned_consumption_flag, 'N') -- Bug 3318625
          INTO l_consigned_flag
          FROM po_releases_all
          WHERE po_release_id  = DocumentId;
Line: 1398

          SELECT NVL(consigned_consumption_flag, 'N')
          INTO l_consigned_flag
          FROM po_headers_all
          WHERE po_header_id = DocumentId;
Line: 1442

      SELECT PRH.segment1,
        PRH.federal_flag,
        PRH.revision_num,
        PRH.conformed_header_id
      INTO l_document_number,
        l_federal_flag,
        l_revision_num,
        l_conformed_header_id
      FROM po_requisition_headers PRH
      WHERE PRH.requisition_header_id = DocumentID;
Line: 1466

        SELECT pov.vendor_name,
          pvs.vendor_site_code
        INTO l_vendor,
          l_vendor_site_code
        FROM po_vendors pov,
          po_headers poh,
          po_vendor_sites_all pvs
        WHERE pov.vendor_id    = poh.vendor_id
        AND poh.po_header_id   = DocumentId
        AND poh.vendor_site_id = pvs.vendor_site_id;
Line: 1477

        SELECT pov.vendor_name,
          pvs.vendor_site_code
        INTO l_vendor,
          l_vendor_site_code
        FROM po_releases por,
          po_headers poh,
          po_vendors pov,
          po_vendor_sites_all pvs
        WHERE por.po_release_id = DocumentId
        AND por.po_header_id    = poh.po_header_id
        AND poh.vendor_id       = pov.vendor_id
        AND poh.vendor_site_id  = pvs.vendor_site_id;
Line: 1503

        SELECT hou.name
        INTO l_operating_unit
        FROM hr_organization_units hou
        WHERE hou.organization_id = x_orgid;
Line: 1576

      PO_WF_DEBUG_PKG.insert_debug(l_itemtype,l_itemkey,x_progress);
Line: 1611

        UPDATE po_releases
        SET AUTHORIZATION_STATUS = 'IN PROCESS',
          last_updated_by        = fnd_global.user_id,
          last_update_login      = fnd_global.login_id,
          last_update_date       = sysdate
        WHERE po_release_id      = DocumentID;
Line: 1619

          UPDATE po_headers
          SET AUTHORIZATION_STATUS = 'IN PROCESS',
            last_updated_by        = fnd_global.user_id,
            last_update_login      = fnd_global.login_id,
            last_update_date       = sysdate
          WHERE po_header_id       = DocumentID;
Line: 1626

          UPDATE po_drafts
          SET STATUS          = 'IN PROCESS',
            last_updated_by   = fnd_global.user_id,
            last_update_login = fnd_global.login_id,
            last_update_date  = sysdate
          WHERE draft_id      = DraftID;
Line: 1642

      PO_WF_DEBUG_PKG.insert_debug(itemtype,l_itemkey,x_progress);
Line: 1652

    PO_WF_DEBUG_PKG.insert_debug(itemtype,l_itemkey,x_progress);
Line: 1688

  l_update_req_url       VARCHAR2(1000);
Line: 1730

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

  SELECT CAN_APPROVER_MODIFY_DOC_FLAG
  INTO l_can_modify_flag
  FROM po_document_types
  WHERE DOCUMENT_TYPE_CODE = l_document_type
  AND DOCUMENT_SUBTYPE     = l_doc_subtype;
Line: 1888

        SELECT style_id
        INTO l_style_id
        FROM po_headers_all
        WHERE po_header_id = l_document_id;
Line: 1904

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

          l_edit_po_url := get_mod_url(p_po_header_id => l_document_id,p_draft_id => l_draft_id, p_doc_subtype => l_doc_subtype, p_mode => 'update');
Line: 1913

          l_edit_po_url := get_po_url(p_po_header_id => l_document_id, p_doc_subtype => l_doc_subtype, p_mode => 'update');
Line: 1915

        x_progress       := 'PO_REQAPPROVAL_INIT1.get_po_url update' || 'l_edit_po_url ::'|| l_edit_po_url;
Line: 1917

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

    l_update_req_url := l_edit_req_url;
Line: 1998

    wf_engine.SetItemAttrText ( itemtype => itemType, itemkey => itemkey, aname => 'REQ_UPDATE_URL' , avalue => l_update_req_url);
Line: 2024

    SELECT AUTHORIZATION_STATUS
    INTO l_authorization_status
    FROM po_requisition_headers_all
    WHERE REQUISITION_HEADER_ID = l_document_id;
Line: 2038

    SELECT DECODE(draft_id, -1, AUTHORIZATION_STATUS, STATUS),
      NVL(REVISION_NUM,0)
    INTO l_authorization_status,
      l_po_revision
    FROM po_headers_merge_v
    WHERE PO_HEADER_ID = l_document_id
    AND draft_id       = l_draft_id;
Line: 2062

    SELECT AUTHORIZATION_STATUS,
      NVL(REVISION_NUM,0)
    INTO l_authorization_status,
      l_po_revision
    FROM po_releases_all
    WHERE PO_RELEASE_ID         = l_document_id;
Line: 2109

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

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

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

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

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

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

  ** we want to set it to IN PROCESS and update the ITEMTYPE/ITEMKEY columns.
  ** If this is an upgrade to R11, then we need to update the ITEMTYPE/ITEMKEY columns
  ** Note that we only pickup docs is IN PROCESS or PRE-APPROVED in the upgrade step.
  */
  IF ( NVL(l_authorization_stat, 'INCOMPLETE') NOT IN ('IN PROCESS', 'PRE-APPROVED') ) THEN
    IF l_doc_type                                   = 'REQUISITION' THEN
      SetReqAuthStat(l_document_id, itemtype,itemkey,l_note, 'IN PROCESS');
Line: 2379

        SetModUpdateAfterCDGenFlag(l_draft_id);
Line: 2386

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

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

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

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

    SELECT NVL(authorization_status, 'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_REQUISITION_HEADERS
    WHERE requisition_header_id = l_doc_id;
Line: 2486

      SELECT NVL(status,'DRAFT')
      INTO l_auth_stat
      FROM po_drafts
      WHERE draft_id = l_draft_id;
Line: 2491

      SELECT NVL(authorization_status,'INCOMPLETE')
      INTO l_auth_stat
      FROM PO_HEADERS
      WHERE po_header_id = l_doc_id;
Line: 2501

    SELECT NVL(authorization_status,'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_RELEASES
    WHERE po_release_id = l_doc_id;
Line: 2515

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

  x_progress       := 'PO_REQAPPROVAL_INIT1.set_doc_to_originalstat: 03' || 'Update Action History' || 'Action Code = No Action';
Line: 2523

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

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

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

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

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

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

    SELECT NVL(authorization_status, 'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_REQUISITION_HEADERS
    WHERE requisition_header_id = l_doc_id;
Line: 2748

    SELECT NVL(authorization_status,'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_HEADERS
    WHERE po_header_id = l_doc_id;
Line: 2753

    SELECT NVL(authorization_status,'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_RELEASES
    WHERE po_release_id = l_doc_id;
Line: 2775

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

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

  **      then the action history would be wrongly updated.
  **
  **      Modifying the parameter l_employee_id to be passed to
  **      InsertActionHistSubmit() from PREPARER_ID to
  **      APPROVER_EMPID.
  **
  **      Also modified the SetReqHdrAttributes() to also set the
  **      PREPARER_USER_NAME and PREPARER_DISPLAY_NAME.
  **
  */
  l_employee_id := wf_engine.GetItemAttrNumber (itemtype => itemtype, itemkey => itemkey, aname => 'APPROVER_EMPID');
Line: 2862

  PO_REQAPPROVAL_INIT1.InsertActionHistSubmit(itemtype,itemkey,l_doc_id, l_doc_type, l_doc_subtype, l_employee_id, 'SUBMIT', l_note, l_path_id, l_draft_id);
Line: 2869

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

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

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

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

  SELECT NVL(fsp.reserve_at_completion_flag,'N')
  INTO l_reserve_at_compl
  FROM financials_system_parameters fsp;
Line: 3141

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

    PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,'l_reserve_at_compl=' || l_reserve_at_compl );
Line: 3154

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

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

  select wf_item_key
  from po_headers
  where po_header_id= p_header_id;
Line: 3208

    SELECT wf_item_key
    FROM po_headers_merge_v
    WHERE po_header_id= p_header_id
    AND draft_id      = p_draft_id;
Line: 3214

    SELECT wf_item_key
    FROM po_requisition_headers
    WHERE requisition_header_id= p_header_id;
Line: 3219

    SELECT wf_item_key FROM po_releases WHERE po_release_id= p_header_id;
Line: 3224

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

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

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

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

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

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

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

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

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

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

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

    SELECT acceptance_required_flag
    INTO l_acceptance_flag
    FROM po_headers_all
    WHERE po_header_Id   = l_document_id;
Line: 3596

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

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

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

  l_select BOOLEAN;
Line: 3777

        SELECT MAX(need_by_date)+180
        INTO l_expiration_date
        FROM po_line_locations
        WHERE po_header_id    = to_number(p_document_id)
        AND cancel_flag       = 'N';
Line: 3786

        SELECT MAX(need_by_date)+180
        INTO l_expiration_date
        FROM po_line_locations
        WHERE po_release_id   = to_number(p_document_id)
        AND cancel_flag       = 'N';
Line: 3798

        SELECT vendor_name
        INTO l_role_display_name
        FROM po_vendors
        WHERE vendor_id=l_vendor_id;
Line: 3911

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

      SELECT po_header_id
      INTO l_po_header_id
      FROM po_releases
      WHERE po_release_id = l_document_id;
Line: 3956

    SELECT poh.vendor_site_id,
      pvs.vendor_site_code,
      pvs.language, pv.vendor_name
    INTO l_vendor_site_id,
      l_vendor_site_code,
      l_vendor_site_lang, l_vendor_name
    FROM po_headers poh,
      po_vendor_sites pvs, po_vendors pv
    WHERE pvs.vendor_site_id = poh.vendor_site_id
    AND pv.vendor_id = poh.vendor_id
    AND poh.po_header_id     = l_po_header_id;
Line: 3975

      SELECT wfl.nls_language,
        wfl.nls_territory,
        wfl.code
      INTO l_adhocuser_lang,
        l_adhocuser_territory,
        l_lang_code
      FROM wf_languages wfl,
        fnd_languages_vl flv
      WHERE wfl.code       = flv.language_code
      AND flv.nls_language = l_vendor_site_lang;
Line: 3986

      SELECT wfl.nls_language,
        wfl.nls_territory,
        wfl.code
      INTO l_adhocuser_lang,
        l_adhocuser_territory,
        l_lang_code
      FROM wf_languages wfl,
        fnd_languages_vl flv
      WHERE wfl.code         = flv.language_code
      AND flv.installed_flag = 'B';
Line: 4005

        SELECT message_text
        INTO l_note
        FROM fnd_new_messages fm,
          fnd_languages fl
        WHERE fm.message_name = 'PO_PDF_EMAIL_TEXT'
        AND fm.language_code  = fl.language_code
        AND fl.nls_language   = l_vendor_site_lang;
Line: 4033

    SELECT COUNT(*)
    INTO l_performer_exists
    FROM wf_users
    WHERE name = l_po_email_performer;
Line: 4059

    SELECT COUNT(*)
    INTO l_performer_exists
    FROM wf_users
    WHERE name = l_po_email_performer_prof;
Line: 4077

    update_print_count(l_document_id,l_document_type);
Line: 4085

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

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

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

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

    SELECT NVL(authorization_status, 'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_REQUISITION_HEADERS
    WHERE requisition_header_id = l_doc_id;
Line: 4244

    SELECT NVL(authorization_status,'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_HEADERS
    WHERE po_header_id = l_doc_id;
Line: 4250

    SELECT NVL(authorization_status,'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_RELEASES
    WHERE po_release_id = l_doc_id;
Line: 4265

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

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

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

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

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

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

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

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

  SELECT default_rate_type INTO l_rate_type FROM po_system_parameters;
Line: 4516

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

    SELECT user_id
    INTO l_user_id
    FROM fnd_user
    WHERE user_name = l_approver_user_name;
Line: 4528

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

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

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

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

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

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

    SELECT DISPLAYED_FIELD
    FROM po_lookup_codes
    WHERE lookup_type='AUTHORIZATION STATUS'
    AND lookup_code  = p_auth_stat;
Line: 4655

    SELECT DISPLAYED_FIELD
    FROM po_lookup_codes
    WHERE lookup_type='DOCUMENT STATE'
    AND lookup_code  = p_closed_code;
Line: 4665

    SELECT type_name
    FROM po_document_types
    WHERE document_type_code = p_doc_type
    AND document_subtype     = p_doc_subtype;
Line: 4671

  select DISPLAYED_FIELD
  from po_lookup_codes
  where lookup_type='REQUISITION TYPE'
  and lookup_code = p_doc_subtype;
Line: 4687

    SELECT NVL(SUM(ROUND(DECODE(order_type_lookup_code, 'RATE', amount, 'FIXED PRICE', amount, quantity * unit_price),l_precision)) ,0)
    FROM po_requisition_lines
    WHERE requisition_header_id          = p_doc_id
    AND NVL(cancel_flag,'N')             = 'N'
    AND NVL(modified_by_agent_flag, 'N') = 'N';
Line: 4700

    SELECT NVL(SUM(nonrecoverable_tax), 0)
    FROM po_requisition_lines rl,
      po_req_distributions_all rd -- 
    WHERE rl.requisition_header_id          = p_doc_id
    AND rd.requisition_line_id              = rl.requisition_line_id
    AND NVL(rl.cancel_flag,'N')             = 'N'
    AND NVL(rl.modified_by_agent_flag, 'N') = 'N';
Line: 4710

    SELECT clm_mipr_type
    FROM po_requisition_headers
    WHERE requisition_header_id = p_doc_id
    AND NVL(cancel_flag,'N') = 'N';
Line: 4719

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

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

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

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

	 UPDATE po_headers_all
	   SET comm_rev_num = l_po_revision_num_curr
	 WHERE po_header_id = l_po_header_id;
Line: 4920

	 UPDATE po_releases_all
	   SET comm_rev_num = l_po_revision_num_curr
     WHERE po_release_id = l_po_header_id;
Line: 4960

  ** or 'PRE-APPROVED', therefore we should update the status to IN PROCESS.
  */
  /* Bug# 1894960: kagarwal
  ** Desc: Requisitons Upgraded from 10.7 fails to set the status of Requisiton
  ** to Pre-Approved.
  **
  ** Reason being that when the procedure SetReqAuthStat() is called to set the
  ** Requisiton status to Pre-Approved, the conditon
  ** "IF (note = 'UPGRADE_TO_R11')" do not set the authorization status causes
  ** the Requisiton to remain in the existing status.
  ** Hence the Upgraded Requisitons can never be set to 'Pre-Approved' status and
  ** the approval process will always return the Req with Notification
  ** "No Approver Found".
  **
  ** Whereas the reason for this condition was to not set the status of upgrade
  ** Reqs to IN PROCESS as it could have been PRE-APPROVED.
  **
  ** Changed the procedure SetReqAuthStat().
  **
  ** Modified the clause IF note = 'UPGRADE_TO_R11'
  **
  ** TO:
  **
  ** IF (note = 'UPGRADE_TO_R11' and p_auth_status = 'IN PROCESS') THEN
  **
  ** Now when the approval process will  call the procedure SetReqAuthStat()
  ** to set the Requisiton to 'Pre-Approved' status then it will go to the
  ** else part and set its authorization status to 'Pre-Approved'.
  */
  IF (note = 'UPGRADE_TO_R11' AND p_auth_status = 'IN PROCESS') THEN
    UPDATE po_requisition_headers
    SET WF_ITEM_TYPE            = itemtype,
      WF_ITEM_KEY               = itemkey,
      active_shopping_cart_flag = NULL,
      last_updated_by           = fnd_global.user_id,
      last_update_login         = fnd_global.login_id,
      last_update_date          = sysdate
    WHERE requisition_header_id = l_requisition_header_id;
Line: 4999

    UPDATE po_requisition_headers
    SET AUTHORIZATION_STATUS    = p_auth_status,
      WF_ITEM_TYPE              = itemtype,
      WF_ITEM_KEY               = itemkey,
      active_shopping_cart_flag = NULL,
      last_updated_by           = fnd_global.user_id,
      last_update_login         = fnd_global.login_id,
      last_update_date          = sysdate
    WHERE requisition_header_id = l_requisition_header_id;
Line: 5024

    p_update_sign VARCHAR2 DEFAULT 'N')
IS
  pragma AUTONOMOUS_TRANSACTION;
Line: 5039

  ** or 'PRE-APPROVED', therefore we should update the status to IN PROCESS.
  */
  IF p_update_sign            = 'Y' AND p_auth_status = 'PRE-APPROVED' THEN
    l_pending_signature_flag := 'Y';
Line: 5045

    UPDATE po_headers
    SET WF_ITEM_TYPE    = itemtype,
      WF_ITEM_KEY       = itemkey,
      last_updated_by   = fnd_global.user_id,
      last_update_login = fnd_global.login_id,
      last_update_date  = sysdate
    WHERE po_header_id  = l_po_header_id;
Line: 5055

      UPDATE po_headers
      SET AUTHORIZATION_STATUS = p_auth_status,
        WF_ITEM_TYPE           = itemtype,
        WF_ITEM_KEY            = itemkey,
        last_updated_by        = fnd_global.user_id,
        last_update_login      = fnd_global.login_id,
        last_update_date       = sysdate ,
        submit_date            = DECODE(p_auth_status, 'INCOMPLETE', to_date(NULL),submit_date) --
        ,
        pending_signature_flag = DECODE(l_pending_signature_flag, 'Y', DECODE(acceptance_required_flag, 'S', 'Y', 'N'), pending_signature_flag)
      WHERE po_header_id       = l_po_header_id;
Line: 5067

      UPDATE Po_Headers_Draft_all
      SET WF_ITEM_TYPE         = itemtype,
        WF_ITEM_KEY            = itemkey,
        last_updated_by        = fnd_global.user_id,
        last_update_login      = fnd_global.login_id,
        last_update_date       = sysdate,
        submit_date            = DECODE(p_auth_status, 'INCOMPLETE', to_date(NULL),submit_date) ,
        pending_signature_flag = DECODE(l_pending_signature_flag, 'Y', DECODE(acceptance_required_flag, 'S', 'Y', 'N'), pending_signature_flag)
      WHERE po_header_id       = l_po_header_id
      AND draft_id             = l_draft_id;
Line: 5077

      UPDATE Po_Drafts SET STATUS = p_auth_status WHERE draft_id = l_draft_id;
Line: 5105

  ** or 'PRE-APPROVED', therefore we should update the status to IN PROCESS.
  */
  IF note = 'UPGRADE_TO_R11' THEN
    UPDATE po_releases
    SET WF_ITEM_TYPE    = itemtype,
      WF_ITEM_KEY       = itemkey,
      last_updated_by   = fnd_global.user_id,
      last_update_login = fnd_global.login_id,
      last_update_date  = sysdate
    WHERE po_release_id = l_Release_header_id;
Line: 5116

    UPDATE po_releases
    SET AUTHORIZATION_STATUS = p_auth_status,
      WF_ITEM_TYPE           = itemtype,
      WF_ITEM_KEY            = itemkey,
      last_updated_by        = fnd_global.user_id,
      last_update_login      = fnd_global.login_id,
      last_update_date       = sysdate ,
      submit_date            = DECODE(p_auth_status, 'INCOMPLETE', to_date(NULL),submit_date) --
    WHERE po_release_id      = l_Release_header_id;
Line: 5144

  UPDATE po_requisition_headers
  SET WF_ITEM_TYPE            = itemtype,
    WF_ITEM_KEY               = itemkey,
    last_updated_by           = fnd_global.user_id,
    last_update_login         = fnd_global.login_id,
    last_update_date          = sysdate
  WHERE requisition_header_id = p_doc_id;
Line: 5168

  UPDATE po_headers
  SET WF_ITEM_TYPE    = itemtype,
    WF_ITEM_KEY       = itemkey,
    last_updated_by   = fnd_global.user_id,
    last_update_login = fnd_global.login_id,
    last_update_date  = sysdate ,
    submit_date       = sysdate --
  WHERE po_header_id  = p_doc_id;
Line: 5193

  UPDATE po_releases
  SET WF_ITEM_TYPE    = itemtype,
    WF_ITEM_KEY       = itemkey,
    last_updated_by   = fnd_global.user_id,
    last_update_login = fnd_global.login_id,
    last_update_date  = sysdate ,
    submit_date       = sysdate --
  WHERE po_release_id = p_doc_id;
Line: 5216

    SELECT NVL(can_preparer_approve_flag,'N')
    FROM po_document_types
    WHERE document_type_code = p_document_type_code
    AND document_subtype     = p_document_subtype;
Line: 5250

    SELECT org_id
    FROM po_requisition_headers_all
    WHERE requisition_header_id = document_id;
Line: 5255

    SELECT org_id FROM po_headers_all WHERE po_header_id = document_id;
Line: 5258

    SELECT org_id FROM po_releases_all WHERE po_release_id = document_id;
Line: 5296

    SELECT ORIG_SYSTEM_ID
    FROM wf_users WF
    WHERE WF.name        = p_username
    AND ORIG_SYSTEM NOT IN ('HZ_PARTY', 'POS', 'ENG_LIST', 'CUST_CONT');
Line: 5335

PROCEDURE InsertActionHistSubmit
  (
    itemtype      VARCHAR2,
    itemkey       VARCHAR2,
    p_doc_id      NUMBER,
    p_doc_type    VARCHAR2,
    p_doc_subtype VARCHAR2,
    p_employee_id NUMBER,
    p_action      VARCHAR2,
    p_note        VARCHAR2,
    p_path_id     NUMBER ,
    p_draft_id    NUMBER)
IS
  pragma AUTONOMOUS_TRANSACTION;
Line: 5362

    SELECT MAX(sequence_num)
    FROM po_action_history
    WHERE object_id      = doc_id
    AND object_type_code = doc_type;
Line: 5369

    SELECT MAX(sequence_num)
    FROM po_action_history
    WHERE object_id          = draft_id
    AND object_type_code     = doc_type
    AND object_sub_type_code  IN ('MODIFICATION', 'POST_AWARD_REQUEST'); -- PAR Approval
Line: 5377

    SELECT action_code
    FROM po_action_history
    WHERE object_id      = doc_id
    AND object_type_code = doc_type
    AND sequence_num     = seq_num;
Line: 5385

    SELECT action_code
    FROM po_action_history
    WHERE object_id          = draft_id
    AND object_type_code     = doc_type
    AND object_sub_type_code IN ('MODIFICATION', 'POST_AWARD_REQUEST') -- PAR Approval
    AND sequence_num         = seq_num;
Line: 5396

  ** First insert a row with  a SUBMIT action.
  ** Then insert a row with a NULL ACTION_CODE to simulate the forward-to
  ** since the doc status has been changed to IN PROCESS.
  */
  x_progress         := '001';
Line: 5404

    SELECT NVL(authorization_status, 'INCOMPLETE')
    INTO l_auth_stat
    FROM PO_REQUISITION_HEADERS
    WHERE requisition_header_id = p_doc_id;
Line: 5413

      SELECT NVL(authorization_status,'INCOMPLETE'),
        revision_num,
        ame_transaction_type
      INTO l_auth_stat,
        l_revision_num,
        l_transaction_type
      FROM PO_HEADERS
      WHERE po_header_id = p_doc_id;
Line: 5422

      SELECT NVL(status,'INCOMPLETE'),
        0,
        ame_transaction_type,
        draft_type -- PAR Approval
      INTO l_auth_stat,
        l_revision_num,
        l_transaction_type,
        l_draft_type
      FROM PO_HEADERS_MERGE_V
      WHERE po_header_id = p_doc_id
      AND draft_id       = l_draft_id;
Line: 5438

    SELECT NVL(authorization_status,'INCOMPLETE'),
      revision_num
    INTO l_auth_stat,
      l_revision_num
    FROM PO_RELEASES
    WHERE po_release_id = p_doc_id;
Line: 5483

    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
      (
        DECODE(l_draft_id,-1,l_doc_id,l_draft_id), --Mod Project
        p_doc_type,
        l_doc_subtype, --Mod Project
        l_sequence_num,
        sysdate,
        fnd_global.user_id,
        sysdate,
        fnd_global.user_id,
        p_action,
        DECODE(p_action, '',to_date(NULL), sysdate),
        p_employee_id,
        p_note,
        l_revision_num,
        fnd_global.login_id,
        0,
        0,
        0,
        '',
        l_approval_path_id,
        ''
      );
Line: 5532

    UPDATE PO_ACTION_HISTORY
    SET object_id            = DECODE(l_draft_id,-1,l_doc_id,l_draft_id), --Mod Project
      object_type_code       = p_doc_type,
      object_sub_type_code   = l_doc_subtype, --Mod Project
      sequence_num           = l_sequence_num,
      last_update_date       = sysdate,
      last_updated_by        = fnd_global.user_id,
      creation_date          = sysdate,
      created_by             = fnd_global.user_id,
      action_code            = p_action,
      action_date            = DECODE(p_action, '',to_date(NULL), sysdate),
      employee_id            = p_employee_id,
      note                   = p_note,
      object_revision_num    = l_revision_num,
      last_update_login      = fnd_global.login_id,
      request_id             = 0,
      program_application_id = 0,
      program_id             = 0,
      program_update_date    = '',
      approval_path_id       = l_approval_path_id,
      offline_code           = ''
    WHERE object_id          = DECODE(l_draft_id,-1,l_doc_id,l_draft_id) --Mod Project
    AND object_type_code     = p_doc_type
    AND object_sub_type_code = l_doc_subtype --Mod Project
    AND sequence_num         = l_sequence_num;
Line: 5566

    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
      (
        DECODE(l_draft_id,-1,l_doc_id,l_draft_id), --Mod Project
        p_doc_type,
        l_doc_subtype, --Mod Project
        l_sequence_num + 1,
        sysdate,
        fnd_global.user_id,
        sysdate,
        fnd_global.user_id,
        NULL, -- ACTION_CODE
        DECODE(p_action, '',to_date(NULL), sysdate),
        p_employee_id,
        NULL,
        l_revision_num,
        fnd_global.login_id,
        0,
        0,
        0,
        '',
        0,
        ''
      );
Line: 5620

    'PO_REQAPPROVAL_INIT1','InsertActionHistSubmit',x_progress
  )
  ;
Line: 5624

END InsertActionHistSubmit;
Line: 5770

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

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

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

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

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

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

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

      SELECT NVL(apps_source_code, 'PO')
      INTO l_apps_source_code
      FROM po_requisition_headers_all
      WHERE requisition_header_id=l_document_id;
Line: 6866

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

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

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

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

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

    SELECT st.DISPLAYED_FIELD
      || ' '
      || ty.DISPLAYED_FIELD
      || ' '
      || hd.SEGMENT1
    INTO l_doc_string
    FROM po_headers hd,
      po_lookup_codes ty,
      po_lookup_codes st
    WHERE hd.po_header_id = l_document_id
    AND ty.lookup_type    = 'DOCUMENT TYPE'
    AND ty.lookup_code    = l_document_type
    AND st.lookup_type    = 'DOCUMENT SUBTYPE'
    AND st.lookup_code    = hd.TYPE_LOOKUP_CODE;
Line: 6990

    SELECT st.DISPLAYED_FIELD
      || ' '
      || ty.DISPLAYED_FIELD
      || ' '
      || hd.SEGMENT1
    INTO l_doc_string
    FROM po_requisition_headers hd,
      po_lookup_codes ty,
      po_lookup_codes st
    WHERE hd.requisition_header_id = l_document_id
    AND ty.lookup_type             = 'DOCUMENT TYPE'
    AND ty.lookup_code             = l_document_type
    AND st.lookup_type             = 'REQUISITION TYPE'
    AND st.lookup_code             = hd.TYPE_LOOKUP_CODE;
Line: 7005

    SELECT st.DISPLAYED_FIELD
      || ' '
      || ty.DISPLAYED_FIELD
      || ' '
      || hd.SEGMENT1
      || '-'
      || rl.RELEASE_NUM
    INTO l_doc_string
    FROM po_headers hd,
      po_releases rl,
      po_lookup_codes ty,
      po_lookup_codes st
    WHERE rl.po_release_id = l_document_id
    AND rl.po_header_id    = hd.po_header_id
    AND ty.lookup_type     = 'DOCUMENT TYPE'
    AND ty.lookup_code     = l_document_type
    AND st.lookup_type     = 'DOCUMENT SUBTYPE'
    AND st.lookup_code     = rl.RELEASE_TYPE;
Line: 7069

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

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

    SELECT TO_CHAR(PO_WF_ITEMKEY_S.NEXTVAL) INTO l_seq FROM sys.dual;
Line: 7097

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

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

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

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

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

  UPDATE wf_notifications
  SET status             = 'CLOSED'
  WHERE notification_id IN
    (SELECT ias.notification_id
    FROM wf_item_activity_statuses ias,
      wf_notifications ntf
    WHERE ias.item_type     = itemtype
    AND ias.item_key        = itemkey
    AND ntf.notification_id = ias.notification_id
    );
Line: 7175

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

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

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

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

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

    SELECT COUNT(*)
    INTO l_error_count
    FROM wf_items
    WHERE parent_item_type=l_item_type
    AND parent_item_key   = l_item_key;
Line: 7319

    SELECT type_name
    FROM po_document_types
    WHERE document_type_code = p_doc_type
    AND document_subtype     = p_doc_subtype;
Line: 7328

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

  This may not be correct since acceptance_requried_flag may be updated in the DB.
  Thus, we shall query acceptance_required_flag from po_headers/po_releases view.
  */
  x_progress         := '001';
Line: 7430

    SELECT acceptance_required_flag
    INTO l_acceptance_flag
    FROM po_headers_all --bug 4764963
    WHERE po_header_Id = l_document_id;
Line: 7435

    SELECT acceptance_required_flag
    INTO l_acceptance_flag
    FROM po_releases_all --bug 4764963
    WHERE po_release_Id = l_document_id;
Line: 7450

    SELECT revision_num
    INTO l_revision_num
    FROM po_headers_all
    WHERE po_header_id = l_document_id;
Line: 7454

    SELECT COUNT(*)
    INTO l_responded_shipments
    FROM PO_ACCEPTANCES
    WHERE po_header_id = l_document_id
    AND revision_num   = l_revision_num;
Line: 7460

    SELECT revision_num
    INTO l_revision_num
    FROM po_releases_all
    WHERE po_release_id = l_document_id;
Line: 7464

    SELECT COUNT(*)
    INTO l_responded_shipments
    FROM PO_ACCEPTANCES
    WHERE po_release_id = l_document_id
    AND revision_num    = l_revision_num;
Line: 7515

    SELECT pov.vendor_name,
      poh.revision_num
    INTO x_vendor,
      x_revision_num -- RDP
    FROM po_vendors pov,
      po_headers poh
    WHERE pov.vendor_id = poh.vendor_id
    AND poh.po_header_id=x_document_id;
Line: 7524

    SELECT pov.vendor_name,
      poh.po_header_id,
      por.revision_num --RDP
    INTO x_vendor,
      x_po_header_id,
      x_revision_num
    FROM po_releases por,
      po_headers_all poh, -- 
      po_vendors pov
    WHERE por.po_release_id = x_document_id
    AND por.po_header_id    = poh.po_header_id
    AND poh.vendor_id       = pov.vendor_id;
Line: 7540

      SELECT a.notification_id,
        a.recipient_role
      INTO l_nid,
        l_ntf_role_name
      FROM wf_notifications a,
        wf_item_activity_statuses wa
      WHERE itemkey        =wa.item_key
      AND itemtype         =wa.item_type
      AND a.message_name  IN ('PO_EMAIL_PO_WITH_RESPONSE', 'PO_EMAIL_PO_PDF_WITH_RESPONSE')
      AND a.notification_id=wa.notification_id
      AND a.status         = 'CLOSED';
Line: 7558

      SELECT a.notification_id,
        a.recipient_role
      INTO l_nid,
        l_ntf_role_name
      FROM wf_notifications a,
        wf_item_activity_statuses wa
      WHERE itemkey        =wa.item_key
      AND itemtype         =wa.item_type
      AND a.message_name  IN ('PO_EMAIL_PO_WITH_RESPONSE', 'PO_EMAIL_PO_PDF_WITH_RESPONSE')
      AND a.notification_id=wa.notification_id
      AND a.status         = 'CLOSED';
Line: 7607

  Insert_Acc_Rejection_Row(itemtype, itemkey, actid, 'Y');
Line: 7651

    SELECT pov.vendor_name,
      poh.revision_num
    INTO x_vendor,
      l_revision_num
    FROM po_vendors pov,
      po_headers poh
    WHERE pov.vendor_id = poh.vendor_id
    AND poh.po_header_id=x_document_id;
Line: 7663

    SELECT pov.vendor_name,
      por.revision_num
    INTO x_vendor,
      l_revision_num
    FROM po_releases por,
      po_headers_all poh, --
      po_vendors pov
    WHERE por.po_release_id = x_document_id
    AND por.po_header_id    = poh.po_header_id
    AND poh.vendor_id       = pov.vendor_id;
Line: 7680

      SELECT a.notification_id,
        a.recipient_role
      INTO l_nid,
        l_ntf_role_name
      FROM wf_notifications a,
        wf_item_activity_statuses wa
      WHERE itemkey        =wa.item_key
      AND itemtype         =wa.item_type
      AND a.message_name  IN ('PO_EMAIL_PO_WITH_RESPONSE', 'PO_EMAIL_PO_PDF_WITH_RESPONSE')
      AND a.notification_id=wa.notification_id
      AND a.status         = 'CLOSED';
Line: 7698

      SELECT a.notification_id,
        a.recipient_role
      INTO l_nid,
        l_ntf_role_name
      FROM wf_notifications a,
        wf_item_activity_statuses wa
      WHERE itemkey        =wa.item_key
      AND itemtype         =wa.item_type
      AND a.message_name  IN ('PO_EMAIL_PO_WITH_RESPONSE', 'PO_EMAIL_PO_PDF_WITH_RESPONSE')
      AND a.notification_id=wa.notification_id
      AND a.status         = 'CLOSED';
Line: 7739

    Insert_Acc_Rejection_Row(itemtype, itemkey, actid, 'N');
Line: 7750

PROCEDURE Insert_Acc_Rejection_Row
  (
    itemtype IN VARCHAR2,
    itemkey  IN VARCHAR2,
    actid    IN NUMBER,
    flag     IN VARCHAR2)
             IS
  PRAGMA AUTONOMOUS_TRANSACTION; --
Line: 7779

  l_Last_Update_Login PO_ACCEPTANCES.last_update_login%TYPE;
Line: 7780

  l_Last_Update_Date PO_ACCEPTANCES.last_update_date%TYPE;
Line: 7781

  l_Last_Updated_By PO_ACCEPTANCES.last_updated_by%TYPE;
Line: 7809

    SELECT revision_num,
      agent_id
    INTO x_revision_num,
      x_employee_id
    FROM po_headers
    WHERE po_header_id = x_document_id;
Line: 7817

    SELECT po_header_id,
      revision_num,
      agent_id
    INTO x_Po_Header_Id,
      x_revision_num,
      x_employee_id
    FROM po_releases
    WHERE po_release_id = x_document_id;
Line: 7836

    SELECT user_id
    INTO l_Last_Updated_By
    FROM fnd_user
    WHERE user_name = upper(l_rspndr_usr_name);
Line: 7845

    l_Last_Updated_By := x_created_by;
Line: 7848

  l_Last_Update_Login := l_Last_Updated_By;
Line: 7849

  PO_ACCEPTANCES_INS_PVT.insert_row( x_rowid => l_rowid, x_acceptance_id => l_acceptance_id,
  x_Last_Update_Date => l_Last_Update_Date, x_Last_Updated_By => l_Last_Updated_By,
  x_Last_Update_Login => l_Last_Update_Login, p_creation_date => x_Creation_Date,
  p_created_by => l_Last_Updated_By, p_po_header_id => l_acc_po_header_id, p_po_release_id => x_Po_Release_Id,
  p_action => x_Action, p_action_date => x_Action_Date, p_employee_id => NULL, p_revision_num => x_Revision_Num,
  p_accepted_flag => x_Accepted_Flag, p_note => x_acceptance_note, p_accepting_party => l_accepting_party );
Line: 7860

    UPDATE po_releases
    SET acceptance_required_flag = 'N',
      LAST_UPDATE_DATE           = SYSDATE,
      acceptance_due_date        = ''
    WHERE po_release_id          = x_po_release_id;
Line: 7866

    UPDATE po_headers
    SET acceptance_required_flag = 'N',
      LAST_UPDATE_DATE           = SYSDATE,
      acceptance_due_date        = ''
    WHERE po_header_id           = x_po_header_id;
Line: 7913

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

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

PROCEDURE MassUpdate_Releases_Yes_No
  (
    itemtype IN VARCHAR2,
    itemkey  IN VARCHAR2,
    actid    IN NUMBER,
    funcmode IN VARCHAR2,
    resultout OUT NOCOPY VARCHAR2 )
IS
  l_orgid               NUMBER;
Line: 7981

  l_massupdate_releases VARCHAR2(2);
Line: 7991

  l_progress       := 'PO_REQAPPROVAL_INIT1.MassUpdate_Releases_Yes_No: 01';
Line: 7994

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

  l_massupdate_releases := PO_WF_UTIL_PKG.GetItemAttrText (itemtype => itemtype, itemkey => itemkey, aname => 'MASSUPDATE_RELEASES');
Line: 8022

  IF (NVL(l_massupdate_releases,'N') <> 'Y') THEN
    l_massupdate_releases            := 'N';
Line: 8026

      l_massupdate_releases := 'Y';
Line: 8028

      l_massupdate_releases := 'N';
Line: 8031

  resultout        := wf_engine.eng_completed || ':' || l_massupdate_releases;
Line: 8032

  l_progress       := 'PO_REQAPPROVAL_INIT1.MassUpdate_Releases_Yes_No: 02. Result= ' || l_massupdate_releases;
Line: 8035

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

  l_massupdate_releases := 'N';
Line: 8040

  resultout             := wf_engine.eng_completed || ':' || l_massupdate_releases;
Line: 8041

END MassUpdate_Releases_Yes_No;
Line: 8042

PROCEDURE MassUpdate_Releases_Workflow
  (
    itemtype IN VARCHAR2,
    itemkey  IN VARCHAR2,
    actid    IN NUMBER,
    funcmode IN VARCHAR2,
    resultout OUT NOCOPY VARCHAR2 )
IS
  l_document_id po_headers_all.po_header_id%type;
Line: 8054

  l_update_releases    VARCHAR2(1) := 'Y';
Line: 8056

  l_communicate_update VARCHAR2(30);                          -- Bug 3574895. Length same as that on the form field PO_APPROVE.COMMUNICATE_UPDATES
Line: 8059

  l_progress := 'PO_REQAPPROVAL_INIT1.MassUpdate_Releases_Workflow: 01';
Line: 8066

  SELECT poh.vendor_id,
    poh.vendor_site_id
  INTO l_vendor_id,
    l_vendor_site_id
  FROM po_headers poh
  WHERE poh.po_header_id = l_document_id;
Line: 8075

    SELECT structure_id
    INTO l_category_struct_id
    FROM mtl_default_sets_view
    WHERE functional_area_id = 2 ;
Line: 8081

    l_progress       := 'PO_REQAPPROVAL_INIT1.MassUpdate_Releases_Workflow: Could not find Category Structure Id';
Line: 8083

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

  l_communicate_update := PO_WF_UTIL_PKG.GetItemAttrText ( itemtype => itemtype, itemkey => itemkey, aname => 'CO_H_RETROACTIVE_SUPPLIER_COMM');
Line: 8095

  PO_RETROACTIVE_PRICING_PVT. MassUpdate_Releases
								  ( p_api_version => 1.0, p_validation_level => 100, p_vendor_id => l_vendor_id,
								  p_vendor_site_id => l_vendor_site_id , p_po_header_id => l_document_id,
								  p_category_struct_id => l_category_struct_id, -- Bug 3592705
								  p_category_from => NULL, p_category_to => NULL, p_item_from => NULL,
								  p_item_to => NULL, p_date => NULL, p_communicate_update => l_communicate_update,                                                                                                --Bug 3574895
								  x_return_status => l_return_status);
Line: 8103

    l_update_releases := 'N';
Line: 8105

  l_progress       := ': 02. Result= ' || l_update_releases;
Line: 8107

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

  resultout := wf_engine.eng_completed || ':' || l_update_releases;
Line: 8112

  l_update_releases := 'N';
Line: 8113

  l_progress        := 'PO_REQAPPROVAL_INIT1.MassUpdate_Releases_Workflow: 03.'|| ' Result= ' || l_update_releases;
Line: 8114

  resultout         := wf_engine.eng_completed || ':' || l_update_releases;
Line: 8116

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

END MassUpdate_Releases_Workflow;
Line: 8155

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

* This procedure basically checks if archive_on_print option is selected, and if yes
* call procedure PO_ARCHIVE_PO_SV.ARCHIVE_PO to archive the PO
*************************************************************************************/
PROCEDURE archive_po
  (
    p_document_id      IN NUMBER,
    p_document_type    IN VARCHAR2,
    p_document_subtype IN VARCHAR2)
                       IS
  -- 
  l_return_status VARCHAR2(1) ;
Line: 8192

* Effects:  This procedure updates invoice adjustment flag, and calls Costing
*           and Inventory APIs.
*/
PROCEDURE Retro_Invoice_Release_WF
  (
    itemtype IN VARCHAR2,
    itemkey  IN VARCHAR2,
    actid    IN NUMBER,
    funcmode IN VARCHAR2,
    resultout OUT NOCOPY VARCHAR2)
IS
  l_retro_change VARCHAR2(1);
Line: 8207

  l_update_releases    VARCHAR2(1) := 'Y';
Line: 8211

  l_retroactive_update VARCHAR2(30) := 'NEVER';
Line: 8212

  l_reset_retro_update BOOLEAN      := FALSE;
Line: 8216

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

  resultout := wf_engine.eng_completed || ':' || l_update_releases;
Line: 8229

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

    l_retro_change   := PO_RETROACTIVE_PRICING_PVT.Is_Retro_Update( p_document_id => l_document_id, p_document_type => l_document_type);
Line: 8244

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

    l_retroactive_update := PO_RETROACTIVE_PRICING_PVT.Get_Retro_Mode;
Line: 8250

    l_progress           := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 04' || 'l_retroactive_update = ' || l_retroactive_update;
Line: 8252

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

    l_reset_retro_update    := TRUE;
Line: 8256

    IF (l_retroactive_update = 'NEVER') THEN
      l_retro_change        := 'N';
Line: 8259

    /*IF (l_retroactive_update = 'NEVER')*/
  END IF;
Line: 8262

  l_progress       := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 05' || 'l_retroactive_update = ' || l_retroactive_update || 'l_retro_change = ' || l_retro_change ;
Line: 8264

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

  IF (l_retro_change  = 'Y' AND l_retroactive_update = 'ALL_RELEASES') THEN
    l_progress       := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 06. Calling ' || 'PO_RETROACTIVE_PRICING_PVT.Retro_Invoice_Release';
Line: 8272

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

      l_update_releases := 'N';
Line: 8278

    l_progress       := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 07. Result= ' || l_update_releases;
Line: 8280

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

  /*IF (l_retro_change = 'Y' AND l_retroactive_update = 'ALL_RELEASES')*/
  IF (l_reset_retro_update) THEN
    l_progress       := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 08. Reset_Retro_Update';
Line: 8287

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

    PO_RETROACTIVE_PRICING_PVT.Reset_Retro_Update( p_document_id => l_document_id, p_document_type => l_document_type);
Line: 8291

  /*IF (l_reset_retro_update)*/
  resultout := wf_engine.eng_completed || ':' || l_update_releases;
Line: 8295

  l_update_releases := 'N';
Line: 8296

  l_progress        := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 09.'|| ' Result= ' || l_update_releases;
Line: 8297

  resultout         := wf_engine.eng_completed || ':' || l_update_releases;
Line: 8299

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

Update the Action History with a note ICX_POR_NOTIF_TIMEOUT in approvers
language
*/
PROCEDURE UpdateActionHistory
  (
    p_doc_id      IN NUMBER,
    p_doc_type    IN VARCHAR2,
    p_doc_subtype IN VARCHAR2,
    p_action      IN VARCHAR2 )
                  IS
  pragma AUTONOMOUS_TRANSACTION;
Line: 8354

    SELECT pah.employee_id,
      pah.ROWID
    INTO l_emp_id,
      l_rowid
    FROM po_action_history pah
    WHERE pah.object_id          = p_doc_id
    AND pah.object_type_code     = p_doc_type
    AND pah.object_sub_type_code = p_doc_subtype
    AND pah.sequence_num         =
      (SELECT MAX(sequence_num)
      FROM po_action_history pah1
      WHERE pah1.object_id          = p_doc_id
      AND pah1.object_type_code     = p_doc_type
      AND pah1.object_sub_type_code = p_doc_subtype
      )
    AND pah.action_code IS NULL;
Line: 8382

          SELECT message_text
          INTO l_note
          FROM fnd_new_messages fm,
            fnd_languages fl
          WHERE fm.message_name = 'ICX_POR_NOTIF_TIMEOUT'
          AND fm.language_code  = fl.language_code
          AND fl.nls_language   = l_language;
Line: 8402

    UPDATE po_action_history pah
    SET pah.action_code     = p_action,
      pah.action_date       = SYSDATE,
      pah.Note              = l_note,
      pah.last_updated_by   = fnd_global.user_id,
      pah.last_update_login = fnd_global.login_id,
      pah.last_update_date  = SYSDATE
    WHERE ROWID             = l_rowid;
Line: 8464

    PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
Line: 8471

    PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,'Item Attribute value for CATALOG_ADMIN_USER_NAME='|| l_cat_admin_user_name);
Line: 8534

    PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
Line: 8539

    PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
Line: 8543

    SELECT lock_owner_user_id,
      lock_owner_role
    INTO l_lock_owner_user_id,
      l_lock_owner_role
    FROM po_headers_all
    WHERE po_header_id = p_doc_id;
Line: 8552

      PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
Line: 8558

      SELECT user_name
      INTO l_user_name
      FROM fnd_user
      WHERE user_id = l_lock_owner_user_id;
Line: 8565

        PO_WF_DEBUG_PKG.insert_debug(p_item_type,p_item_key,l_progress);
Line: 8626

	'&' || 'poHideUpdate=Y'|| '&' || 'poCallingNotifId=-&#NID-'|| '&' || 'retainAM=Y' || '&' || 'addBreadCrumb=Y' ;
Line: 8685

	'poHideUpdate=Y'|| '&' || 'poCallingNotifId=-&#NID-'|| '&' || 'retainAM=Y' || '&' || 'addBreadCrumb=Y' ;
Line: 8721

* the POREQ_SELECTOR know we should be in the supplier's context
* and not reset to the buyer's context
* Requires:
*   IN PARAMETERS:
*     Usual workflow attributes.
* Modifies: Sets the workflow attribute IS_SUPPLIER_CONTEXT to Y
*/
-- Commenting this code. Most likely will not be required with our context Setting fix.
/* procedure set_is_supplier_context_y(p_item_type        in varchar2,
p_item_key         in varchar2,
p_act_id           in number,
p_func_mode        in varchar2,
x_result_out       out NOCOPY varchar2) is
l_progress                  VARCHAR2(300);
Line: 8738

PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Begin');
Line: 8745

PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'End');
Line: 8750

PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Unexpected error');
Line: 8757

* the POREQ_SELECTOR know we are no longer in the suppliers
* context.
* Requires:
*   IN PARAMETERS:
*     Usual workflow attributes.
* Modifies: Sets the workflow attribute IS_SUPPLIER_CONTEXT to N
*/
/* procedure set_is_supplier_context_n(p_item_type        in varchar2,
p_item_key         in varchar2,
p_act_id           in number,
p_func_mode        in varchar2,
x_result_out       out NOCOPY varchar2) is
l_progress                  VARCHAR2(300);
Line: 8773

PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Begin');
Line: 8781

PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'End');
Line: 8786

PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Unexpected error');
Line: 8799

PROCEDURE update_print_count( p_doc_id NUMBER,
    p_doc_type VARCHAR2 )
IS

BEGIN
  IF (p_doc_type = 'RELEASE') THEN
    UPDATE po_releases_all pr
    SET pr.printed_date    = sysdate,
      pr.print_count       = NVL(pr.print_count,0) + 1
    WHERE pr.po_release_id = p_doc_id ;
Line: 8810

    UPDATE po_headers_all ph
    SET ph.printed_date   = sysdate,
      ph.print_count      = NVL(ph.print_count,0) + 1
    WHERE ph.po_header_id = p_doc_id ;
Line: 8820

** Public Procedure: Update_Action_History_TimeOut
** Requires:
**   IN PARAMETERS:
**     Usual workflow attributes.
** Modifies: Action History
** Effects:  Actoin History is updated with No Action if the approval
**           notification is TimedOut.
*/
PROCEDURE Update_Action_History_Timeout
  (
    Itemtype IN VARCHAR2,
    Itemkey  IN VARCHAR2,
    Actid    IN NUMBER,
    Funcmode IN VARCHAR2,
    Resultout OUT NOCOPY VARCHAR2)
IS
  L_Doc_Id NUMBER;
Line: 8843

  UpdateActionHistory ( p_doc_id => L_Doc_Id, p_doc_type => L_Doc_Type, p_doc_subtype => L_Doc_Subtype, p_action => 'NO ACTION' );
Line: 8844

END Update_Action_History_Timeout;
Line: 8853

* the POREQ_SELECTOR know we should be in the supplier's context
* and not reset to the buyer's context
* Requires:
*   IN PARAMETERS:
*     Usual workflow attributes.
* Modifies: Sets the workflow attribute IS_SUPPLIER_CONTEXT to Y
*/
PROCEDURE set_is_supplier_context_y
  (
    p_item_type IN VARCHAR2,
    p_item_key  IN VARCHAR2,
    p_act_id    IN NUMBER,
    p_func_mode IN VARCHAR2,
    x_result_out OUT NOCOPY VARCHAR2)
IS
  l_progress VARCHAR2(300);
Line: 8872

    PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Begin');
Line: 8876

    PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'End');
Line: 8881

    PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Unexpected error');
Line: 8888

* the POREQ_SELECTOR know we are no longer in the suppliers
* context.
* Requires:
*   IN PARAMETERS:
*     Usual workflow attributes.
* Modifies: Sets the workflow attribute IS_SUPPLIER_CONTEXT to N
*/
PROCEDURE set_is_supplier_context_n
  (
    p_item_type IN VARCHAR2,
    p_item_key  IN VARCHAR2,
    p_act_id    IN NUMBER,
    p_func_mode IN VARCHAR2,
    x_result_out OUT NOCOPY VARCHAR2)
IS
  l_progress VARCHAR2(300);
Line: 8907

    PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Begin');
Line: 8912

    PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'End');
Line: 8917

    PO_WF_DEBUG_PKG.insert_debug(p_item_type, p_item_key, l_progress || 'Unexpected error');
Line: 8935

    SELECT draft_type
    INTO l_draft_type
    FROM po_drafts
    WHERE document_id = DocumentId
          AND draft_id = DraftId;
Line: 8946

  SELECT ds.wf_approval_itemtype,
         ds.wf_approval_process,
         DECODE(l_draft_type,
                'MOD', ds.mod_ame_transaction_type,
                'PAR', ds.par_ame_transaction_type,
                 ds.ame_transaction_type)
  INTO l_itemtype,
       l_workflow_process,
       l_ame_transaction_type
  FROM po_doc_style_headers ds,
       po_headers_merge_v phm
  WHERE phm.po_header_id = DocumentId
        AND NVL(phm.draft_id, -1) = DraftId
        AND phm.style_id = ds.style_id
        AND ds.wf_approval_itemtype IS NOT NULL
        AND ds.wf_approval_process  IS NOT NULL;
Line: 8985

PROCEDURE SetModUpdateAfterCDGenFlag
  (
    p_draft_id IN NUMBER) -- SGD Project
               IS
  pragma AUTONOMOUS_TRANSACTION;
Line: 8991

  mod_last_update_date PO_DRAFTS.last_update_date%type;
Line: 8996

  SELECT cd_generated_date
  INTO changedesc_gen_date
  FROM po_drafts
  WHERE draft_id = p_draft_id;
Line: 9003

  mod_last_update_date    := PO_CORE_S.get_last_update_date_for_mod(p_draft_id);
Line: 9005

  IF( mod_last_update_date > changedesc_gen_date) THEN
    UPDATE po_drafts
    SET modupdated_aftercdgenerated = 'Y'
    WHERE draft_id                  = p_draft_id;
Line: 9010

    UPDATE po_drafts
    SET modupdated_aftercdgenerated = 'N'
    WHERE draft_id                  = p_draft_id;
Line: 9017

  wf_core.context('PO_REQAPPROVAL_INIT1','SetModUpdateAfterCDGenFlag',x_progress);
Line: 9019

END SetModUpdateAfterCDGenFlag;
Line: 9046

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_progress || 'Unexpected error');
Line: 9052

 PROCEDURE update_supplier_com_rev_num(itemtype IN VARCHAR2,
				       itemkey IN VARCHAR2,
				       actid   IN VARCHAR2,
				       funcmode IN VARCHAR2,
				       resultout OUT NOCOPY VARCHAR2) IS

 l_po_header_id NUMBER;
Line: 9079

	   UPDATE po_headers_all
	   SET comm_rev_num = l_po_revision_num_curr
	   WHERE po_header_id = l_po_header_id;
Line: 9086

	 UPDATE po_releases_all
	 SET comm_rev_num = l_po_revision_num_curr
	 WHERE po_release_id = l_po_header_id;
Line: 9092

   l_progress := 'PO_REQAPPROVAL_INIT1.update_supplier_com_rev_num: Current PO Rev Number = '||l_po_revision_num_curr;
Line: 9097

    PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey, l_progress || 'Unexpected error');
Line: 9101

 END update_supplier_com_rev_num;