DBA Data[Home] [Help]

APPS.PO_REQAPPROVAL_INIT1 SQL Statements

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

Line: 37

  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: 71

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

PROCEDURE UpdateActionHistory(p_doc_id      IN number,
                              p_doc_type    IN varchar2,
                              p_doc_subtype IN varchar2,
                              p_action      IN varchar2
                              ) ;
Line: 136

Procedure Insert_Acc_Rejection_Row(itemtype        in  varchar2,
                                   itemkey         in  varchar2,
                                   actid           in  number,
                                   flag                   in  varchar2);
Line: 143

* 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: 196

    '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: 269

      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: 288

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

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

   DELETE po_wf_user_tmp;
Line: 346

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

    '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: 595

                             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*/
                                                 )
IS
l_responsibility_id     number;
Line: 674

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 713

        select to_char(PO_WF_ITEMKEY_S.NEXTVAL)
        into l_seq_for_item_key
        from sys.dual;
Line: 733

          select count(*)
          into   x_wf_created
          from   wf_items
          where  item_type = l_itemtype
            and  item_key  = l_itemkey;
Line: 755

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

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

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

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

              update po_headers_all
              SET xml_flag = 'N'
              WHERE po_header_id = DocumentID;
Line: 825

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

                                          , aname    => 'INSERT_ACTION_HIST_FLAG'
                                          , avalue   => 'N'
                                          );
Line: 855

                                          , aname    => 'INSERT_ACTION_HIST_FLAG'
                                          , avalue   => 'Y'
                                          );
Line: 975

           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: 986

           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: 1025

           select global_agreement_flag
           into l_ga_flag
           from po_headers_all
           where po_header_id = DocumentID;
Line: 1040

        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: 1077

        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: 1097

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

                                          aname           => 'UPDATE_SOURCING_RULE',
                                          avalue          =>  updatesourcingrule);
Line: 1245

                                          aname        => 'MASSUPDATE_RELEASES',
                                          avalue       =>  MassUpdateReleases);
Line: 1279

                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: 1289

                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: 1320

                select  NVL(consigned_consumption_flag, 'N') -- Bug 3318625
                into    l_consigned_flag
                from   po_releases_all
                where  po_release_id = DocumentId;
Line: 1325

                select  NVL(consigned_consumption_flag, 'N')
                into    l_consigned_flag
                from   po_headers_all
                where  po_header_id = DocumentId;
Line: 1400

              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: 1409

              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: 1443

         SELECT hou.name
         into   l_operating_unit
         FROM
                hr_organization_units hou
         WHERE
                hou.organization_id = x_orgid;
Line: 1575

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

               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: 1646

               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: 1661

           /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,l_itemkey,x_progress);
Line: 1675

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,l_itemkey,x_progress);
Line: 1715

l_update_req_url    varchar2(1000);
Line: 1753

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 1811

      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: 2033

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

         /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2058

                                            p_mode         => 'update');
Line: 2061

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

         /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2116

  **  Set the URL to  VIEW/UPDATE web requisitions
  */

  -- The support for icx 3.0 is removed.

  IF (fnd_profile.value('POR_SSP4_INSTALLED') = 'Y' AND
      l_document_type = 'REQUISITION' and
      po_core_s.get_product_install_status('ICX') = 'I') THEN

     --Bug#3147435
     --Set the values for workflow attribute
     --VIEW_REQ_DTLS_URL and EDIT_REQ_URL

     l_view_req_dtls_url := 'JSP:/OA_HTML/OA.jsp?OAFunc=ICX_POR_LAUNCH_IP' || '&' ||
                            'porMode=viewReq' || '&' ||
                            'porReqHeaderId=' || to_char(l_document_id) || '&' ||
                            '_OrgId=' || to_char(x_orgid) || '&' ||
                            'addBreadCrumb=Y';
Line: 2165

     l_update_req_url := l_edit_req_url;
Line: 2180

                                 aname      => 'REQ_UPDATE_URL' ,
                                 avalue     => l_update_req_url);
