DBA Data[Home] [Help]

APPS.OE_APPROVALS_WF SQL Statements

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

Line: 81

    DELETE
      FROM OE_APPROVER_TRANSACTIONS
     WHERE TRANSACTION_ID = l_transaction_id;
Line: 107

     /*  OE_ORDER_WF_UTIL.Update_Flow_Status_Code
                 (p_item_type                 => itemtype,
                  p_header_id                 => l_transaction_id,
                  p_flow_status_code          => 'INTERNAL_APPROVED',
                  p_sales_document_type_code  => l_sales_document_type_code,
                  x_return_status             => l_return_status );
Line: 115

           oe_debug_pub.add('Initiate_approval STATUS FROM Update_Flow_Status_Code: '|| l_return_status );
Line: 188

           select sold_to_org_id, expiration_date, salesrep_id
           into l_sold_to_org_id, l_expiration_date, l_salesrep_id
           from oe_order_headers_all
           where header_id = to_number(itemkey);
Line: 193

           select obha.sold_to_org_id, obhe.end_date_active, obha.salesrep_id
           into l_sold_to_org_id, l_expiration_date, l_salesrep_id
           from oe_blanket_headers_all obha, oe_blanket_headers_ext obhe
           where obha.header_id = to_number(itemkey)
           and   obha.order_number = obhe.order_number;
Line: 223

       OE_ORDER_WF_UTIL.Update_Flow_Status_Code
                 (p_item_type                 => itemtype,
                  p_header_id                 => l_transaction_id,
                  p_flow_status_code          => 'PENDING_INTERNAL_APPROVAL',
                  p_sales_document_type_code  => l_sales_document_type_code,
                  x_return_status             => l_return_status );
Line: 231

            oe_debug_pub.add('Initiate_Approval STATUS FROM Update_Flow_Status_Code: '|| l_return_status );
Line: 299

   the definition/setup in the OM Approver List form, insert/update
   the proper record in the OM Approval transaction table
   OE_APPROVAL_TRANSACTIONS. Checks the max(approver_sequence) from
   OE_APPROVAL_TRANSACTIONS given a transaction_id, and then fetches
   the role from the OE_APPROVER_LISTS with approver_sequence = max+1
   and insert the record in OE_APPROVER_TRANSACTIONS.
   Returns Y if it finds the next approver and returns N if there is no
   approver left. In the case there is no more approvers, it will update
   the status to APPROVED
*/
Procedure Get_Next_Approver
       (itemtype  in varchar2,
        itemkey   in varchar2,
        actid     in number,
        funcmode  in varchar2,
        resultout in out NOCOPY /* file.sql.39 change */ varchar2)
IS

  l_transaction_id NUMBER;
Line: 356

     UPDATE OE_APPROVER_TRANSACTIONS
        SET APPROVAL_STATUS = 'APPROVED'
      WHERE TRANSACTION_ID = l_transaction_id
 --- ?? phase code = not really needed
        AND APPROVER_SEQUENCE = (select max(APPROVER_SEQUENCE)
                                   from OE_APPROVER_TRANSACTIONS
                                  WHERE TRANSACTION_ID = l_transaction_id);
Line: 385

       OE_ORDER_WF_UTIL.Update_Flow_Status_Code
                 (p_item_type                 => itemtype,
                  p_header_id                 => l_transaction_id,
                  p_flow_status_code          => 'APPROVED',
                  p_sales_document_type_code  => l_sales_document_type_code,
                  x_return_status             => l_return_status );
Line: 393

            oe_debug_pub.add('Get_next_approval STATUS FROM Update_Flow_Status_Code: '|| l_return_status );
Line: 422

           select sold_to_org_id, expiration_date, salesrep_id
             into l_sold_to_org_id, l_expiration_date, l_salesrep_id
             from oe_order_headers_all
            where header_id = l_transaction_id;