Line: 2202

     /*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: 2246

     select AUTHORIZATION_STATUS
     into l_authorization_status
     from po_requisition_headers_all
     where REQUISITION_HEADER_ID = l_document_id;
Line: 2263

     select AUTHORIZATION_STATUS, NVL(REVISION_NUM,0)
     into l_authorization_status, l_po_revision
     from po_headers_all
     where PO_HEADER_ID = l_document_id;
Line: 2285

      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: 2408

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2444

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2487

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2602

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2641

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2682

  ** 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') )
     OR
       ( l_note = 'UPGRADE_TO_R11' )  THEN

     IF l_doc_type = 'REQUISITION' THEN

        SetReqAuthStat(l_document_id, itemtype,itemkey,l_note, 'IN PROCESS');
Line: 2703

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2772

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2817

      select NVL(authorization_status, 'INCOMPLETE') into l_auth_stat
      from PO_REQUISITION_HEADERS
      where requisition_header_id = l_doc_id;
Line: 2827

      select NVL(authorization_status,'INCOMPLETE') into l_auth_stat
      from PO_HEADERS
      where po_header_id = l_doc_id;
Line: 2837

      select NVL(authorization_status,'INCOMPLETE') into l_auth_stat
      from PO_RELEASES
      where po_release_id = l_doc_id;
Line: 2859

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2867

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

       /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2874

     UpdateActionHistory(p_doc_id      =>  l_doc_id,
                         p_doc_type    =>  l_doc_type,
                         p_doc_subtype =>  l_doc_subtype,
                         p_action      =>  'NO ACTION'
                        ) ;
Line: 2916

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 2969

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3006

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3061

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3097

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3140

      select NVL(authorization_status, 'INCOMPLETE') into l_auth_stat
      from PO_REQUISITION_HEADERS
      where requisition_header_id = l_doc_id;
Line: 3146

      select NVL(authorization_status,'INCOMPLETE') into l_auth_stat
      from PO_HEADERS
      where po_header_id = l_doc_id;
Line: 3152

      select NVL(authorization_status,'INCOMPLETE') into l_auth_stat
      from PO_RELEASES
      where po_release_id = l_doc_id;
Line: 3181

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3230

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3262

**      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: 3301

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3421

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

        /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3566

        /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3614

   select nvl(fsp.reserve_at_completion_flag,'N') into l_reserve_at_compl
        from financials_system_parameters fsp;
Line: 3626

        /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3635

        /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3677

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

select wf_item_key
from po_requisition_headers
where requisition_header_id= p_header_id;
Line: 3687

select wf_item_key
from po_releases
where po_release_id= p_header_id;
Line: 3695

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3796

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3825

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3852

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3884

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3911

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 3946

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4023

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4059

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4105

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4147

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4177

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4255

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4396

l_select boolean;
Line: 4446

        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: 4457

        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: 4471

        select vendor_name
          into l_role_display_name
          from po_vendors
          where vendor_id=l_vendor_id;
Line: 4606

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4676

        select po_header_id into l_po_header_id
        from po_releases
        where po_release_id = l_document_id;
Line: 4688

        select poh.vendor_site_id, pvs.vendor_site_code, pvs.language
        into l_vendor_site_id, l_vendor_site_code, l_vendor_site_lang
        from po_headers poh, po_vendor_sites pvs
        where pvs.vendor_site_id = poh.vendor_site_id
        and poh.po_header_id =         l_po_header_id;
Line: 4700

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

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

     select count(*) into l_performer_exists
     from wf_users where name = l_po_email_performer;
Line: 4749

     select count(*) into l_performer_exists
     from wf_users where name = l_po_email_performer_prof;
Line: 4779

       update_print_count(l_document_id,l_document_type);
Line: 4792

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4837

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4898

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 4972

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5012

      select NVL(authorization_status, 'INCOMPLETE') into l_auth_stat
      from PO_REQUISITION_HEADERS
      where requisition_header_id = l_doc_id;
Line: 5021

      select NVL(authorization_status,'INCOMPLETE') into l_auth_stat
      from PO_HEADERS
      where po_header_id = l_doc_id;
Line: 5029

      select NVL(authorization_status,'INCOMPLETE') into l_auth_stat
      from PO_RELEASES
      where po_release_id = l_doc_id;
Line: 5046

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress );
Line: 5084

     /* DEBUG */ PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5116

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5156

     /* DEBUG */ PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5186

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5243

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5253

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5260

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5335

  SELECT  default_rate_type
  INTO l_rate_type
  FROM po_system_parameters;
Line: 5341

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5348

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

       /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5371

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5388

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5406

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5425

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5443

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 5496

  select DISPLAYED_FIELD
  from po_lookup_codes
  where lookup_type='AUTHORIZATION STATUS'
  and lookup_code = p_auth_stat;
Line: 5502

  select DISPLAYED_FIELD
  from po_lookup_codes
  where lookup_type='DOCUMENT STATE'
  and lookup_code = p_closed_code;
Line: 5513