Line: 428

           select obha.sold_to_org_id, obhe.end_date_active, obha.salesrep_id
             into l_sold_to_org_id, l_expiration_date, l_salesrep_id
             from oe_blanket_headers_all obha,
                  oe_blanket_headers_ext obhe
            where obha.header_id = l_transaction_id
              and obha.order_number = obhe.order_number;
Line: 553

   select ROLE, APPROVER_SEQUENCE
     from OE_APPROVER_LIST_MEMBERS
    where list_id = l_list_id
      and APPROVER_SEQUENCE > l_curr_approver_sequence
      and ACTIVE_FLAG = 'Y'
     order by APPROVER_SEQUENCE;
Line: 578

      select ORDER_TYPE_ID, nvl(TRANSACTION_PHASE_CODE, 'F')
        into l_transaction_type_id, l_transaction_phase_code
        from oe_blanket_headers_all
       where header_id = p_transaction_id;
Line: 588

      select ORDER_TYPE_ID, nvl(TRANSACTION_PHASE_CODE, 'F')
        into l_transaction_type_id, l_transaction_phase_code
        from oe_order_headers_all
       where header_id = p_transaction_id;
Line: 601

      select list_id
        into l_list_id
        from OE_APPROVER_LISTS
       where TRANSACTION_TYPE_ID = l_transaction_type_id
         and TRANSACTION_PHASE_CODE is not NULL
         and TRANSACTION_PHASE_CODE = l_transaction_phase_code
         and SYSDATE BETWEEN NVL(START_DATE_ACTIVE, SYSDATE )
                         AND NVL(END_DATE_ACTIVE, SYSDATE );
Line: 625

         select list_id
           into l_list_id
           from OE_APPROVER_LISTS
          where TRANSACTION_TYPE_ID = l_transaction_type_id
            and TRANSACTION_PHASE_CODE is NULL
            and SYSDATE BETWEEN NVL(START_DATE_ACTIVE, SYSDATE )
                            AND NVL(END_DATE_ACTIVE, SYSDATE );
Line: 652

     select max(APPROVER_SEQUENCE)
       into l_curr_approver_sequence
       from OE_APPROVER_TRANSACTIONS
      where TRANSACTION_ID = p_transaction_id
        and TRANSACTION_TYPE_ID = l_transaction_type_id
        and TRANSACTION_PHASE_CODE   = l_transaction_phase_code;
Line: 700

       oe_debug_pub.add('Inserting into OE_APPROVER_TRANSACTIONS ', 1) ;
Line: 703

   INSERT INTO OE_APPROVER_TRANSACTIONS
         (
             TRANSACTION_ID
            ,TRANSACTION_TYPE_ID   --?? Do we need this. evalute
            ,TRANSACTION_PHASE_CODE
            ,ROLE
            ,APPROVER_SEQUENCE
            ,APPROVAL_STATUS
            ,CREATION_DATE
            ,CREATED_BY
            ,LAST_UPDATE_DATE
            ,LAST_UPDATED_BY
            ,LAST_UPDATE_LOGIN

         )
   VALUES
         (
             p_transaction_id
            ,l_transaction_type_id
            ,l_transaction_phase_code
            ,l_role
            ,l_approver_sequence
            ,NULL --APPROVAL_STATUS
            ,SYSDATE
            ,l_user_id
            ,SYSDATE
            ,l_user_id
            ,l_user_id
         );
Line: 742

     This procedure will update the OM Approval transaction table
     OE_APPROVER_TRANSACTIONS with proper results. Perform a status
     update to INTERNAL_APPROVED.
*/
Procedure Approve_Approval
       (itemtype  in varchar2,
        itemkey   in varchar2,
        actid     in number,
        funcmode  in varchar2,
        resultout in out NOCOPY /* file.sql.39 change */ varchar2)
IS

  l_transaction_id            NUMBER;
Line: 785

    OE_ORDER_WF_UTIL.Update_Flow_Status_Code
                 (p_item_type                 => itemtype,
                  p_header_id                 => l_transaction_id,
                  p_flow_status_code          => 'INTERNAL_APPROVED',
                  p_sales_document_type_code  => l_sales_document_type_code,
                  x_return_status             => l_return_status );
Line: 793

           oe_debug_pub.add('Approve_Approval STATUS FROM Update_Flow_Status_Code: '|| l_return_status );
Line: 1003

     This procedure will update the OM Approval transaction table
     OE_APPROVER_TRANSACTIONS with proper results. Perform a status
     update to DRAFT_INTERNAL_REJECTED. And update the column
     DRAFT_SUBMITTED_FLAG to 'N' to the base table.
*/
Procedure Reject_Approval
       (itemtype  in varchar2,
        itemkey   in varchar2,
        actid     in number,
        funcmode  in varchar2,
        resultout in out NOCOPY /* file.sql.39 change */ varchar2)
IS

  l_transaction_id        NUMBER;
Line: 1040

      UPDATE OE_APPROVER_TRANSACTIONS
         SET APPROVAL_STATUS = 'REJECTED'
       WHERE TRANSACTION_ID = to_number(itemkey)
         AND APPROVER_SEQUENCE = ( select max(APPROVER_SEQUENCE)
                                     from OE_APPROVER_TRANSACTIONS
                                    where TRANSACTION_ID = to_number(itemkey));
Line: 1054

       OE_ORDER_WF_UTIL.Update_Quote_Blanket(
                      p_item_type => OE_GLOBALS.G_WFI_NGO,
                      p_item_key => to_number(itemkey),
                      p_flow_status_code => 'DRAFT_INTERNAL_REJECTED',
                      p_draft_submitted_flag => 'N',
                      x_return_status => l_return_status);
Line: 1061

       OE_ORDER_WF_UTIL.Update_flow_status_code(
                      p_item_type => itemtype,
                      p_header_id => to_number(itemkey),
                      p_flow_status_code => 'INTERNAL_REJECTED',
                      x_return_status => l_return_status);
Line: 1069

         oe_debug_pub.add('Reject_Approval STATUS FROM Update_Flow_Status_Code: '|| l_return_status );
Line: 1178

  select to_number(ITEM_KEY)
    into l_transaction_id
   from WF_ITEM_ACTIVITY_STATUSES
   where NOTIFICATION_ID = to_number(document_id);
Line: 1215

    select role
      into l_role
      from OE_APPROVER_TRANSACTIONS
     where TRANSACTION_ID = p_transaction_id
       and APPROVER_SEQUENCE = ( select max(APPROVER_SEQUENCE)
                                   from OE_APPROVER_TRANSACTIONS
                                  where TRANSACTION_ID = p_transaction_id);
Line: 1268

  select to_number(ITEM_KEY)
    into l_transaction_id
   from WF_ITEM_ACTIVITY_STATUSES
   where NOTIFICATION_ID = to_number(document_id);
Line: 1279

    select meaning
      into l_sales_document_type_desc
      from oe_lookups
     where LOOKUP_TYPE = 'SALES_DOCUMENT_TYPE'
       and LOOKUP_CODE = l_sales_document_type_code;
Line: 1405

      SELECT parent_item_key
        INTO l_parent_item_key
        FROM wf_items wi
       WHERE wi.item_type = itemtype AND wi.item_key = itemkey;
Line: 1422

      DELETE FROM oe_approver_transactions
            WHERE transaction_id = l_transaction_id;
Line: 1441

             SELECT quote_number
             INTO l_transaction_number
             FROM oe_order_headers_all                              -- 16084377 AME BSA
             WHERE header_id = TO_NUMBER (itemkey);
Line: 1446

             SELECT ORDER_number  -- it is order number. Not quote number.
             INTO l_transaction_number
             FROM oe_blanket_headers_all
             WHERE header_id = TO_NUMBER (itemkey);
Line: 1705

                  SELECT TO_CHAR (oe_ame_parallel_s.NEXTVAL)
                    INTO l_item_key
                    FROM SYS.DUAL;