select type_name
from po_document_types
where document_type_code = p_doc_type
and document_subtype = p_doc_subtype;
Line: 5520

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

   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: 5552

   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: 5564

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5609

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5631

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5800

    select count(1)
    into l_num_attachments
    from fnd_attached_documents
    where pk1_value = to_char(ReqHdr_rec.requisition_header_id)
        and entity_name = 'REQ_HEADERS';
Line: 5825

     /* DEBUG */ PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 5867

  ** 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: 5911

    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: 5950

  ** or 'PRE-APPROVED', therefore we should update the status to IN PROCESS.
  */
  IF note = 'UPGRADE_TO_R11' THEN

    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: 5964

    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)   --
    where po_header_id = l_po_header_id;
Line: 6003

  ** 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: 6017

    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: 6047

  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: 6074

  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: 6103

  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: 6127

 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: 6169

  select org_id
  from po_requisition_headers_all
  where requisition_header_id = document_id;
Line: 6174

  select org_id
  from po_headers_all
  where po_header_id = document_id;
Line: 6179

  select org_id
  from po_releases_all
  where po_release_id = document_id;
Line: 6227

    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: 6284

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) is

pragma AUTONOMOUS_TRANSACTION;
Line: 6300

   select max(sequence_num)
   from po_action_history
   where object_id= doc_id and
   object_type_code = doc_type;
Line: 6306

   select action_code
   from po_action_history
   where object_id = doc_id and
   object_type_code = doc_type and
   sequence_num = seq_num;
Line: 6319

  ** 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: 6332

      select NVL(authorization_status, 'INCOMPLETE') into l_auth_stat
      from PO_REQUISITION_HEADERS
      where requisition_header_id = p_doc_id;
Line: 6341

      select NVL(authorization_status,'INCOMPLETE'),revision_num
             into l_auth_stat, l_revision_num
      from PO_HEADERS
      where po_header_id = p_doc_id;
Line: 6350

      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: 6379

      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_doc_id,
              p_doc_type,
              p_doc_subtype,
              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: 6424

        UPDATE PO_ACTION_HISTORY
          set object_id = p_doc_id,
              object_type_code = p_doc_type,
              object_sub_type_code = p_doc_subtype,
              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= p_doc_id and
              object_type_code = p_doc_type and
              sequence_num = l_sequence_num;
Line: 6460

      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_doc_id,
              p_doc_type,
              p_doc_subtype,
              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: 6510

        wf_core.context('PO_REQAPPROVAL_INIT1','InsertActionHistSubmit',x_progress);
Line: 6513

END InsertActionHistSubmit;
Line: 6643

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 6737

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

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

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 6836

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 6949

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7506

      select nvl(apps_source_code, 'PO')
      into   l_apps_source_code
      from   po_requisition_headers_all
      where  requisition_header_id=l_document_id;
Line: 7555

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 7565

       /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 7581

        /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 7590

        /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 7635

     /* DEBUG */ PO_WF_DEBUG_PKG.insert_debug(itemtype, itemkey,x_progress);
Line: 7703

    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: 7716

    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: 7729

    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: 7802

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7811

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7840

      select to_char(PO_WF_ITEMKEY_S.NEXTVAL) into l_seq from sys.dual;
Line: 7850

         /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7859

         /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7886

         /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7895

         /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7906

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 7920

    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: 7950

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 7961

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 8001

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 8030

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 8060

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 8074

   Select count(*)
   into l_error_count
   from wf_items
   where parent_item_type=l_item_type
   and parent_item_key = l_item_key;
Line: 8132

select type_name
from po_document_types
where document_type_code = p_doc_type
and document_subtype = p_doc_subtype;
Line: 8144

      /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 8332

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: 8351

                select acceptance_required_flag
                into l_acceptance_flag
                from po_headers_all --bug 4764963
                where po_header_Id = l_document_id;
Line: 8356

                select acceptance_required_flag
                into l_acceptance_flag
                from po_releases_all --bug 4764963
                where po_release_Id = l_document_id;
Line: 8374

            select revision_num
            into l_revision_num
            from po_headers_all
            where po_header_id = l_document_id;
Line: 8379

            select count(*)
            into l_responded_shipments
            from PO_ACCEPTANCES
            where po_header_id = l_document_id and
            revision_num = l_revision_num;
Line: 8385

            select revision_num
            into l_revision_num
            from po_releases_all
            where po_release_id = l_document_id;
Line: 8390

            select count(*)
            into l_responded_shipments
            from PO_ACCEPTANCES
            where po_release_id = l_document_id and
            revision_num = l_revision_num;