Line: 1898

                        SELECT sold_to_org_id, expiration_date,
                               salesrep_id, transaction_phase_code,
                               order_type_id
                          INTO l_sold_to_org_id, l_expiration_date,
                               l_salesrep_id, l_transaction_phase_code,
                               l_transaction_type_id
                          FROM oe_order_headers_all
                         WHERE header_id = TO_NUMBER (itemkey);
Line: 1907

                        SELECT obha.sold_to_org_id, obhe.end_date_active,
                               obha.salesrep_id,
                               obha.transaction_phase_code,
                               obha.order_type_id
                          INTO l_sold_to_org_id, l_expiration_date,
                               l_salesrep_id,
                               l_transaction_phase_code,
                               l_transaction_type_id
                          FROM oe_blanket_headers_all obha,
                               oe_blanket_headers_ext obhe
                         WHERE obha.header_id = TO_NUMBER (itemkey)
                           AND obha.order_number = obhe.order_number;
Line: 1977

                  oe_order_wf_util.update_flow_status_code
                     (p_item_type                     => itemtype,
                      p_header_id                     => l_transaction_id,
                      p_flow_status_code              => 'PENDING_INTERNAL_APPROVAL',
                      p_sales_document_type_code      => l_sales_document_type_code,
                      x_return_status                 => l_return_status
                     );
Line: 1988

                        (   'Initiate_Approval STATUS FROM Update_Flow_Status_Code: '
                         || l_return_status
                        );
Line: 2127

      SELECT COUNT (1)
        INTO l_open_children
        FROM wf_items wi
       WHERE wi.item_type = 'OEAME'
         AND wi.parent_item_type = itemtype
         AND wi.parent_item_key = itemkey
         AND wi.item_key <> NVL (g_current_item_key, 'XXXX')
         AND wi.end_date IS NULL;
Line: 2177

         SELECT item_type, item_key
           FROM wf_items
          WHERE parent_item_type = itemtype AND parent_item_key = itemkey;
Line: 2345

            SELECT parent_item_key, parent_item_type
              INTO l_parent_itemkey, l_parent_itemtype
              FROM wf_items
             WHERE item_type = itemtype AND item_key = itemkey;
Line: 2459

               l_step := 'updateApprovalStatus2';
Line: 2464

               ame_api2.updateapprovalstatus2
                             (applicationidin        => 660,
                              transactiontypein      => l_ame_transaction_type,
                              --itemtype,
                              transactionidin        => TO_NUMBER
                                                             (l_parent_itemkey),
                              approvalstatusin       => ame_util.approvedstatus,
                              approvernamein         => l_name,
                              itemclassin            => 'header',
                              itemidin               => TO_NUMBER
                                                             (l_parent_itemkey)
                             );
Line: 2479

               l_step := 'updateApprovalStatus2';
Line: 2484

               ame_api2.updateapprovalstatus2
                             (applicationidin        => 660,
                              transactiontypein      => l_ame_transaction_type,
                              --itemtype,
                              transactionidin        => TO_NUMBER
                                                             (l_parent_itemkey),
                              approvalstatusin       => ame_util.approvedstatus,
                              approvernamein         => l_name,
                              itemclassin            => 'header',
                              itemidin               => TO_NUMBER
                                                             (l_parent_itemkey)
                             );
Line: 2499

               l_step := 'updateApprovalStatus2';
Line: 2504

               ame_api2.updateapprovalstatus2
                             (applicationidin        => 660,
                              transactiontypein      => l_ame_transaction_type,
                              --itemtype,
                              transactionidin        => TO_NUMBER
                                                             (l_parent_itemkey),
                              approvalstatusin       => ame_util.approvedstatus,
                              approvernamein         => l_name,
                              itemclassin            => 'header',
                              itemidin               => TO_NUMBER
                                                             (l_parent_itemkey)
                             );
Line: 2553

               oe_debug_pub.ADD (   'Call AME to Update Status-Approved - '
                                 || itemtype
                                 || '-'
                                 || itemkey,
                                 NULL || '-' || l_application_id
                                );
Line: 2559

               oe_debug_pub.ADD (   'Call AME to Update Status-Approved - '
                                 || itemtype
                                 || '-'
                                 || itemkey
                                 || '-'
                                 || l_application_id
                                 || SQLERRM
                                );
Line: 2671

            SELECT parent_item_key, parent_item_type
              INTO l_parent_itemkey, l_parent_item_type
              FROM wf_items
             WHERE item_type = itemtype AND item_key = itemkey;
Line: 2785

               l_step := 'updateApprovalStatus2';
Line: 2790

               ame_api2.updateapprovalstatus2
                             (applicationidin        => 660,
                              transactiontypein      => l_ame_transaction_type,
                              --itemtype,
                              transactionidin        => TO_NUMBER
                                                             (l_parent_itemkey),
                              approvalstatusin       => ame_util.rejectstatus,
                              approvernamein         => l_name,
                              itemclassin            => 'header',
                              itemidin               => TO_NUMBER
                                                             (l_parent_itemkey)
                             );
Line: 2805

               l_step := 'updateApprovalStatus2';
Line: 2810

               ame_api2.updateapprovalstatus2
                             (applicationidin        => 660,
                              transactiontypein      => l_ame_transaction_type,
                              --itemtype,
                              transactionidin        => TO_NUMBER
                                                             (l_parent_itemkey),
                              approvalstatusin       => ame_util.rejectstatus,
                              approvernamein         => l_name,
                              itemclassin            => 'header',
                              itemidin               => TO_NUMBER
                                                             (l_parent_itemkey)
                             );
Line: 2825

               l_step := 'updateApprovalStatus2';
Line: 2830

               ame_api2.updateapprovalstatus2
                             (applicationidin        => 660,
                              transactiontypein      => l_ame_transaction_type,
                              --itemtype,
                              transactionidin        => TO_NUMBER
                                                             (l_parent_itemkey),
                              approvalstatusin       => ame_util.rejectstatus,
                              approvernamein         => l_name,
                              itemclassin            => 'header',
                              itemidin               => TO_NUMBER
                                                             (l_parent_itemkey)
                             );
Line: 2879

               oe_debug_pub.ADD (   'Call AME to Update Status-Approved - '
                                 || itemtype
                                 || '-'
                                 || itemkey,
                                 NULL || '-' || l_application_id
                                );
Line: 2885

               oe_debug_pub.ADD (   'Call AME to Update Status-Approved - '
                                 || itemtype
                                 || '-'
                                 || itemkey
                                 || '-'
                                 || l_application_id
                                 || SQLERRM
                                );
Line: 2966

         SELECT wfi.item_type, wfi.item_key
           FROM wf_items wfi, wf_item_activity_statuses wfias
          WHERE wfi.parent_item_key = p_itemkey
            AND wfi.item_type = 'OEAME'
            AND wfi.parent_item_type = p_itemtype
            AND wfias.item_type = wfi.item_type
            AND wfias.item_key = wfi.item_key
            AND wfias.activity_status = 'NOTIFIED'
            AND wfias.notification_id IS NOT NULL
            AND wfi.item_key <> itemkey;
Line: 2988

      SELECT parent_item_type, parent_item_key
        INTO l_parent_item_type, l_parent_item_key
        FROM wf_items
       WHERE item_type = itemtype AND item_key = itemkey;
Line: 3107

               oe_debug_pub.ADD (   'api_insertion'
                                 || ' '
                                 || approverlist (i).api_insertion
                                );
Line: 3119

                AND approverlist (i).api_insertion = ame_util.oamgenerated
                AND approverlist (i).group_or_chain_id =
                                                       l_current_appr_group_id
               )
            THEN
               l_orig_system := approverlist (i).orig_system;