Line: 8461

        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: 8467

        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: 8483

        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: 8498

        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: 8569

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

        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: 8650

        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: 8678

           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: 8693

           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: 8751

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

Procedure Insert_Acc_Rejection_Row(itemtype        in  varchar2,
                                   itemkey         in  varchar2,
                                   actid           in  number,
                                   flag                   in  varchar2)
is

   x_row_id             varchar2(30);
Line: 8808

   l_Last_Update_Login  PO_ACCEPTANCES.last_update_login%TYPE;
Line: 8809

   l_Last_Update_Date   PO_ACCEPTANCES.last_update_date%TYPE;
Line: 8810

   l_Last_Updated_By    PO_ACCEPTANCES.last_updated_by%TYPE;
Line: 8852

                select revision_num,agent_id
                into x_revision_num,x_employee_id
                from po_headers
                where po_header_id = x_document_id;
Line: 8859

                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: 8880

      select user_id into   l_Last_Updated_By
      from fnd_user
      where user_name = upper(l_rspndr_usr_name);
Line: 8886

      l_Last_Updated_By := x_created_by;
Line: 8889

    l_Last_Update_Login := l_Last_Updated_By;
Line: 8891

    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: 8917

      update po_releases
      set acceptance_required_flag = 'N',
      LAST_UPDATE_DATE = SYSDATE,
      acceptance_due_date = ''
      where po_release_id = x_po_release_id;
Line: 8923

      update po_headers
      set acceptance_required_flag = 'N',
      LAST_UPDATE_DATE = SYSDATE,
      acceptance_due_date = ''
      where po_header_id = x_po_header_id;
Line: 8978

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 9011

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,x_progress);
Line: 9072

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: 9078

l_massupdate_releases     varchar2(2);
Line: 9092

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 9142

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

  IF (nvl(l_massupdate_releases,'N') <> 'Y') THEN
    l_massupdate_releases := 'N';
Line: 9157

        l_massupdate_releases := 'Y';
Line: 9159

        l_massupdate_releases := 'N';
Line: 9163

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

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

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 9172

  l_massupdate_releases := 'N';
Line: 9173

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

END MassUpdate_Releases_Yes_No;
Line: 9176

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: 9185

l_update_releases varchar2(1) := 'Y';
Line: 9187

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

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

        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: 9211

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

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

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

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

        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: 9251

                l_update_releases := 'N';
Line: 9254

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

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

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

        l_update_releases := 'N';
Line: 9262

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

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

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

END MassUpdate_Releases_Workflow;
Line: 9319

     /* DEBUG */  PO_WF_DEBUG_PKG.insert_debug(itemtype,itemkey,l_progress);
Line: 9333

* 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: 9368

* 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: 9382

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

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

l_reset_retro_update    BOOLEAN := FALSE;
Line: 9393

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

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

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

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

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

    l_retroactive_update := PO_RETROACTIVE_PRICING_PVT.Get_Retro_Mode;
Line: 9454

                'l_retroactive_update = ' || l_retroactive_update;
Line: 9456

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

    l_reset_retro_update := TRUE;
Line: 9462

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

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

                'l_retroactive_update = ' || l_retroactive_update ||
                'l_retro_change = ' || l_retro_change ;
Line: 9472

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

  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: 9486

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

      l_update_releases := 'N';
Line: 9502

                  l_update_releases;
Line: 9504

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

  END IF; /*IF (l_retro_change = 'Y' AND l_retroactive_update = 'ALL_RELEASES')*/
Line: 9509

  IF (l_reset_retro_update) THEN
    l_progress := 'PO_REQAPPROVAL_INIT1.Retro_Invoice_Release_WF: 08. Reset_Retro_Update';
Line: 9512

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

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

  END IF; /*IF (l_reset_retro_update)*/
Line: 9520

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

    l_update_releases := 'N';
Line: 9526

                  ' Result= ' || l_update_releases;
Line: 9527

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

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

  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: 9588

      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: 9625

               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: 9647

      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: 9707

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

    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: 9786

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

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

    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: 9807

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

       select user_name into l_user_name
       from   fnd_user
       where  user_id = l_lock_owner_user_id;
Line: 9822

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

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

* 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: 9966

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

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

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

* 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: 10007

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

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

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

PROCEDURE update_print_count( p_doc_id NUMBER,
                              p_doc_type VARCHAR2 )
IS PRAGMA AUTONOMOUS_TRANSACTION;
Line: 10038

        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: 10044

        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: 10054

** 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: 10087

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

END Update_Action_History_Timeout;
Line: 10105

* 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: 10121

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

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

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

* 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: 10162

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

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

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