Line: 3135

                     SELECT person_id
                       INTO l_person_id
                       FROM (SELECT   person.person_id
                                 FROM per_all_people_f person,
                                      per_all_assignments_f asg
                                WHERE asg.position_id = l_orig_system_id
                                  AND TRUNC (SYSDATE)
                                         BETWEEN person.effective_start_date
                                             AND NVL
                                                   (person.effective_end_date,
                                                    TRUNC (SYSDATE)
                                                   )
                                  AND person.person_id = asg.person_id
                                  AND asg.primary_flag = 'Y'
                                  AND asg.assignment_type IN ('E', 'C')
                                  AND (   person.current_employee_flag = 'Y'
                                       OR person.current_npw_flag = 'Y'
                                      )
                                  AND asg.assignment_status_type_id NOT IN (
                                         SELECT assignment_status_type_id
                                           FROM per_assignment_status_types
                                          WHERE per_system_status =
                                                                 'TERM_ASSIGN')
                                  AND TRUNC (SYSDATE)
                                         BETWEEN asg.effective_start_date
                                             AND asg.effective_end_date
                             ORDER BY person.last_name)
                      WHERE ROWNUM = 1;
Line: 3171

                  SELECT employee_id
                    INTO l_person_id
                    FROM fnd_user
                   WHERE user_id = l_orig_system_id
                     AND TRUNC (SYSDATE) BETWEEN start_date
                                             AND NVL (end_date, SYSDATE + 1);
Line: 3213

                     SELECT 1
                       INTO l_abort
                       FROM wf_item_attribute_values
                      WHERE item_type = l_child_wf_cur.item_type
                        AND NAME = 'ORIG_SYSTEM_ID'
                        AND number_value = l_orig_system_id
                        AND item_key = l_child_wf_cur.item_key;
Line: 3337

	 SELECT use_ame_approval
           INTO l_ame_used
           FROM oe_transaction_types_all
          WHERE transaction_type_id = (SELECT order_type_id
                                         FROM oe_blanket_headers_all                    -- 16084377 AME BSA
                                        WHERE header_id = TO_NUMBER (itemkey));
Line: 3346

	 SELECT use_ame_approval
           INTO l_ame_used
           FROM oe_transaction_types_all
          WHERE transaction_type_id = (SELECT order_type_id
                                         FROM oe_order_headers_all
                                        WHERE header_id = TO_NUMBER (itemkey));
Line: 3373

            SELECT 'Y'
              INTO l_rejected_once
              FROM wf_item_activity_statuses_h wiash,
                   wf_process_activities wpa
             WHERE wiash.process_activity = wpa.instance_id
               AND wiash.item_type = itemtype
               AND wiash.item_key = itemkey
               AND wpa.activity_name = 'INTERNAL_APPROVAL_PROCESS_AME'
               AND wiash.activity_status = 'COMPLETE'
               AND wiash.activity_result_code = 'REJECTED'
               AND ROWNUM = 1;
Line: 3458

      SELECT parent_item_key, parent_item_type
        INTO l_parent_item_key, l_parent_item_type
        FROM wf_items
       WHERE item_type = itemtype AND item_key = itemkey;
Line: 3639

       SELECT category_code
        INTO l_cust_category
        FROM hz_parties hp, fnd_lookup_values fl, fnd_languages fndl    -- 16084377 AME BSA
       WHERE fl.lookup_type = 'CUSTOMER_CATEGORY'
         AND fl.LANGUAGE = fndl.language_code
         AND fndl.installed_flag = 'B'
         AND fl.lookup_code = hp.category_code
         AND party_id = (SELECT sold_to_org_id
                           FROM oe_blanket_headers_all
                          WHERE header_id = p_header_id);
Line: 3657

      SELECT category_code
        INTO l_cust_category
        FROM hz_parties hp, fnd_lookup_values fl, fnd_languages fndl
       WHERE fl.lookup_type = 'CUSTOMER_CATEGORY'
         AND fl.LANGUAGE = fndl.language_code
         AND fndl.installed_flag = 'B'
         AND fl.lookup_code = hp.category_code
         AND party_id = (SELECT sold_to_org_id
                           FROM oe_order_headers_all
                          WHERE header_id = p_header_id);