DBA Data[Home] [Help]

APPS.INV_CYC_LOVS SQL Statements

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

Line: 22

   g_update_flag NUMBER;
Line: 23

   g_insert_flag NUMBER;
Line: 38

   g_updated_prior BOOLEAN := FALSE;  -- Bug 6371673
Line: 65

         SELECT   cycle_count_header_name,
                  cycle_count_header_id,
                  description,
                  inventory_adjustment_account,
                  orientation_code,
                  onhand_visible_flag,
                  zero_count_flag,
                  disable_date,
                  approval_option_code,
                  automatic_recount_flag,
                  unscheduled_count_entry,
                  approval_tolerance_positive,
                  approval_tolerance_negative,
                  cost_tolerance_positive,
                  cost_tolerance_negative,
                  hit_miss_tolerance_positive,
                  hit_miss_tolerance_negative,
                  serial_count_option,
                  serial_detail_option,
                  serial_adjustment_option,
                  serial_discrepancy_option,
                  container_adjustment_option,
                  container_discrepancy_option,
                  container_enabled_flag,
                  cycle_count_type,
                  schedule_empty_locations
         FROM     mtl_cycle_count_headers
         WHERE    organization_id = p_organization_id
         AND      trunc(nvl(disable_date, sysdate+1)) > trunc(sysdate)  --Changed for bug 5519506
         AND      cycle_count_header_name LIKE ( p_cycle_count )
         AND      (     ( cycle_count_header_id IN (
                             SELECT UNIQUE cycle_count_header_id
                             FROM          mtl_cycle_count_entries
                             WHERE         organization_id = p_organization_id
                             AND           entry_status_code IN ( 1, 3 ) )
                        )
                    OR NVL ( unscheduled_count_entry, 2 ) = 1
                  )
         ORDER BY 1;
Line: 135

   PROCEDURE update_count_list_sequence (
      p_organization_id NUMBER,
      p_cycle_count_header_id NUMBER,
      x_count_list_sequence OUT NOCOPY NUMBER
   )
   IS
      PRAGMA AUTONOMOUS_TRANSACTION;
Line: 146

      SELECT NVL ( MAX ( count_list_sequence ), 0 ) + 1
      INTO   l_count_list_sequence
      FROM   mtl_cycle_count_entries
      WHERE  cycle_count_header_id = p_cycle_count_header_id
      AND    organization_id = p_organization_id;
Line: 153

      UPDATE mtl_cycle_count_headers
      SET next_user_count_sequence = l_count_list_sequence + 1
      WHERE  cycle_count_header_id = p_cycle_count_header_id
      AND    organization_id = p_organization_id;
Line: 161

   END update_count_list_sequence;
Line: 188

         SELECT *
         FROM   mtl_cycle_count_entries
         WHERE  cycle_count_header_id = p_cycle_count_header_id
         AND    organization_id = p_organization_id
         AND    subinventory = p_subinventory
         AND    NVL ( locator_id, -99999 ) = NVL ( p_locator_id, -99999 )
         AND    NVL ( parent_lpn_id, -99999 ) = NVL ( p_parent_lpn_id, -99999 )
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    NVL ( lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
         AND    NVL ( serial_number, '@@@@@' ) =
                                             NVL ( l_current_serial, '@@@@@' )
         AND    entry_status_code IN ( 1, 3 );
Line: 204

         SELECT *
         FROM   mtl_cycle_count_entries
         WHERE  cycle_count_header_id = p_cycle_count_header_id
         AND    organization_id = p_organization_id
         AND    subinventory = p_subinventory
         AND    NVL ( locator_id, -99999 ) = NVL ( p_locator_id, -99999 )
         AND    NVL ( parent_lpn_id, -99999 ) = NVL ( p_parent_lpn_id, -99999 )
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    NVL ( lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
         AND    entry_status_code IN ( 1, 3 );
Line: 218

         SELECT *
         FROM   mtl_cycle_count_entries
         WHERE  cycle_count_header_id = p_cycle_count_header_id
         AND    organization_id = p_organization_id
         AND    NVL ( parent_lpn_id, -99999 ) = NVL ( p_parent_lpn_id, -99999 )
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    NVL ( lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
         AND    NVL ( serial_number, '@@@@@' ) =
                                             NVL ( l_current_serial, '@@@@@' )
         AND    entry_status_code IN ( 1, 3 );
Line: 232

         SELECT *
         FROM   mtl_cycle_count_entries
         WHERE  cycle_count_header_id = p_cycle_count_header_id
         AND    organization_id = p_organization_id
         AND    NVL ( parent_lpn_id, -99999 ) = NVL ( p_parent_lpn_id, -99999 )
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    NVL ( lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
         AND    entry_status_code IN ( 1, 3 );
Line: 248

         SELECT *
         FROM   mtl_cycle_count_entries
         WHERE  cycle_count_header_id = p_cycle_count_header_id
         AND    organization_id = p_organization_id
         AND    inventory_item_id = p_inventory_item_id
         AND    serial_number = NVL ( l_current_serial, '@@@@@' )
         AND    entry_status_code IN ( 1, 3 );
Line: 374

         SELECT MIN ( cycle_count_entry_id )
         INTO   l_dispatched_task
         FROM   mtl_cycle_count_entries
         WHERE  cycle_count_header_id = p_cycle_count_header_id
         AND    organization_id = p_organization_id
         AND    subinventory = p_subinventory
         AND    NVL ( locator_id, -99999 ) = NVL ( p_locator_id, -99999 )
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    entry_status_code IN ( 1, 3 );
Line: 393

      SELECT COUNT ( * )
      INTO   l_dispatched_count
      FROM   wms_dispatched_tasks
      WHERE  task_type = 3
      AND    organization_id = p_organization_id
      AND    transaction_temp_id = l_dispatched_task
      AND    person_id <> NVL ( g_employee_id, -999 );
Line: 465

               pre_update ( );
Line: 466

               update_row ( );
Line: 469

               SELECT NVL ( serial_discrepancy_option, 2 ),
                      NVL ( container_discrepancy_option, 2 )
               INTO   l_serial_discrepancy,
                      l_container_discrepancy
               FROM   mtl_cycle_count_headers
               WHERE  cycle_count_header_id = p_cycle_count_header_id
               AND    organization_id = p_organization_id;
Line: 504

                  pre_update ( );
Line: 505

                  update_row ( );
Line: 511

                        print_debug ( 'Unscheduled single serial entry to be inserted'
                                    );
Line: 523

                     /*update_count_list_sequence
                       (p_organization_id        => p_organization_id,
                        p_cycle_count_header_id  => p_cycle_count_header_id,
                        x_count_list_sequence    => l_count_list_sequence);*/
Line: 577

                     g_cc_entry.last_update_date := SYSDATE;
Line: 578

                     g_cc_entry.last_updated_by := p_user_id;
Line: 581

                     g_cc_entry.last_update_login := g_login_id;
Line: 586

                     pre_insert ( );
Line: 587

                     insert_row ( );
Line: 631

            SELECT serial_count_option,
                   serial_detail_option
            INTO   l_serial_count_option,
                   l_serial_detail_option
            FROM mtl_cycle_count_headers
            WHERE cycle_count_header_id = p_cycle_count_header_id
            AND   organization_id       = p_organization_id;
Line: 660

                 pre_update ( );
Line: 661

                 update_row ( );
Line: 666

            SELECT NVL ( serial_discrepancy_option, 2 ),
                   NVL ( container_discrepancy_option, 2 )
            INTO   l_serial_discrepancy,
                   l_container_discrepancy
            FROM   mtl_cycle_count_headers
            WHERE  cycle_count_header_id = p_cycle_count_header_id
            AND    organization_id = p_organization_id;
Line: 700

               pre_update ( );
Line: 701

               update_row ( );
Line: 723

            pre_update ( );
Line: 724

            update_row ( );
Line: 727

            SELECT NVL ( container_discrepancy_option, 2 )
            INTO   l_container_discrepancy
            FROM   mtl_cycle_count_headers
            WHERE  cycle_count_header_id = p_cycle_count_header_id
            AND    organization_id = p_organization_id;
Line: 753

               pre_update ( );
Line: 754

               update_row ( );
Line: 760

                     print_debug ( 'Unscheduled non-serial entry to be inserted'
                                 );
Line: 772

                  /*update_count_list_sequence
                    (p_organization_id        => p_organization_id,
                p_cycle_count_header_id  => p_cycle_count_header_id,
                x_count_list_sequence    => l_count_list_sequence);*/
Line: 825

                  g_cc_entry.last_update_date := SYSDATE;
Line: 826

                  g_cc_entry.last_updated_by := p_user_id;
Line: 829

                  g_cc_entry.last_update_login := g_login_id;
Line: 834

                  pre_insert ( );
Line: 835

                  insert_row ( );
Line: 909

   PROCEDURE delete_wdt(
      p_cycle_count_header_id    IN    NUMBER            ,
      p_organization_id          IN    NUMBER            ,
      p_subinventory             IN    VARCHAR2          ,
      p_locator_id               IN    NUMBER            ,
      p_parent_lpn_id            IN    NUMBER            ,
      p_inventory_item_id        IN    NUMBER            ,
      p_revision                 IN    VARCHAR2          ,
      p_lot_number               IN    VARCHAR2          ,
      p_from_serial_number       IN    VARCHAR2          ,
      p_to_serial_number         IN    VARCHAR2          ,
      p_count_quantity           IN    NUMBER            ,
      p_count_uom                IN    VARCHAR2          ,
      p_unscheduled_count_entry  IN    NUMBER            ,
      p_user_id                  IN    NUMBER            ,
      p_cost_group_id            IN    NUMBER            )

      IS
         l_cycle_count_entry_id NUMBER;
Line: 932

            SELECT  cycle_count_entry_id
            FROM   mtl_cycle_count_entries mcce, wms_dispatched_tasks wdt
            WHERE  mcce.cycle_count_header_id = p_cycle_count_header_id
            AND    mcce.cycle_count_entry_id = wdt.transaction_temp_id
            AND    mcce.organization_id = p_organization_id
            AND    mcce.subinventory = p_subinventory
            AND    mcce.locator_id = p_locator_id
            AND    NVL (mcce.parent_lpn_id, -99999) = NVL ( p_parent_lpn_id, -99999)
            AND    mcce.inventory_item_id = NVL (p_inventory_item_id, mcce.inventory_item_id)
            AND    NVL (mcce.revision, '@@@@@' ) = NVL (p_revision , '@@@@@' )
            AND    NVL (mcce.lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
            AND    NVL (mcce.serial_number, '@@@@@' ) = NVL ( p_from_serial_number, '@@@@@' )
            AND    NVL (mcce.serial_number, '@@@@@' ) = NVL ( p_to_serial_number, '@@@@@' )
            AND    mcce.entry_status_code IN (2, 4, 5 );
Line: 949

            print_debug ( '***In delete_wdt ***');
Line: 987

                   DELETE FROM wms_dispatched_tasks wdt
                   WHERE wdt.transaction_temp_id = l_cycle_count_entry_id;
Line: 990

                      print_debug('** Deleted wms_dispatched_tasks record with transaction_temp_id : ' || l_cycle_count_entry_id);
Line: 1007

              print_debug ( 'Exiting delete_wdt');
Line: 1010

   END delete_wdt;
Line: 1019

   PROCEDURE insert_row
   IS
      l_return_status VARCHAR2 ( 300 );
Line: 1033

         print_debug ( '***insert_row***' );
Line: 1050

           SELECT outermost_lpn_id
           INTO   g_cc_entry.outermost_lpn_id
           FROM   WMS_LICENSE_PLATE_NUMBERS
           WHERE  lpn_id = g_cc_entry.parent_lpn_id;
Line: 1071

		 If the primary values match (q_p =q_p') then conversion to transaction UOM is exact, so insert q_t
		 Otherwise, insert q_p */
	  IF g_count_uom <> g_orig_count_uom then
		IF ( l_debug = 1 ) THEN
		 print_debug('g_cc_entry.count_quantity_current: ' || g_cc_entry.count_quantity_current);
Line: 1145

      INSERT INTO mtl_cycle_count_entries
                  ( cycle_count_entry_id,
                    last_update_date,
                    last_updated_by,
                    creation_date,
                    created_by,
                    last_update_login,
                    count_list_sequence,
                    count_date_first,
                    count_date_current,
-- Commented the Line Below for Bug 8333418
--                    count_date_prior,
                    count_date_dummy,
                    counted_by_employee_id_first,
                    counted_by_employee_id_current,
-- Commented the Line Below for Bug 8333418
--                    counted_by_employee_id_prior,
                    counted_by_employee_id_dummy,
                    count_uom_first,
                    count_uom_current,
-- Commented the Line Below for Bug 8333418
--                    count_uom_prior,
                    count_quantity_first,
                    count_quantity_current,
-- Commented the Line Below for Bug 8333418
--                    count_quantity_prior,
                    inventory_item_id,
                    subinventory,
                    entry_status_code,
                    count_due_date,
                    organization_id,
                    cycle_count_header_id,
                    number_of_counts,
                    locator_id,
                    adjustment_quantity,
                    adjustment_date,
                    adjustment_amount,
                    item_unit_cost,
                    inventory_adjustment_account,
                    approval_date,
                    approver_employee_id,
                    revision,
                    lot_number,
                    lot_control,
                    system_quantity_first,
                    system_quantity_current,
-- Commented the Line Below for Bug 8333418
--                    system_quantity_prior,
                    reference_first,
                    reference_current,
-- Commented the Line Below for Bug 8333418
--                    reference_prior,
                    primary_uom_quantity_first,
                    primary_uom_quantity_current,
-- Commented the Line Below for Bug 8333418
--                    primary_uom_quantity_prior,
                    count_type_code,
                    transaction_reason_id,
                    request_id,
                    program_application_id,
                    program_id,
                    program_update_date,
                    approval_type,
                    attribute_category,
                    attribute1,
                    attribute2,
                    attribute3,
                    attribute4,
                    attribute5,
                    attribute6,
                    attribute7,
                    attribute8,
                    attribute9,
                    attribute10,
                    attribute11,
                    attribute12,
                    attribute13,
                    attribute14,
                    attribute15,
                    serial_number,
                    serial_detail,
                    approval_condition,
                    neg_adjustment_quantity,
                    neg_adjustment_amount,
                    export_flag,
                    task_priority,
                    standard_operation_id,
                    parent_lpn_id,
                    outermost_lpn_id,
                    cost_group_id
                    -- INVCONV, NSRIVAST
                    ,secondary_uom_quantity_first
                    ,secondary_uom_quantity_current
                    ,secondary_uom_quantity_prior
                    ,count_secondary_uom_first
                    ,count_secondary_uom_current
                    ,count_secondary_uom_prior
                    -- INVCONV, NSRIVAST
                    ,SECONDARY_ADJUSTMENT_QUANTITY     --bug fix 7429096
                    ,SECONDARY_SYSTEM_QTY_FIRST             --bug fix 7429096
                    ,SECONDARY_SYSTEM_QTY_CURRENT      --bug fix 7429096
                  )
           VALUES ( g_cc_entry.cycle_count_entry_id,
                    g_cc_entry.last_update_date,
                    g_cc_entry.last_updated_by,
                    g_cc_entry.creation_date,
                    g_cc_entry.created_by,
                    g_cc_entry.last_update_login,
                    g_cc_entry.count_list_sequence,
                    g_cc_entry.count_date_first,
                    g_cc_entry.count_date_current,
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.count_date_prior,
                    g_cc_entry.count_date_dummy,
                    g_cc_entry.counted_by_employee_id_first,
                    g_cc_entry.counted_by_employee_id_current,
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.counted_by_employee_id_prior,
                    g_cc_entry.counted_by_employee_id_dummy,
                    g_cc_entry.count_uom_first,
                    l_uom, --10318308
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.count_uom_prior,
                    g_cc_entry.count_quantity_first,
                    l_current_quantity, --10318308
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.count_quantity_prior,
                    g_cc_entry.inventory_item_id,
                    g_cc_entry.subinventory,
                    g_cc_entry.entry_status_code,
                    g_cc_entry.count_due_date,
                    g_cc_entry.organization_id,
                    g_cc_entry.cycle_count_header_id,
                    g_cc_entry.number_of_counts,
                    g_cc_entry.locator_id,
                    l_adjustment_quantity, --10318308
                    g_cc_entry.adjustment_date,
                    g_cc_entry.adjustment_amount,
                    g_cc_entry.item_unit_cost,
                    g_cc_entry.inventory_adjustment_account,
                    g_cc_entry.approval_date,
                    g_cc_entry.approver_employee_id,
                    g_cc_entry.revision,
                    g_cc_entry.lot_number,
                    g_cc_entry.lot_control,
                    g_cc_entry.system_quantity_first,
                    g_cc_entry.system_quantity_current,
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.system_quantity_prior,
                    g_cc_entry.reference_first,
                    g_cc_entry.reference_current,
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.reference_prior,
                    g_cc_entry.primary_uom_quantity_first,
                    g_cc_entry.primary_uom_quantity_current,
-- Commented the Line Below for Bug 8333418
--                    g_cc_entry.primary_uom_quantity_prior,
                    g_cc_entry.count_type_code,
                    g_cc_entry.transaction_reason_id,
                    g_cc_entry.request_id,
                    g_cc_entry.program_application_id,
                    g_cc_entry.program_id,
                    g_cc_entry.program_update_date,
                    g_cc_entry.approval_type,
                    g_cc_entry.attribute_category,
                    g_cc_entry.attribute1,
                    g_cc_entry.attribute2,
                    g_cc_entry.attribute3,
                    g_cc_entry.attribute4,
                    g_cc_entry.attribute5,
                    g_cc_entry.attribute6,
                    g_cc_entry.attribute7,
                    g_cc_entry.attribute8,
                    g_cc_entry.attribute9,
                    g_cc_entry.attribute10,
                    g_cc_entry.attribute11,
                    g_cc_entry.attribute12,
                    g_cc_entry.attribute13,
                    g_cc_entry.attribute14,
                    g_cc_entry.attribute15,
                    LTRIM ( RTRIM ( g_cc_entry.serial_number ) ),
                                                                /* BUG2842145*/
                    g_cc_entry.serial_detail,
                    g_cc_entry.approval_condition,
                    g_cc_entry.neg_adjustment_quantity,
                    g_cc_entry.neg_adjustment_amount,
                    g_cc_entry.export_flag,
                    g_cc_entry.task_priority,
                    g_cc_entry.standard_operation_id,
                    g_cc_entry.parent_lpn_id,
                    g_cc_entry.outermost_lpn_id,
                    g_cc_entry.cost_group_id
                    -- INVCONV, NSRIVAST
                    ,g_cc_entry.secondary_uom_quantity_first
                    ,g_cc_entry.secondary_uom_quantity_current
                    ,g_cc_entry.secondary_uom_quantity_prior
                    ,g_cc_entry.count_secondary_uom_first
                    ,g_cc_entry.count_secondary_uom_current
                    ,g_cc_entry.count_secondary_uom_prior
                    -- INVCONV, NSRIVAST
                    ,g_cc_entry.SECONDARY_ADJUSTMENT_QUANTITY  --bug fix 7429096
                    ,g_cc_entry.SECONDARY_SYSTEM_QTY_FIRST          --bug fix 7429096
                    ,g_cc_entry.SECONDARY_SYSTEM_QTY_CURRENT   --bug fix 7429096
                  );
Line: 1353

   END insert_row;
Line: 1355

   PROCEDURE update_row
   IS
      l_return_status VARCHAR2 ( 300 );
Line: 1366

         print_debug ( '***update_row***' );
Line: 1370

      g_cc_entry.last_update_date := SYSDATE;
Line: 1371

      g_cc_entry.last_updated_by := g_user_id;
Line: 1372

      g_cc_entry.last_update_login := g_login_id;
Line: 1387

           SELECT outermost_lpn_id
           INTO   g_cc_entry.outermost_lpn_id
           FROM   WMS_LICENSE_PLATE_NUMBERS
           WHERE  lpn_id = g_cc_entry.parent_lpn_id;
Line: 1403

      UPDATE mtl_cycle_count_entries
      SET last_update_date = g_cc_entry.last_update_date,
          last_updated_by = g_cc_entry.last_updated_by,
          last_update_login = g_cc_entry.last_update_login,
          count_list_sequence = g_cc_entry.count_list_sequence,
          count_date_first = g_cc_entry.count_date_first,
          count_date_current = g_cc_entry.count_date_current,
          count_date_prior = g_cc_entry.count_date_prior,
          count_date_dummy = g_cc_entry.count_date_dummy,
          counted_by_employee_id_first =
                                       g_cc_entry.counted_by_employee_id_first,
          counted_by_employee_id_current =
                                     g_cc_entry.counted_by_employee_id_current,
          counted_by_employee_id_prior =
                                       g_cc_entry.counted_by_employee_id_prior,
          counted_by_employee_id_dummy =
                                       g_cc_entry.counted_by_employee_id_dummy,
          count_uom_first = g_cc_entry.count_uom_first,
          count_uom_current = g_cc_entry.count_uom_current,
          count_uom_prior = g_cc_entry.count_uom_prior,
          count_quantity_first = g_cc_entry.count_quantity_first,
          count_quantity_current = g_cc_entry.count_quantity_current,
          count_quantity_prior = g_cc_entry.count_quantity_prior,
          inventory_item_id = g_cc_entry.inventory_item_id,
          subinventory = g_cc_entry.subinventory,
          entry_status_code = g_cc_entry.entry_status_code,
          count_due_date = g_cc_entry.count_due_date,
          organization_id = g_cc_entry.organization_id,
          cycle_count_header_id = g_cc_entry.cycle_count_header_id,
          number_of_counts = g_cc_entry.number_of_counts,
          locator_id = g_cc_entry.locator_id,
          adjustment_quantity = g_cc_entry.adjustment_quantity,
          adjustment_date = g_cc_entry.adjustment_date,
          adjustment_amount = g_cc_entry.adjustment_amount,
          item_unit_cost = g_cc_entry.item_unit_cost,
          inventory_adjustment_account =
                                       g_cc_entry.inventory_adjustment_account,
          approval_date = g_cc_entry.approval_date,
          approver_employee_id = g_cc_entry.approver_employee_id,
          revision = g_cc_entry.revision,
          lot_number = g_cc_entry.lot_number,
          lot_control = g_cc_entry.lot_control,
          system_quantity_first = g_cc_entry.system_quantity_first,
          system_quantity_current = g_cc_entry.system_quantity_current,
          system_quantity_prior = g_cc_entry.system_quantity_prior,
          reference_first = g_cc_entry.reference_first,
          reference_current = g_cc_entry.reference_current,
          reference_prior = g_cc_entry.reference_prior,
          primary_uom_quantity_first = g_cc_entry.primary_uom_quantity_first,
          primary_uom_quantity_current =
                                       g_cc_entry.primary_uom_quantity_current,
          primary_uom_quantity_prior = g_cc_entry.primary_uom_quantity_prior,
          count_type_code = g_cc_entry.count_type_code,
          transaction_reason_id = g_cc_entry.transaction_reason_id,
          approval_type = g_cc_entry.approval_type,
          attribute_category = g_cc_entry.attribute_category,
          attribute1 = g_cc_entry.attribute1,
          attribute2 = g_cc_entry.attribute2,
          attribute3 = g_cc_entry.attribute3,
          attribute4 = g_cc_entry.attribute4,
          attribute5 = g_cc_entry.attribute5,
          attribute6 = g_cc_entry.attribute6,
          attribute7 = g_cc_entry.attribute7,
          attribute8 = g_cc_entry.attribute8,
          attribute9 = g_cc_entry.attribute9,
          attribute10 = g_cc_entry.attribute10,
          attribute11 = g_cc_entry.attribute11,
          attribute12 = g_cc_entry.attribute12,
          attribute13 = g_cc_entry.attribute13,
          attribute14 = g_cc_entry.attribute14,
          attribute15 = g_cc_entry.attribute15,
          serial_number = g_cc_entry.serial_number,
          serial_detail = g_cc_entry.serial_detail,
          approval_condition = g_cc_entry.approval_condition,
          neg_adjustment_quantity = g_cc_entry.neg_adjustment_quantity,
          neg_adjustment_amount = g_cc_entry.neg_adjustment_amount,
          parent_lpn_id = g_cc_entry.parent_lpn_id,
          outermost_lpn_id = g_cc_entry.outermost_lpn_id,
          cost_group_id = g_cc_entry.cost_group_id
           -- INVCONV, NSRIVAST
          ,secondary_uom_quantity_first    =   g_cc_entry.secondary_uom_quantity_first ,
          secondary_uom_quantity_current  =   g_cc_entry.secondary_uom_quantity_current,
          secondary_uom_quantity_prior    =   g_cc_entry.secondary_uom_quantity_prior ,
          count_secondary_uom_first       =   g_cc_entry.count_secondary_uom_first,
          count_secondary_uom_current     =   g_cc_entry.count_secondary_uom_current,
          count_secondary_uom_prior       =   g_cc_entry.count_secondary_uom_prior,
          -- INVCONV, NSRIVAST
	  -- nsinghi Bug#6052831 START
	  secondary_adjustment_quantity   =   g_cc_entry.secondary_adjustment_quantity,
	  secondary_system_qty_current    =   g_cc_entry.secondary_system_qty_current,
	  secondary_system_qty_first      =   g_cc_entry.secondary_system_qty_first,
	  secondary_system_qty_prior      =   g_cc_entry.secondary_system_qty_prior
	  -- nsinghi Bug#6052831 END
      WHERE  cycle_count_entry_id = g_cc_entry.cycle_count_entry_id;
Line: 1504

          print_debug ( 'Update the wms_picking_pkg.g_previous_task_status table.' );
Line: 1507

        SELECT transaction_temp_id into l_temp_cc_id
        FROM wms_dispatched_tasks wdt
        WHERE wdt.transaction_temp_id          = g_cc_entry.cycle_count_entry_id;
Line: 1517

   END update_row;
Line: 1643

      SELECT primary_uom_code
      INTO   l_primary_uom
      FROM   MTL_SYSTEM_ITEMS
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 1711

         SELECT abc_class_id
         INTO   l_abc_class_id
         FROM   mtl_cycle_count_items
         WHERE  cycle_count_header_id = l_cycle_count_header_id
         AND    inventory_item_id = l_inventory_item_id;
Line: 1723

         SELECT approval_tolerance_positive,
                approval_tolerance_negative
         INTO   l_item_app_tol_pos,
                l_item_app_tol_neg
         FROM   mtl_cycle_count_items
         WHERE  cycle_count_header_id = l_cycle_count_header_id
         AND    inventory_item_id = l_inventory_item_id;
Line: 1736

         SELECT approval_tolerance_positive,
                approval_tolerance_negative,
                cost_tolerance_positive,
                cost_tolerance_negative
         INTO   l_class_app_tol_pos,
                l_class_app_tol_neg,
                l_class_cost_tol_pos,
                l_class_cost_tol_neg
         FROM   mtl_cycle_count_classes
         WHERE  abc_class_id = l_abc_class_id
         AND    cycle_count_header_id = l_cycle_count_header_id;
Line: 1754

      SELECT NVL ( approval_tolerance_positive, -1 ),
             NVL ( approval_tolerance_negative, -1 ),
             NVL ( cost_tolerance_positive, -1 ),
             NVL ( cost_tolerance_negative, -1 )
      INTO   l_head_app_tol_pos,
             l_head_app_tol_neg,
             l_head_cost_tol_pos,
             l_head_cost_tol_neg
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = l_cycle_count_header_id
      AND    organization_id = l_organization_id;
Line: 1853

      IF ( g_cc_entry.entry_status_code = 3 ) AND g_updated_prior = FALSE THEN		-- Modified for Bug 6371673
         current_to_prior ( );
Line: 1899

      SELECT primary_uom_code
      INTO   l_primary_uom
      FROM   MTL_SYSTEM_ITEMS
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 1952

         SELECT positive_measurement_error,
                negative_measurement_error,
                parent_lpn_id
         INTO   l_pos_meas_err,
                l_neg_meas_err,
                l_parent_lpn_id
         FROM   mtl_cycle_count_entries_v
         WHERE  cycle_count_entry_id = g_cc_entry.cycle_count_entry_id
         AND    organization_id = g_cc_entry.organization_id;
Line: 1969

      SELECT NVL ( container_enabled_flag, 2 ),
             NVL ( container_adjustment_option, 2 ),
             NVL ( container_discrepancy_option, 2 )
      INTO   l_container_enabled_flag,
             l_container_adjustment_option,
             l_container_discrepancy_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 1980

      SELECT NVL ( approval_option_code, 1 )
      INTO   l_approval_option_code
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2124

      final_preupdate_logic ( );
Line: 2141

      SELECT NVL ( approval_option_code, 1 )
      INTO   l_approval_option_code
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2150

      SELECT NVL ( container_enabled_flag, 2 ),
             NVL ( container_adjustment_option, 2 ),
             NVL ( container_discrepancy_option, 2 )
      INTO   l_container_enabled_flag,
             l_container_adjustment_option,
             l_container_discrepancy_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2200

      SELECT NVL ( approval_option_code, 1 ),
             NVL ( automatic_recount_flag, 2 ),
             NVL ( maximum_auto_recounts, 0 ),
             NVL ( days_until_late, 0 ),
             NVL ( serial_count_option, 1 )
      INTO   l_approval_option_code,
             l_auto_recount_flag,
             l_max_recounts,
             l_days_until_late,
             l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2215

      SELECT NVL ( container_enabled_flag, 2 ),
             NVL ( container_adjustment_option, 2 ),
             NVL ( container_discrepancy_option, 2 )
      INTO   l_container_enabled_flag,
             l_container_adjustment_option,
             l_container_discrepancy_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2226

         SELECT serial_number_control_code
         INTO   l_serial_number_ctrl_code
         FROM   mtl_system_items
         WHERE  inventory_item_id = g_cc_entry.inventory_item_id
         AND    organization_id = g_cc_entry.organization_id;
Line: 2292

   PROCEDURE pre_insert
   IS
      l_number_of_counts NUMBER := NVL ( g_cc_entry.number_of_counts, 0 );
Line: 2323

         print_debug ( '***pre_insert***' );
Line: 2328

      SELECT serial_number_control_code
      INTO   l_serial_number_ctrl_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2334

      SELECT NVL ( serial_detail_option, 1 ),
             NVL ( serial_count_option, 1 )
      INTO   l_serial_detail_option,
             l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2358

         SELECT mtl_cycle_count_entries_s.NEXTVAL
         INTO   l_cc_entry_id
         FROM   DUAL;
Line: 2382

            SELECT primary_uom_code
            INTO   l_primary_uom
            FROM   MTL_SYSTEM_ITEMS
            WHERE  inventory_item_id = g_cc_entry.inventory_item_id
            AND    organization_id = g_cc_entry.organization_id;
Line: 2433

               print_debug('Called from pre_insert ');
Line: 2434

               final_preupdate_logic ( );
Line: 2474

                  SELECT primary_uom_code
                  INTO   l_primary_uom
                  FROM   MTL_SYSTEM_ITEMS
                  WHERE  inventory_item_id = g_cc_entry.inventory_item_id
                  AND    organization_id = g_cc_entry.organization_id;
Line: 2521

                  UPDATE MTL_MATERIAL_TRANSACTIONS_TEMP
                  SET LOCATOR_ID = l_locator_id
                  WHERE  CYCLE_COUNT_ID = l_cc_entry_id
                  AND    TRANSACTION_SOURCE_ID = l_cc_header_id
                  AND    LOCATOR_ID = -1;
Line: 2530

                         UPDATE MTL_CC_SERIAL_NUMBERS
                         SET
                                UNIT_STATUS_CURRENT = DECODE((NVL(POS_ADJUSTMENT_QTY,0) -
                                      NVL(NEG_ADJUSTMENT_QTY,0)), 1, 2, -1, 1, UNIT_STATUS_CURRENT),
                                POS_ADJUSTMENT_QTY = 0,
                                NEG_ADJUSTMENT_QTY = 0,
                                APPROVAL_CONDITION = NULL
                         WHERE CYCLE_COUNT_ENTRY_ID = l_cc_entry_id;
Line: 2571

               SELECT primary_uom_code
               INTO   l_primary_uom
               FROM   MTL_SYSTEM_ITEMS
               WHERE  inventory_item_id = g_cc_entry.inventory_item_id
               AND    organization_id = g_cc_entry.organization_id;
Line: 2624

   END pre_insert;
Line: 2626

   PROCEDURE pre_update
   IS
      l_number_of_counts NUMBER := NVL ( g_cc_entry.number_of_counts, 0 );
Line: 2668

         print_debug ( '***pre_update***' );
Line: 2688

            SELECT NVL ( subinventory_code, '###' ),
                   NVL ( locator_id, -99 ),
                   lpn_context
            INTO   l_lpn_subinv,
                   l_lpn_locator_id,
                   l_lpn_context
            FROM   WMS_LICENSE_PLATE_NUMBERS
            WHERE  lpn_id = g_cc_entry.parent_lpn_id ;
Line: 2729

      SELECT serial_number_control_code
      INTO   l_serial_number_ctrl_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2735

      SELECT NVL ( serial_detail_option, 1 ),
             NVL ( serial_count_option, 1 )
      INTO   l_serial_detail_option,
             l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 2745

      SELECT NVL ( number_of_counts, 0 )
      INTO   l_old_num_counts
      FROM   mtl_cycle_count_entries
      WHERE  cycle_count_entry_id = l_cc_entry_id;
Line: 2751

         FND_MESSAGE.SET_NAME ( 'INV', 'INV_DUPLICATE_COUNT_UPDATE' );
Line: 2772

            SELECT primary_uom_code
            INTO   l_primary_uom
            FROM   MTL_SYSTEM_ITEMS
            WHERE  inventory_item_id = g_cc_entry.inventory_item_id
            AND    organization_id = g_cc_entry.organization_id;
Line: 2810

	       g_updated_prior := TRUE;				-- Bug 6371673
Line: 2824

               print_debug('from pre_update : 1');
Line: 2825

               final_preupdate_logic ( );
Line: 2834

	    g_updated_prior := FALSE;	-- Bug 6371673
Line: 2860

                  SELECT SUM ( DECODE ( UNIT_STATUS_CURRENT, 1, 1, 0 ) )
                  INTO   l_total_serial_num_cnt
                  FROM   MTL_CC_SERIAL_NUMBERS
                  WHERE  CYCLE_COUNT_ENTRY_ID = l_cc_entry_id;
Line: 2878

                        print_debug ( 'Multiple entry has been completed so call final_preupdate_logic'
                                    );
Line: 2887

                     print_debug('from pre_update : 2');
Line: 2888

                     final_preupdate_logic ( );
Line: 2903

               SELECT primary_uom_code
               INTO   l_primary_uom
               FROM   MTL_SYSTEM_ITEMS
               WHERE  inventory_item_id = g_cc_entry.inventory_item_id
               AND    organization_id = g_cc_entry.organization_id;
Line: 2952

                     UPDATE MTL_CC_SERIAL_NUMBERS
                         SET
                                UNIT_STATUS_CURRENT = DECODE((NVL(POS_ADJUSTMENT_QTY,0) -
                                      NVL(NEG_ADJUSTMENT_QTY,0)), 1, 2, -1, 1, UNIT_STATUS_CURRENT),
                                POS_ADJUSTMENT_QTY = 0,
                                NEG_ADJUSTMENT_QTY = 0,
                                APPROVAL_CONDITION = NULL
                         WHERE CYCLE_COUNT_ENTRY_ID = l_cc_entry_id;
Line: 2989

               SELECT primary_uom_code
               INTO   l_primary_uom
               FROM   MTL_SYSTEM_ITEMS
               WHERE  inventory_item_id = g_cc_entry.inventory_item_id
               AND    organization_id = g_cc_entry.organization_id;
Line: 3054

   END pre_update;
Line: 3056

   PROCEDURE final_preupdate_logic
   IS
      l_entry_status_code NUMBER := g_cc_entry.entry_status_code;
Line: 3148

         print_debug ( '***final_preupdate_logic***' );
Line: 3157

      SELECT primary_uom_code
      INTO   l_to_uom
      FROM   MTL_SYSTEM_ITEMS
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 3163

      SELECT serial_number_control_code
      INTO   l_serial_number_ctrl_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 3169

      SELECT NVL ( serial_count_option, 1 ),
             NVL ( inventory_adjustment_account, -1 )
      INTO   l_serial_count_option,
             l_txn_acct_id
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 3177

      SELECT concatenated_segments
      INTO   l_item_name
      FROM   mtl_system_items_kfv
      WHERE  inventory_item_id = l_item_id AND organization_id = l_org_id;
Line: 3184

          delete_reservation ( );
Line: 3189

      SELECT negative_inv_receipt_code
      INTO   l_neg_inv_rcpt_code --Negative Balance  1:Allowed   2:Disallowed
      FROM   mtl_parameters
      WHERE  organization_id = l_org_id;
Line: 3210

         SELECT serial_number_control_code,
                lot_control_code,
                revision_qty_control_code
         INTO   v_ser_code,
                v_lot_code,
                v_rev_code
         FROM   mtl_system_items
         WHERE  inventory_item_id = l_item_id AND organization_id = l_org_id;
Line: 3235

             SELECT NVL ( subinventory_code, '###' ),
                    NVL ( locator_id, -99 ),
		            outermost_lpn_id,         --13053297
	                NVL(parent_lpn_id,-99) ,   --13053297
                    lpn_context
               INTO l_lpn_subinv,
                    l_lpn_locator_id,
		            l_outermost_lpn_id, --13053297
		            l_parent_lpn_id ,    --13053297
                    l_lpn_context   --13398739
               FROM WMS_LICENSE_PLATE_NUMBERS
              WHERE lpn_id = l_lpn_id;
Line: 3445

        /* Bug 5725198-Added the check for LPN being counted to update quantity tree */
           IF (( l_lpn_id IS NOT NULL ) AND (l_lpn_subinv <> '###' AND l_lpn_locator_id <> -99)) THEN
              inv_quantity_tree_pub.update_quantities ( p_api_version_number => 1.0,
                                                        p_init_msg_lst      => 'F',
                                                        x_return_status     => x_return_status,
                                                        x_msg_count         => l_msg_count,
                                                        x_msg_data          => l_msg_data,
                                                        p_organization_id   => l_org_id,
                                                        p_inventory_item_id => l_item_id,
                                                        p_tree_mode         => 1,
                                                        p_is_revision_control => v_is_rev_controlled,
                                                        p_is_lot_control    => v_is_lot_controlled,
                                                        p_is_serial_control => v_is_ser_controlled,
                                                        p_demand_source_type_id => NULL,
                                                        p_revision          => l_rev,
                                                        p_lot_number        => l_lot_num,
                                                        p_subinventory_code => l_lpn_subinv,
                                                        p_locator_id        => l_lpn_locator_id,
                                                        p_onhand_source     => 3,
                                                        p_containerized     => 0,
                                                        p_primary_quantity  => ABS ( l_adjustment_quantity
                                                                                   ),
                                                        p_secondary_quantity => ABS ( l_sec_adjustment_quantity ), -- nsinghi bug#6052831
                                                        p_quantity_type     => 5,
                                                        x_qoh               => x_qoh,
                                                        x_rqoh              => l_rqoh,
                                                        x_qr                => l_qr,
                                                        x_qs                => l_qs,
                                                        x_att               => x_att,
                                                        x_atr               => l_atr,
                                                        p_lpn_id            => l_lpn_id,
                                                        -- nsinghi bug#6052831 START
                                                        x_sqoh              => l_sqoh,
                                                        x_srqoh             => l_srqoh,
                                                        x_sqr               => l_sqr,
                                                        x_sqs               => l_sqs,
                                                        x_satt              => l_satt,
                                                        x_satr              => l_satr
                                                        -- nsinghi bug#6052831 END
                                                      );
Line: 3498

         inv_quantity_tree_pub.update_quantities ( p_api_version_number => 1.0,
                                                   p_init_msg_lst      => 'F',
                                                   x_return_status     => x_return_status,
                                                   x_msg_count         => l_msg_count,
                                                   x_msg_data          => l_msg_data,
                                                   p_organization_id   => l_org_id,
                                                   p_inventory_item_id => l_item_id,
                                                   p_tree_mode         => 1,
                                                   p_is_revision_control => v_is_rev_controlled,
                                                   p_is_lot_control    => v_is_lot_controlled,
                                                   p_is_serial_control => v_is_ser_controlled,
                                                   p_demand_source_type_id => NULL,
                                                   p_revision          => l_rev,
                                                   p_lot_number        => l_lot_num,
                                                   p_subinventory_code => l_sub,
                                                   p_locator_id        => l_locator_id,
                                                   p_onhand_source     => 3,
                                                   p_containerized     => 0,
                                                   p_primary_quantity  => ABS ( l_adjustment_quantity
                                                                              ),
                                                   p_secondary_quantity => ABS ( l_sec_adjustment_quantity ), -- nsinghi bug#6052831
                                                   p_quantity_type     => 5,
                                                   x_qoh               => x_qoh,
                                                   x_rqoh              => l_rqoh,
                                                   x_qr                => l_qr,
                                                   x_qs                => l_qs,
                                                   x_att               => x_att,
                                                   x_atr               => l_atr,
                                                   p_lpn_id            => NULL, --added for lpn reservation
                                                   -- nsinghi bug#6052831 START
                                                   x_sqoh              => l_sqoh,
                                                   x_srqoh             => l_srqoh,
                                                   x_sqr               => l_sqr,
                                                   x_sqs               => l_sqs,
                                                   x_satt              => l_satt,
                                                   x_satr              => l_satr
                                                   -- nsinghi bug#6052831 END
                                                 );
Line: 3577

/*         SELECT NVL ( subinventory_code, '###' ),
                NVL ( locator_id, -99 )
         INTO   l_lpn_subinv,
                l_lpn_locator_id
         FROM   WMS_LICENSE_PLATE_NUMBERS
         WHERE  lpn_id = l_lpn_id;
Line: 3625

            SELECT mtl_material_transactions_s.NEXTVAL
            INTO   l_txn_header_id
            FROM   DUAL;
Line: 3639

            SELECT mtl_material_transactions_s.NEXTVAL
            INTO   l_txn_temp_id
            FROM   DUAL;
Line: 3643

            SELECT auto_serial_alpha_prefix
            INTO   l_serial_prefix
            FROM   mtl_system_items
            WHERE  inventory_item_id = l_item_id
                   AND organization_id = l_org_id;
Line: 3675

            SELECT NVL ( REVISION, 'XXX' ),
                   NVL ( LOT_NUMBER, 'X' ),
                   CURRENT_STATUS,
                   CURRENT_SUBINVENTORY_CODE,
                   NVL ( CURRENT_LOCATOR_ID, 0 ),
                   NVL ( LPN_ID, -99 )
            INTO   l_msn_revision,
                   l_msn_lot_number,
                   l_current_status,
                   l_msn_subinv,
                   l_msn_locator_id,
                   l_msn_lpn_id
            FROM   MTL_SERIAL_NUMBERS
            WHERE  SERIAL_NUMBER = l_serial_number
            AND    INVENTORY_ITEM_ID = g_cc_entry.inventory_item_id
            AND    CURRENT_ORGANIZATION_ID = g_cc_entry.organization_id;
Line: 3817

               SELECT mtl_material_transactions_s.NEXTVAL
               INTO   l_txn_temp_id
               FROM   DUAL;
Line: 3831

            SELECT NVL ( subinventory_code, '###' ),
                   NVL ( locator_id, -99 )
            INTO   l_lpn_subinv,
                   l_lpn_locator_id
            FROM   WMS_LICENSE_PLATE_NUMBERS
            WHERE  lpn_id = l_lpn_id;
Line: 3865

               SELECT COUNT ( * )
               INTO   l_temp_lpn_count
               FROM   mtl_material_transactions_temp
               WHERE  transaction_header_id = l_txn_header_id
               AND    inventory_item_id = -1
               AND    content_lpn_id = l_lpn_id
               AND    transaction_source_id = l_cc_header_id
               AND    cycle_count_id IS NULL;
Line: 3880

                     print_debug ( 'The LPN sub xfer record has already been inserted into MMTT'
                                 );
Line: 3964

                  SELECT mtl_material_transactions_s.NEXTVAL
                  INTO   l_txn_temp_id
                  FROM   DUAL;
Line: 4091

   END final_preupdate_logic;
Line: 4093

   PROCEDURE delete_reservation
   IS
      l_mtl_reservation_rec INV_RESERVATION_GLOBAL.MTL_RESERVATION_REC_TYPE
                            := INV_CC_RESERVATIONS_PVT.Define_Reserv_Rec_Type;
Line: 4109

         print_debug ( '***delete_reservation***' );
Line: 4113

      /* Delete only cycle count reservation */
      l_mtl_reservation_rec.demand_source_type_id := 9;
Line: 4129

		 SELECT NVL (subinventory_code, '###' ),
                 NVL (locator_id, -99 )
		 INTO   l_lpn_subinv,
                 l_lpn_locator_id
                 FROM   WMS_LICENSE_PLATE_NUMBERS
                 WHERE  lpn_id = g_cc_entry.parent_lpn_id;
Line: 4152

         print_debug ( 'Calling Delete_All_Reservation with the following values for the reservation record:'
                     );
Line: 4168

      INV_CC_RESERVATIONS_PVT.Delete_All_Reservation ( p_api_version_number => 1.0,
                                                       p_init_msg_lst      => l_init_msg_lst,
                                                       p_mtl_reservation_rec => l_mtl_reservation_rec,
                                                       x_error_code        => l_error_code,
                                                       x_return_status     => l_return_status,
                                                       x_msg_count         => l_msg_count,
                                                       x_msg_data          => l_msg_data
                                                     );
Line: 4183

   END delete_reservation;
Line: 4205

      SELECT COUNT ( * )
      INTO   l_count
      FROM   mtl_cycle_count_entries
      WHERE  cycle_count_header_id = l_cc_header_id
      AND    organization_id = l_org_id
      AND    inventory_item_id = l_item_id
      AND    subinventory = l_sub
      AND    entry_status_code IN ( 1, 2, 3 )
      --            AND nvl(export_flag,2) = 2
      AND    (    l_locator_id IS NULL
               OR locator_id = l_locator_id )
      AND    (    l_revision IS NULL
               OR revision = l_revision )
      AND    (    l_lot IS NULL
               OR lot_NUMBER = l_lot )
      AND    (    l_cc_serial_number IS NULL
               OR serial_number = l_cc_serial_number
             )
      AND    (    l_cost_group_id IS NULL
               OR cost_group_id = l_cost_group_id)

       AND    NVL(parent_lpn_id,-1 ) = NVL(l_lpn_id, -1);
Line: 4256

         SELECT cycle_count_entry_id,
                entry_status_code,
                inventory_item_id
         FROM   MTL_CYCLE_COUNT_ENTRIES_V
         WHERE  cycle_count_header_id = l_cc_header_id
         --       AND nvl(export_flag,2) = 2
         AND    serial_number_control_code IN ( 2, 5 );
Line: 4285

         SELECT COUNT ( * )
         INTO   l_temp_count
         FROM   mtl_material_transactions_temp
         WHERE  transaction_header_id = l_txn_header_id;
Line: 4307

      /*SELECT NVL(serial_count_option, 1)
        INTO l_serial_count_option
        FROM mtl_cycle_count_headers
        WHERE cycle_count_header_id = l_cc_header_id
        AND organization_id = l_org_id;
Line: 4331

          UPDATE mtl_serial_numbers
            SET group_mark_id = NULL
            WHERE inventory_item_id = l_inventory_item_id
            AND current_organization_id = l_org_id
            AND serial_number IN
            (SELECT serial_number
             FROM mtl_cc_serial_numbers
             WHERE cycle_count_entry_id = l_cc_entry_id);
Line: 4495

      g_update_flag := 2;
Line: 4496

      g_insert_flag := 2;
Line: 4537

      l_last_updated_by NUMBER := g_cc_entry.last_updated_by;
Line: 4538

      l_last_update_login NUMBER := g_cc_entry.last_update_login;
Line: 4573

               SELECT NVL ( subinventory_code, '###' ),
                      NVL ( locator_id, -99 ),
                      lpn_context
               INTO   l_lpn_subinv,
                      l_lpn_locator_id,
                      l_lpn_context
               FROM   WMS_LICENSE_PLATE_NUMBERS
               WHERE  lpn_id = l_lpn_id ;
Line: 4613

      SELECT NVL ( serial_count_option, 1 )
      INTO   l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 4640

               SELECT NVL ( SUM ( primary_transaction_quantity ), 0 )
                      , NVL ( SUM ( secondary_transaction_quantity ), 0 ) -- nsinghi bug#6052831
               INTO   l_primary_sys_qty
                      , l_secondary_sys_qty  -- nsinghi bug#6052831
               FROM   MTL_ONHAND_QUANTITIES_DETAIL
               WHERE  inventory_item_id = l_item_id
               AND    organization_id = l_org_id
               AND    NVL ( containerized_flag, 2 ) = 2
               AND    subinventory_code = l_sub
               AND    NVL ( lot_number, 'XX' ) = NVL ( l_lot, 'XX' )
               AND    NVL ( revision, 'XXX' ) = NVL ( l_rev, 'XXX' )
               AND    NVL ( locator_id, -2 ) = NVL ( l_loc, -2 )
               AND    NVL ( cost_group_id, -9 ) = NVL ( l_cost_group_id, -9 );
Line: 4654

               SELECT NVL ( SUM ( quantity ), 0 )
                      , NVL ( SUM ( secondary_quantity ), 0 ) -- nsinghi bug#6052831
               INTO   l_loaded_sys_qty
                      , l_loaded_sec_sys_qty -- nsinghi bug#6052831
               FROM   WMS_LOADED_QUANTITIES_V
               WHERE  inventory_item_id = l_item_id
               AND    organization_id = l_org_id
               AND    NVL ( containerized_flag, 2 ) = 2
               AND    subinventory_code = l_sub
               AND    NVL ( lot_number, 'XX' ) = NVL ( l_lot, 'XX' )
               AND    NVL ( revision, 'XXX' ) = NVL ( l_rev, 'XXX' )
               AND    NVL ( locator_id, -2 ) = NVL ( l_loc, -2 )
               --Bug# 3071372
               --AND    NVL ( cost_group_id, -9 ) = NVL ( l_cost_group_id, -9 )
               AND    qty_type = 'LOADED'
               AND    lpn_id IS NULL
               AND    content_lpn_id IS NULL;                                                       -- bug 2640378
Line: 4687

               SELECT NVL ( SUM ( primary_transaction_quantity ), 0 )
                      , NVL ( SUM ( secondary_transaction_quantity ), 0 ) -- nsinghi bug#6052831
               INTO   l_primary_sys_qty
                      , l_secondary_sys_qty  -- nsinghi bug#6052831
               FROM   MTL_ONHAND_QUANTITIES_DETAIL
               WHERE  inventory_item_id = l_item_id
               AND    organization_id = l_org_id
               AND    NVL ( containerized_flag, 2 ) = 2
               AND    subinventory_code = l_sub
               AND    NVL ( lot_number, 'XX' ) = NVL ( l_lot, 'XX' )
               AND    NVL ( revision, 'XXX' ) = NVL ( l_rev, 'XXX' )
               AND    NVL ( locator_id, -2 ) = NVL ( l_loc, -2 );
Line: 4738

		SELECT COUNT(*)
		INTO l_primary_sys_qty
		FROM
			(SELECT serial_number,
				inventory_item_id,
				current_organization_id
			 FROM mtl_serial_numbers
			 WHERE serial_number = NVL(l_serial_number, serial_number)
			 AND inventory_item_id = l_item_id
			 AND current_organization_id = l_org_id
			 AND current_subinventory_code = l_sub
			 AND NVL(lot_number, 'XX') = NVL(l_lot, 'XX')
			 AND NVL(revision, 'XXX') = NVL(l_rev, 'XXX')
			 AND NVL(current_locator_id, -2 ) = NVL(l_loc, -2)
			 AND current_status = 3
			 AND lpn_id IS NULL
			) msn
		WHERE is_serial_loaded(msn.current_organization_id, msn.inventory_item_id, msn.serial_number, NULL) = 2;
Line: 4782

               SELECT mtl_cycle_count_entries_s.NEXTVAL
               INTO   l_cycle_count_entry_id
               FROM   DUAL;
Line: 4796

            INSERT INTO MTL_CC_SERIAL_NUMBERS
                        ( CYCLE_COUNT_ENTRY_ID,
                          SERIAL_NUMBER,
                          LAST_UPDATE_DATE,
                          LAST_UPDATED_BY,
                          CREATION_DATE,
                          CREATED_BY,
                          LAST_UPDATE_LOGIN
                        )
               SELECT /*+ index(MSN MTL_SERIAL_NUMBERS_N2) */
					  l_cycle_count_entry_id,
                      SERIAL_NUMBER,
                      SYSDATE,
                      l_last_updated_by,
                      SYSDATE,
                      l_last_updated_by,
                      l_last_update_login
               FROM   mtl_serial_numbers msn
               WHERE  msn.inventory_item_id = l_item_id
               AND    msn.current_organization_id = l_org_id
               AND    msn.current_subinventory_code = l_sub
               AND    NVL ( msn.lot_number, 'XX' ) = NVL ( l_lot, 'XX' )
               AND    NVL ( msn.revision, 'XXX' ) = NVL ( l_rev, 'XXX' )
               AND    NVL ( msn.current_locator_id, -2 ) = NVL ( l_loc, -2 )
               AND    msn.current_status = 3
               AND    NVL ( msn.lpn_id, -99999 ) = NVL ( l_lpn_id, -99999 )
               AND    NOT EXISTS (
                         SELECT 'x'
                         FROM   MTL_CC_SERIAL_NUMBERS
                         WHERE  CYCLE_COUNT_ENTRY_ID = l_cycle_count_entry_id
                         AND    SERIAL_NUMBER = msn.SERIAL_NUMBER );
Line: 4899

      SELECT primary_uom_code
      INTO   l_to_uom
      FROM   MTL_SYSTEM_ITEMS
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 4991

      SELECT NVL(process_enabled_flag, 'N')
      FROM   mtl_parameters
      WHERE  organization_id = l_organization_id;
Line: 5054

         SELECT NVL ( ccicv.item_cost, 0 )
         INTO   l_item_cost
         FROM   cst_cg_item_costs_view ccicv,
                mtl_parameters mp
         WHERE  l_locator_id IS NULL
         AND    ccicv.organization_id = in_org_id
         AND    ccicv.inventory_item_id = in_item_id
         AND    ccicv.organization_id = mp.organization_id
         /* Bug 5555367 - Modified the condition
         AND    ccicv.cost_group_id =
                   DECODE ( mp.primary_cost_method,
                            1, 1,
                            NVL ( l_cost_group_id, 1 )
                          )
         */
         AND     ccicv.cost_group_id =
                      DECODE ( mp.primary_cost_method,
                               1, 1,
                               NVL ( l_cost_group_id, mp.default_cost_group_id)
                             )
         UNION ALL
         SELECT NVL ( ccicv.item_cost, 0 )
         FROM   mtl_item_locations mil,
                cst_cg_item_costs_view ccicv,
                mtl_parameters mp
         WHERE  l_locator_id IS NOT NULL
         AND    mil.organization_id = in_org_id
         AND    mil.inventory_location_id = l_locator_id
         AND    mil.project_id IS NULL
         AND    ccicv.organization_id = mil.organization_id
         AND    ccicv.inventory_item_id = in_item_id
         AND    ccicv.organization_id = mp.organization_id
         /* Bug 5555367 - Modified the condition
         AND    ccicv.cost_group_id =
                   DECODE ( mp.primary_cost_method,
                            1, 1,
                            NVL ( l_cost_group_id, 1 )
                          )
         */
         AND     ccicv.cost_group_id =
                      DECODE ( mp.primary_cost_method,
                               1, 1,
                               NVL ( l_cost_group_id, mp.default_cost_group_id)
                             )
         UNION ALL
         SELECT NVL ( ccicv.item_cost, 0 )
         FROM   mtl_item_locations mil,
                mrp_project_parameters mrp,
                cst_cg_item_costs_view ccicv,
                mtl_parameters mp
         WHERE  l_locator_id IS NOT NULL
         AND    mil.organization_id = in_org_id
         AND    mil.inventory_location_id = l_locator_id
         AND    mil.project_id IS NOT NULL
         AND    mrp.organization_id = mil.organization_id
         AND    mrp.project_id = mil.project_id
         AND    ccicv.organization_id = mil.organization_id
         AND    ccicv.inventory_item_id = in_item_id
         AND    ccicv.organization_id = mp.organization_id
         AND    ccicv.cost_group_id =
                   DECODE ( mp.primary_cost_method,
                            1, 1,
                            NVL (  mrp.costing_group_id, 1 )
                          );
Line: 5158

               SELECT COUNT ( * )
               INTO   l_serial_count
               FROM   mtl_serial_numbers_temp s,
                      wms_loaded_quantities_v wl
               WHERE  s.transaction_temp_id = wl.transaction_temp_id
               AND    wl.inventory_item_id  = p_inventory_item_id  -- Bug 13652899
               AND    wl.organization_id    = p_organization_id    -- Bug 13796753
               AND    p_serial_number BETWEEN s.fm_serial_number
                                          AND s.to_serial_number;
Line: 5175

               SELECT COUNT ( * )
               INTO   l_serial_count
               FROM   mtl_serial_numbers_temp s,
                      wms_loaded_quantities_v wl,
                      mtl_transaction_lots_temp l
               WHERE  wl.transaction_temp_id = l.transaction_temp_id
               AND    wl.organization_id    = p_organization_id   -- Bug 13796753
               AND    s.transaction_temp_id = l.serial_transaction_temp_id
               AND    p_serial_number BETWEEN fm_serial_number
                                          AND to_serial_number;
Line: 5197

           SELECT COUNT ( * )
            INTO   l_serial_count
            FROM   mtl_serial_numbers s,
                   wms_loaded_quantities_v wl
            WHERE  s.lpn_id = p_lpn_id
--           AND    NVL ( wl.content_lpn_id, NVL ( wl.lpn_id, -1 ) ) = s.lpn_id --  Modified for opp cyc count 9248808
            AND    NVL ( wl.content_lpn_id, -1 ) = s.lpn_id
            AND    s.serial_number = p_serial_number
            AND    s.current_organization_id = p_organization_id
            AND    wl.organization_id  = p_organization_id   --Bug 13796753
            AND    s.inventory_item_id = p_inventory_item_id;
Line: 5213

		SELECT Count(DISTINCT msn.serial_number)
		INTO   l_serial_count
        	FROM   mtl_serial_numbers_temp msnt, mtl_material_transactions_temp mmtt,
                        mtl_transaction_lots_temp mtlt, mtl_serial_numbers msn, wms_dispatched_tasks wdt
		WHERE  mmtt.transaction_temp_id = mtlt.transaction_temp_id (+)
		AND   ((msnt.transaction_temp_id = mmtt.transaction_temp_id and
								mtlt.lot_number is null) or
						(msnt.transaction_temp_id = mtlt.serial_transaction_temp_id
									and mtlt.lot_number is not null))
		AND    mmtt.inventory_item_id = p_inventory_item_id
		AND    mmtt.organization_id = p_organization_id
		AND    NVL ( mmtt.lpn_id, -1 ) = p_lpn_id
		AND    msn.serial_number = p_serial_number
		AND    msn.serial_number BETWEEN msnt.FM_SERIAL_NUMBER AND msnt.TO_SERIAL_NUMBER
		AND    NVL(msn.revision, '@@@@@') = NVL(mmtt.revision, '@@@@@') --bug#12663976
		AND    msn.inventory_item_id = mmtt.inventory_item_id
		AND    msn.CURRENT_ORGANIZATION_ID=mmtt.organization_id
		AND    wdt.transaction_temp_id = mmtt.transaction_temp_id
        	AND    wdt.task_type <> 2
	        AND    wdt.status = 4;
Line: 5261

      l_last_updated_by NUMBER := g_cc_entry.last_updated_by;
Line: 5262

      l_last_update_login NUMBER := g_cc_entry.last_update_login;
Line: 5279

      SELECT NVL ( serial_count_option, 1 ),
             NVL ( serial_detail_option, 1 )
      INTO   l_serial_count_option,
             l_serial_detail_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 5288

      SELECT serial_number_control_code
      INTO   l_serial_number_control_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 5314

               SELECT   MIN ( NVL ( number_of_counts, 0 ) )
               INTO     l_number_of_counts
               FROM     mtl_cc_serial_numbers
               WHERE    cycle_count_entry_id = l_cycle_count_entry_id
               GROUP BY cycle_count_entry_id;
Line: 5351

               SELECT   MIN ( number_of_counts )
               INTO     l_number_of_counts
               FROM     mtl_cc_serial_numbers
               WHERE    cycle_count_entry_id = l_cycle_count_entry_id
               GROUP BY cycle_count_entry_id;
Line: 5406

      SELECT    NVL ( serial_count_option, 1 ),
                NVL ( serial_adjustment_option, 2 ),
                NVL ( automatic_recount_flag, 2 ),
                NVL ( maximum_auto_recounts, 0 ),
                NVL ( days_until_late , 0 ),
                --Bug 6978840
                NVL ( approval_option_code , 3)
      INTO   l_serial_count_option,
             l_serial_adjustment_option,
             l_automatic_recount_flag,
             l_maximum_auto_recounts,
             l_days_until_late,
             l_approval_option_code
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 5427

         SELECT COUNT ( * )
         INTO   l_count
         FROM   MTL_CC_SERIAL_NUMBERS
         WHERE  serial_number = l_serial_number
         AND    cycle_count_entry_id = l_cycle_count_entry_id;
Line: 5550

               final_preupdate_logic ( );
Line: 5571

               final_preupdate_logic ( );
Line: 5587

            final_preupdate_logic ( );
Line: 5597

   /* Deletes the serial info from mtl_cc_Serial_numbers in case of an Issue transaction */
   PROCEDURE delete_Serial_entry(p_serial_number IN VARCHAR2, p_cc_header_id IN NUMBER, p_cycle_count_entry_id IN NUMBER) IS
   BEGIN

      DELETE FROM mtl_cc_Serial_numbers
       WHERE serial_number = p_serial_number
         AND cycle_count_entry_id IN
            (SELECT cycle_count_entry_id
               FROM mtl_cycle_count_entries
              WHERE cycle_Count_header_id =   p_cc_header_id
                AND entry_status_code IN (1,3))
                   AND cycle_count_entry_id <> p_cycle_Count_entry_id;
Line: 5612

         print_debug('Exception while trying to delete serial number ' || g_cc_Serial_entry.serial_number);
Line: 5613

   END delete_serial_entry;
Line: 5654

      SELECT NVL ( serial_count_option, 1 ),
             NVL ( serial_adjustment_option, 2 ),
             NVL ( automatic_recount_flag, 2 ),
             NVL ( maximum_auto_recounts, 0 ),
             NVL ( days_until_late , 0 ),
             --Bug 6978840
             NVL ( approval_option_code , 3)
      INTO   l_serial_count_option,
             l_serial_adjustment_option,
             l_automatic_recount_flag,
             l_maximum_auto_recounts,
             l_days_until_late,
             l_approval_option_code
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 5727

			SELECT COUNT(*)
			INTO l_multiple_count
			FROM
				(SELECT serial_number,
					inventory_item_id,
					current_organization_id
				 FROM mtl_serial_numbers
				 WHERE serial_number = g_cc_serial_entry.serial_number
				 AND inventory_item_id = g_cc_entry.inventory_item_id
				 AND current_organization_id = g_cc_entry.organization_id
				 AND current_subinventory_code = g_cc_entry.subinventory
				 AND NVL(lot_number, 'XX') = NVL(g_cc_entry.lot_number, 'XX')
				 AND NVL(revision, 'XXX') = NVL(g_cc_entry.revision, 'XXX')
				 AND NVL(current_locator_id, -2 ) = NVL(g_cc_entry.locator_id, -2)
				 AND current_status =3
				 AND lpn_id IS NULL
				) msn
			WHERE is_serial_loaded(msn.current_organization_id, msn.inventory_item_id, msn.serial_number, NULL) = 2;
Line: 5755

			SELECT COUNT(*)
			INTO l_multiple_count
			FROM
				(SELECT serial_number,
					inventory_item_id,
					current_organization_id,
					lpn_id
				 FROM mtl_serial_numbers
				 WHERE serial_number = g_cc_serial_entry.serial_number
				 AND inventory_item_id = g_cc_entry.inventory_item_id
				 AND current_organization_id = g_cc_entry.organization_id
				 AND NVL(lot_number, 'XX') = NVL(g_cc_entry.lot_number, 'XX')
				 AND NVL(revision, 'XXX') = NVL(g_cc_entry.revision, 'XXX')
				 AND current_status = 3
				 AND lpn_id = g_cc_entry.parent_lpn_id
				) msn
			WHERE is_serial_loaded(msn.current_organization_id, msn.inventory_item_id, msn.serial_number, msn.lpn_id) = 2;
Line: 6041

               final_preupdate_logic ( );
Line: 6067

               final_preupdate_logic ( );
Line: 6099

               final_preupdate_logic ( );
Line: 6125

               final_preupdate_logic ( );
Line: 6138

            final_preupdate_logic ( );
Line: 6198

      SELECT NVL ( serial_count_option, 1 ),
             NVL ( serial_detail_option, 1 ),
             NVL ( serial_discrepancy_option, 2 )
      INTO   l_serial_count_option,
             l_serial_detail,
             l_serial_discrepancy
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 6209

      SELECT serial_number_control_code
      INTO   l_serial_number_control_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 6225

            SELECT SERIAL_NUMBER_TYPE
            INTO   l_serial_number_type
            FROM   MTL_PARAMETERS
            WHERE  ORGANIZATION_ID = l_org_id;
Line: 6268

            SELECT CURRENT_SUBINVENTORY_CODE,
                   NVL ( CURRENT_LOCATOR_ID, 0 )
            INTO   l_msn_subinv,
                   l_msn_locator_id
            FROM   MTL_SERIAL_NUMBERS
            WHERE  SERIAL_NUMBER = u1
            AND    INVENTORY_ITEM_ID = g_cc_entry.inventory_item_id
            AND    CURRENT_ORGANIZATION_ID = g_cc_entry.organization_id;
Line: 6336

               SELECT 1,
                      current_status
               INTO   serial_count,
                      l_current_status
               FROM   MTL_SERIAL_NUMBERS
               WHERE  SERIAL_NUMBER = l_serial_number
               AND    INVENTORY_ITEM_ID = l_item_id
               AND    CURRENT_ORGANIZATION_ID = l_org_id
               AND    CURRENT_STATUS IN ( 1, 3 );
Line: 6511

      SELECT primary_uom_code
      INTO   l_to_uom
      FROM   MTL_SYSTEM_ITEMS
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 6518

      SELECT NVL ( inventory_adjustment_account, -1 )
      INTO   l_txn_acct_id
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 6524

      SELECT concatenated_segments
      INTO   l_item_name
      FROM   mtl_system_items_kfv
      WHERE  inventory_item_id = l_item_id AND organization_id = l_org_id;
Line: 6566

            SELECT mtl_material_transactions_s.NEXTVAL
            INTO   l_txn_header_id
            FROM   DUAL;
Line: 6573

         SELECT mtl_material_transactions_s.NEXTVAL
         INTO   l_txn_temp_id
         FROM   DUAL;
Line: 6577

         SELECT auto_serial_alpha_prefix
         INTO   l_serial_prefix
         FROM   mtl_system_items
         WHERE  inventory_item_id = l_item_id AND organization_id = l_org_id;
Line: 6593

         delete_reservation ( );
Line: 6597

         SELECT negative_inv_receipt_code
         INTO   l_neg_inv_rcpt_code --Negative Balance  1:Allowed   2:Disallowed
         FROM   mtl_parameters
         WHERE  organization_id = l_org_id;
Line: 6614

            SELECT serial_number_control_code,
                   lot_control_code,
                   revision_qty_control_code
            INTO   v_ser_code,
                   v_lot_code,
                   v_rev_code
            FROM   mtl_system_items
            WHERE  inventory_item_id = l_item_id
                   AND organization_id = l_org_id;
Line: 6713

            inv_quantity_tree_pub.update_quantities ( p_api_version_number => 1.0,
                                                      p_init_msg_lst      => 'F',
                                                      x_return_status     => x_return_status,
                                                      x_msg_count         => l_msg_count,
                                                      x_msg_data          => l_msg_data,
                                                      p_organization_id   => l_org_id,
                                                      p_inventory_item_id => l_item_id,
                                                      p_tree_mode         => 1,
                                                      p_is_revision_control => v_is_rev_controlled,
                                                      p_is_lot_control    => v_is_lot_controlled,
                                                      p_is_serial_control => v_is_ser_controlled,
                                                      p_demand_source_type_id => NULL,
                                                      p_revision          => l_rev,
                                                      p_lot_number        => l_lot_num,
                                                      p_subinventory_code => l_sub,
                                                      p_locator_id        => l_locator_id,
                                                      p_onhand_source     => 3,
                                                      p_containerized     => 0,
                                                      p_primary_quantity  => ABS ( l_adjustment_quantity
                                                                                 ),
                                                      p_quantity_type     => 5,
                                                      x_qoh               => x_qoh,
                                                      x_rqoh              => l_rqoh,
                                                      x_qr                => l_qr,
                                                      x_qs                => l_qs,
                                                      x_att               => x_att,
                                                      x_atr               => l_atr,
                                                      p_lpn_id            => NULL --added for lpn reservation
                                                    );
Line: 6746

         SELECT NVL ( REVISION, 'XXX' ),
                NVL ( LOT_NUMBER, 'X' ),
                CURRENT_STATUS,
                CURRENT_SUBINVENTORY_CODE,
                NVL ( CURRENT_LOCATOR_ID, 0 ),
                NVL ( LPN_ID, -99 )
         INTO   l_msn_revision,
                l_msn_lot_number,
                l_current_status,
                l_msn_subinv,
                l_msn_locator_id,
                l_msn_lpn_id
         FROM   MTL_SERIAL_NUMBERS
         WHERE  SERIAL_NUMBER = l_serial_number
         AND    INVENTORY_ITEM_ID = g_cc_entry.inventory_item_id
         AND    CURRENT_ORGANIZATION_ID = g_cc_entry.organization_id;
Line: 6863

               print_debug('Calling delete_Serial_entry 1');
Line: 6866

            delete_serial_entry(l_serial_number,l_cc_header_id,l_cycle_count_entry_id); --3595723 Delete the serial info from mtl_cc_Serial_numbers
Line: 6891

            SELECT mtl_material_transactions_s.NEXTVAL
            INTO   l_txn_temp_id
            FROM   DUAL;
Line: 6909

               print_debug('Calling delete_Serial_entry 2');
Line: 6911

            delete_serial_entry(l_serial_number,l_cc_header_id,l_cycle_count_entry_id); --3595723 Delete the serial info from mtl_cc_Serial_numbers
Line: 7032

   PROCEDURE update_serial_row
   IS
      l_debug   NUMBER := NVL ( FND_PROFILE.VALUE ( 'INV_DEBUG_TRACE' ), 0 );
Line: 7037

         print_debug ( '***update_serial_row***' );
Line: 7041

      g_cc_serial_entry.last_update_date := SYSDATE;
Line: 7042

      g_cc_serial_entry.last_updated_by := g_user_id;
Line: 7043

      g_cc_serial_entry.last_update_login := g_login_id;
Line: 7045

      UPDATE MTL_CC_SERIAL_NUMBERS
      SET last_update_date = g_cc_serial_entry.last_update_date,
          last_updated_by = g_cc_serial_entry.last_updated_by,
          last_update_login = g_cc_serial_entry.last_update_login,
          number_of_counts = g_cc_serial_entry.number_of_counts,
          unit_status_current = g_cc_serial_entry.unit_status_current,
          unit_status_prior = g_cc_serial_entry.unit_status_prior,
          unit_status_first = g_cc_serial_entry.unit_status_first,
          approval_condition = g_cc_serial_entry.approval_condition,
          pos_adjustment_qty = g_cc_serial_entry.pos_adjustment_qty,
          neg_adjustment_qty = g_cc_serial_entry.neg_adjustment_qty
      WHERE  cycle_count_entry_id = g_cc_entry.cycle_count_entry_id
      AND    (     ( serial_number = g_cc_serial_entry.serial_number )
               OR (     serial_number IS NULL
                    AND g_cc_serial_entry.serial_number IS NULL
                  )
             );
Line: 7066

   END update_serial_row;
Line: 7087

      SELECT serial_number_control_code
      INTO   l_serial_number_ctrl_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 7093

      SELECT NVL ( serial_count_option, 1 )
      INTO   l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 7192

      SELECT serial_number_control_code
      INTO   l_serial_number_ctrl_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 7198

      SELECT NVL ( serial_count_option, 1 )
      INTO   l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 7204

      SELECT NVL ( serial_number, '@@@@@' ),
             inventory_item_id
      INTO   l_current_serial,
             l_current_item
      FROM   mtl_cycle_count_entries
      WHERE  cycle_count_entry_id = cycle_cnt_entry_id;
Line: 7316

         SELECT mec.full_name,
                fus.employee_id
         INTO   l_employee_full_name,
                l_employee_id
         FROM   mtl_employees_current_view mec,
                fnd_user fus
         WHERE  fus.user_id = l_user_id
         AND    mec.employee_id = fus.employee_id
         AND    mec.organization_id = l_org_id;
Line: 7329

            SELECT fus.employee_id
            INTO   l_employee_id
            FROM   fnd_user fus
            WHERE  fus.user_id = l_user_id;
Line: 7367

         SELECT     *
         FROM       WMS_LICENSE_PLATE_NUMBERS
         START WITH lpn_id = p_parent_lpn_id
         CONNECT BY parent_lpn_id = PRIOR lpn_id;
Line: 7374

         SELECT *
         FROM   WMS_LPN_CONTENTS
         WHERE  parent_lpn_id = l_current_lpn
         AND    NVL ( serial_summary_entry, 2 ) = 2;
Line: 7381

         SELECT *
         FROM   MTL_SERIAL_NUMBERS
         WHERE  lpn_id = l_current_lpn;
Line: 7387

         SELECT *
         FROM   WMS_LPN_CONTENTS
         WHERE  parent_lpn_id = l_current_lpn AND serial_summary_entry = 1;
Line: 7394

            SELECT NVL ( SUM ( quantity ), 0 )
            FROM   WMS_LOADED_QUANTITIES_V WLQV
            WHERE  WLQV.inventory_item_id = p_inventory_item_id
            AND    WLQV.organization_id = p_organization_id
            AND    (lpn_id = p_lpn_id OR content_lpn_id = p_lpn_id )
            AND    qty_type = 'LOADED';
Line: 7416

      SELECT NVL ( serial_count_option, 1 )
      INTO   l_serial_count_option
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = p_cycle_count_header_id
      AND    organization_id = p_organization_id;
Line: 7431

	  SELECT outermost_lpn_id,
	         NVL(parent_lpn_id,-99),
	         NVL(subinventory_code,'##'),
		     NVL(locator_id,-99),
		     organization_id
        INTO l_outermost_lpn_id,
		     l_parent_lpn_id,
		     l_sub,
		     l_locator_id,
		     l_org_id
        FROM wms_license_plate_numbers
       WHERE lpn_id = p_parent_lpn_id;
Line: 7508

            SELECT COUNT ( * )
            INTO   l_temp_count
            FROM   mtl_cycle_count_items
            WHERE  inventory_item_id = v_lpn_id.inventory_item_id
            AND    cycle_count_header_id = p_cycle_count_header_id;
Line: 7516

               SELECT primary_uom_code
               INTO   l_temp_uom_code
               FROM   mtl_system_items
               WHERE  inventory_item_id = v_lpn_id.inventory_item_id
               AND    organization_id = v_lpn_id.organization_id;
Line: 7550

            SELECT COUNT ( * )
            INTO   l_temp_count
            FROM   mtl_cycle_count_items
            WHERE  inventory_item_id = v_lpn_content.inventory_item_id
            AND    cycle_count_header_id = p_cycle_count_header_id;
Line: 7602

               SELECT COUNT ( * )
               INTO   l_temp_count
               FROM   mtl_cycle_count_items
               WHERE  inventory_item_id =
                                        v_lpn_serial_content.inventory_item_id
               AND    cycle_count_header_id = p_cycle_count_header_id;
Line: 7611

                  SELECT primary_uom_code
                  INTO   l_temp_uom_code
                  FROM   mtl_system_items
                  WHERE  inventory_item_id =
                                        v_lpn_serial_content.inventory_item_id
                  AND    organization_id =
                                  v_lpn_serial_content.current_organization_id;
Line: 7632

                       SELECT
                              lpn_context
                       INTO   l_lpn_context
                       FROM   WMS_LICENSE_PLATE_NUMBERS
                       WHERE  lpn_id = p_parent_lpn_id ;
Line: 7675

               SELECT COUNT ( * )
               INTO   l_temp_count
               FROM   mtl_cycle_count_items
               WHERE  inventory_item_id =
                                       v_lpn_multiple_serial.inventory_item_id
               AND    cycle_count_header_id = p_cycle_count_header_id;
Line: 7902

         SELECT default_cost_group_id
         INTO   l_default_cost_group_id
         FROM   mtl_secondary_inventories
         WHERE  organization_id = p_organization_id
         AND    secondary_inventory_name = p_subinventory;
Line: 7914

         SELECT NVL ( default_cost_group_id, -999 )
         INTO   l_default_cost_group_id
         FROM   mtl_parameters
         WHERE  organization_id = p_organization_id;
Line: 7944

         SELECT NVL ( cost_group_id, -999 )
         INTO   l_cost_group_id
         FROM   mtl_serial_numbers
         WHERE  serial_number = p_serial_number
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    NVL ( lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
         AND    current_organization_id = p_organization_id
         --AND current_subinventory_code = p_subinventory
         --AND NVL(current_locator_id, -99999) = NVL(p_locator_id, -99999)
         AND    NVL ( lpn_id, -99999 ) = NVL ( p_parent_lpn_id, -99999 );
Line: 7957

         SELECT DISTINCT NVL ( cost_group_id, -999 ) --bug3687177
         INTO   l_cost_group_id
         FROM   wms_lpn_contents
         WHERE  parent_lpn_id = p_parent_lpn_id
         AND    organization_id = p_organization_id
         AND    inventory_item_id = p_inventory_item_id
         AND    NVL ( revision, '@@@@@' ) = NVL ( p_revision, '@@@@@' )
         AND    NVL ( lot_number, '@@@@@' ) = NVL ( p_lot_number, '@@@@@' )
         AND    NVL ( serial_summary_entry, 2 ) = 2;
Line: 7973

         SELECT DISTINCT NVL ( cost_group_id, -999 )
         INTO            l_cost_group_id
         FROM            MTL_ONHAND_QUANTITIES_DETAIL
         WHERE           inventory_item_id = p_inventory_item_id
         AND             NVL ( revision, '@@@@@' ) =
                                                   NVL ( p_revision, '@@@@@' )
         AND             NVL ( lot_number, '@@@@@' ) =
                                                 NVL ( p_lot_number, '@@@@@' )
         AND             organization_id = p_organization_id
         AND             subinventory_code = p_subinventory
         AND             NVL ( locator_id, -99999 ) =
                                                   NVL ( p_locator_id, -99999 )
         AND             NVL ( containerized_flag, 2 ) = 2;
Line: 8015

         SELECT *
         FROM   mtl_cc_serial_numbers
         WHERE  cycle_count_entry_id = g_cc_entry.cycle_count_entry_id;
Line: 8068

         SELECT group_mark_id
         INTO   l_group_mark_id
         FROM   mtl_serial_numbers
         WHERE  serial_number = g_cc_serial_entry.serial_number
         AND    current_organization_id = g_cc_entry.organization_id
         AND    inventory_item_id = g_cc_entry.inventory_item_id;
Line: 8139

      SELECT primary_uom_code
      INTO   g_count_uom
      FROM   mtl_system_items
      WHERE  inventory_item_id = g_cc_entry.inventory_item_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 8147

      SELECT NVL ( serial_adjustment_option, 2 ), NVL ( automatic_recount_flag, 2 ),
             NVL ( maximum_auto_recounts, 0 ), NVL ( days_until_late , 0 ),
             --Bug 6978840
             NVL( approval_option_code , 3)
      INTO   l_serial_adjustment_option, l_automatic_recount_flag, l_maximum_auto_recounts, l_days_until_late, l_approval_option_code
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id;
Line: 8219

         SELECT group_mark_id
         INTO   l_group_mark_id
         FROM   mtl_serial_numbers
         WHERE  serial_number = g_cc_serial_entry.serial_number
         AND    current_organization_id = g_cc_entry.organization_id
         AND    inventory_item_id = g_cc_entry.inventory_item_id;
Line: 8283

            update_serial_row ( );
Line: 8300

            update_serial_row ( );
Line: 8316

            UPDATE mtl_serial_numbers
            SET group_mark_id = NULL
            WHERE  serial_number = g_cc_serial_entry.serial_number
            AND    current_organization_id = g_cc_entry.organization_id
            AND    inventory_item_id = g_cc_entry.inventory_item_id;
Line: 8393

      SELECT NVL ( approval_option_code, 1 )
      INTO   l_approval_option_code
      FROM   mtl_cycle_count_headers
      WHERE  cycle_count_header_id = g_cc_entry.cycle_count_header_id
      AND    organization_id = g_cc_entry.organization_id;
Line: 8518

      SELECT COUNT ( * )
      INTO   x_count
      FROM   mtl_cycle_count_entries
      WHERE  cycle_count_header_id = p_cycle_count_header_id
      AND    entry_status_code IN ( 1, 3 )
      AND    NVL ( export_flag, 2 ) = 2;
Line: 8529

   PROCEDURE insert_dynamic_lot (
      p_api_version IN NUMBER,
      p_init_msg_list IN VARCHAR2,
      p_commit    IN VARCHAR2,
      p_validation_level IN NUMBER,
      p_inventory_item_id IN NUMBER,
      p_organization_id IN NUMBER,
      p_lot_number IN VARCHAR2,
      p_expiration_date IN OUT NOCOPY DATE,
      p_transaction_temp_id IN NUMBER,
      p_transaction_action_id IN NUMBER,
      p_transfer_organization_id IN NUMBER,
      p_status_id IN NUMBER,
      p_update_status IN VARCHAR2,
      x_object_id OUT NOCOPY NUMBER,
      x_return_status OUT NOCOPY VARCHAR2,
      x_msg_count OUT NOCOPY NUMBER,
      x_msg_data  OUT NOCOPY VARCHAR2
   )
   IS
      l_debug   NUMBER := NVL ( FND_PROFILE.VALUE ( 'INV_DEBUG_TRACE' ), 0 );
Line: 8555

         print_debug ( '***Calling insert_dynamic_lot***' );
Line: 8559

         print_debug ( 'Calling insertlot' );
Line: 8562

      inv_lot_api_pub.insertlot ( p_api_version       => p_api_version,
                                  p_init_msg_list     => p_init_msg_list,
                                  p_commit            => p_commit,
                                  p_validation_level  => p_validation_level,
                                  p_inventory_item_id => p_inventory_item_id,
                                  p_organization_id   => p_organization_id,
                                  p_lot_number        => p_lot_number,
                                  p_expiration_date   => p_expiration_date,
                                  p_transaction_temp_id => p_transaction_temp_id,
                                  p_transaction_action_id => p_transaction_action_id,
                                  p_transfer_organization_id => p_transfer_organization_id,
                                  x_object_id         => x_object_id,
                                  x_return_status     => x_return_status,
                                  x_msg_count         => x_msg_count,
                                  x_msg_data          => x_msg_data
                                );
Line: 8581

            print_debug ( 'insertLot was not called successfully' );
Line: 8588

         print_debug ( 'insertLot was called successfully' );
Line: 8592

           AND ( p_update_status = 'TRUE' )
         ) THEN
         IF ( l_debug = 1 ) THEN
            print_debug ( 'Update the status of the new lot' );
Line: 8598

         inv_material_status_grp.update_status ( p_api_version_number => p_api_version,
                                                 p_init_msg_lst      => NULL,
                                                 x_return_status     => x_return_status,
                                                 x_msg_count         => x_msg_count,
                                                 x_msg_data          => x_msg_data,
                                                 p_update_method     => inv_material_status_pub.g_update_method_receive,
                                                 p_status_id         => p_status_id,
                                                 p_organization_id   => p_organization_id,
                                                 p_inventory_item_id => p_inventory_item_id,
                                                 p_sub_code          => NULL,
                                                 p_locator_id        => NULL,
                                                 p_lot_number        => p_lot_number,
                                                 p_serial_number     => NULL,
                                                 p_to_serial_number  => NULL,
                                                 p_object_type       => 'O'
                                               );
Line: 8617

               print_debug ( 'update_status was not called successfully' );
Line: 8623

   END insert_dynamic_lot;
Line: 8625

   PROCEDURE update_serial_status (
      p_api_version IN NUMBER,
      p_init_msg_list IN VARCHAR2,
      p_commit    IN VARCHAR2,
      p_validation_level IN NUMBER,
      p_inventory_item_id IN NUMBER,
      p_organization_id IN NUMBER,
      p_from_serial_number IN VARCHAR2,
      p_to_serial_number IN VARCHAR2,
      p_current_status IN NUMBER,
      p_serial_status_id IN NUMBER,
      p_update_serial_status IN VARCHAR2,
      p_lot_number IN VARCHAR2,
      x_return_status OUT NOCOPY VARCHAR2,
      x_msg_count OUT NOCOPY NUMBER,
      x_msg_data  OUT NOCOPY VARCHAR2
   )
   IS
      l_from_ser_number NUMBER;
Line: 8656

         print_debug (    'Enter update_serial_status: 10:'
                       || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                     );
Line: 8663

      SAVEPOINT count_update_serial_sp;
Line: 8694

         UPDATE mtl_serial_numbers
         SET previous_status = current_status,
             current_status = p_current_status,
             lot_number = p_lot_number,
             current_organization_id = p_organization_id
         WHERE  serial_number = l_cur_serial_number
         AND    inventory_item_id = p_inventory_item_id;
Line: 8704

         IF p_update_serial_status = 'TRUE' THEN
            l_progress  := '70';
Line: 8706

            inv_material_status_grp.update_status ( p_api_version_number => p_api_version,
                                                    p_init_msg_lst      => NULL,
                                                    x_return_status     => x_return_status,
                                                    x_msg_count         => x_msg_count,
                                                    x_msg_data          => x_msg_data,
                                                    p_update_method     => inv_material_status_pub.g_update_method_receive,
                                                    p_status_id         => p_serial_status_id,
                                                    p_organization_id   => p_organization_id,
                                                    p_inventory_item_id => p_inventory_item_id,
                                                    p_sub_code          => NULL,
                                                    p_locator_id        => NULL,
                                                    p_lot_number        => p_lot_number,
                                                    p_serial_number     => l_cur_serial_number,
                                                    p_to_serial_number  => NULL,
                                                    p_object_type       => 'S'
                                                  );
Line: 8744

         print_debug (    'Exit update_serial_status 110:'
                       || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                     );
Line: 8750

         ROLLBACK TO count_update_serial_sp;
Line: 8754

            print_debug (    'Exitting update_serial_status - execution error:'
                          || l_progress
                          || ' '
                          || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                        );
Line: 8767

         ROLLBACK TO count_update_serial_sp;
Line: 8771

            print_debug (    'Exitting update_serial_status - unexpected error:'
                          || l_progress
                          || ' '
                          || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                        );
Line: 8784

         ROLLBACK TO count_update_serial_sp;
Line: 8788

            print_debug (    'Exitting update_serial_status - other exceptions:'
                          || l_progress
                          || ' '
                          || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                        );
Line: 8796

            inv_mobile_helper_functions.sql_error ( 'INV_RCV_COMMON_APIS.update_serial_status',
                                                    l_progress,
                                                    SQLCODE
                                                  );
Line: 8803

            fnd_msg_pub.add_exc_msg ( g_pkg_name, 'update_serial_status' );
Line: 8811

   END update_serial_status;
Line: 8814

   PROCEDURE insert_range_serial (
      p_api_version IN NUMBER,
      p_init_msg_list IN VARCHAR2,
      p_commit    IN VARCHAR2,
      p_validation_level IN NUMBER,
      p_inventory_item_id IN NUMBER,
      p_organization_id IN NUMBER,
      p_from_serial_number IN VARCHAR2,
      p_to_serial_number IN VARCHAR2,
      p_revision  IN VARCHAR2,
      p_lot_number IN VARCHAR2,
      p_current_status IN NUMBER,
      p_serial_status_id IN NUMBER,
      p_update_serial_status IN VARCHAR2,
      x_return_status OUT NOCOPY VARCHAR2,
      x_msg_count OUT NOCOPY NUMBER,
      x_msg_data  OUT NOCOPY VARCHAR2
   )
   IS
      l_object_id NUMBER;
Line: 8839

         print_debug (    'Enter insert_range_serial: 10:'
                       || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                     );
Line: 8846

      SAVEPOINT count_insert_range_serial_sp;
Line: 8848

      inv_serial_number_pub.insert_range_serial ( p_api_version       => p_api_version,
                                                  p_init_msg_list     => p_init_msg_list,
                                                  p_commit            => p_commit,
                                                  p_validation_level  => p_validation_level,
                                                  p_inventory_item_id => p_inventory_item_id,
                                                  p_organization_id   => p_organization_id,
                                                  p_from_serial_number => p_from_serial_number,
                                                  p_to_serial_number  => p_to_serial_number,
                                                  p_initialization_date => SYSDATE,
                                                  p_completion_date   => NULL,
                                                  p_ship_date         => NULL,
                                                  p_revision          => p_revision,
                                                  p_lot_number        => p_lot_number,
                                                  p_current_locator_id => NULL,
                                                  p_subinventory_code => NULL,
                                                  p_trx_src_id        => NULL,
                                                  p_unit_vendor_id    => NULL,
                                                  p_vendor_lot_number => NULL,
                                                  p_vendor_serial_number => NULL,
                                                  p_receipt_issue_type => NULL,
                                                  p_txn_src_id        => NULL,
                                                  p_txn_src_name      => NULL,
                                                  p_txn_src_type_id   => NULL,
                                                  p_transaction_id    => NULL,
                                                  p_current_status    => p_current_status,
                                                  p_parent_item_id    => NULL,
                                                  p_parent_serial_number => NULL,
                                                  p_cost_group_id     => NULL,
                                                  p_transaction_action_id => NULL,
                                                  p_transaction_temp_id => NULL,
                                                  p_status_id         => NULL,
                                                  p_inspection_status => NULL,
                                                  x_object_id         => l_object_id,
                                                  x_return_status     => x_return_status,
                                                  x_msg_count         => x_msg_count,
                                                  x_msg_data          => x_msg_data
                                                );
Line: 8894

      IF p_update_serial_status = 'TRUE' THEN
         l_progress  := '40';
Line: 8896

         inv_material_status_grp.update_status ( p_api_version_number => p_api_version,
                                                 p_init_msg_lst      => NULL,
                                                 x_return_status     => x_return_status,
                                                 x_msg_count         => x_msg_count,
                                                 x_msg_data          => x_msg_data,
                                                 p_update_method     => inv_material_status_pub.g_update_method_receive,
                                                 p_status_id         => p_serial_status_id,
                                                 p_organization_id   => p_organization_id,
                                                 p_inventory_item_id => p_inventory_item_id,
                                                 p_sub_code          => NULL,
                                                 p_locator_id        => NULL,
                                                 p_lot_number        => p_lot_number,
                                                 p_serial_number     => p_from_serial_number,
                                                 p_to_serial_number  => p_to_serial_number,
                                                 p_object_type       => 'S'
                                               );
Line: 8931

         print_debug (    'Exit insert_range_serial 90:'
                       || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                     );
Line: 8937

         ROLLBACK TO count_insert_range_serial_sp;
Line: 8941

            print_debug (    'Exitting insert_range_serial - execution error:'
                          || l_progress
                          || ' '
                          || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                        );
Line: 8954

         ROLLBACK TO count_insert_range_serial_sp;
Line: 8957

            print_debug (    'Exitting insert_range_serial - unexpected error:'
                          || l_progress
                          || ' '
                          || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                        );
Line: 8971

         ROLLBACK TO count_insert_range_serial_sp;
Line: 8974

            print_debug (    'Exitting insert_range_serial - other exceptions:'
                          || l_progress
                          || ' '
                          || TO_CHAR ( SYSDATE, 'YYYY-MM-DD HH:DD:SS' )
                        );
Line: 8984

            inv_mobile_helper_functions.sql_error ( 'INV_RCV_COMMON_APIS.insert_range_serial',
                                                    l_progress,
                                                    SQLCODE
                                                  );
Line: 8991

            fnd_msg_pub.add_exc_msg ( g_pkg_name, 'insert_range_serial' );
Line: 8999

   END insert_range_serial;
Line: 9042

               SELECT NVL ( subinventory_code, '###' ),
                      NVL ( locator_id, -99 ),
                      lpn_context
               INTO   l_lpn_subinv,
                      l_lpn_locator_id,
                      l_lpn_context
               FROM   WMS_LICENSE_PLATE_NUMBERS
               WHERE  lpn_id = p_parent_lpn_id ;
Line: 9075

      SELECT primary_uom_code,
             serial_number_control_code
      INTO   l_primary_uom,
             l_serial_number_control_code
      FROM   mtl_system_items
      WHERE  inventory_item_id = p_inventory_item_id
      AND    organization_id = p_organization_id;
Line: 9095

            SELECT NVL ( SUM ( primary_transaction_quantity ), 0 )
            INTO   x_system_quantity
            FROM   MTL_ONHAND_QUANTITIES_DETAIL
            WHERE  inventory_item_id = p_inventory_item_id
            AND    organization_id = p_organization_id
            AND    NVL ( containerized_flag, 2 ) = 2
            AND    subinventory_code = p_subinventory
            AND    NVL ( locator_id, -99 ) = NVL ( p_locator_id, -99 )
            AND    (    NVL ( lot_number, 'XX' ) = NVL ( p_lot_number, 'XX' )
                     OR p_lot_number IS NULL
                   ) -- Lot number might not have been entered yet
            AND    NVL ( revision, 'XXX' ) = NVL ( p_revision, 'XXX' );
Line: 9108

            SELECT NVL ( SUM ( quantity ), 0 )
            INTO   l_loaded_sys_qty
            FROM   WMS_LOADED_QUANTITIES_V
            WHERE  inventory_item_id = p_inventory_item_id
            AND    organization_id = p_organization_id
            AND    NVL ( containerized_flag, 2 ) = 2
            AND    subinventory_code = p_subinventory
            AND    NVL ( locator_id, -99 ) = NVL ( p_locator_id, -99 )
            AND    (    NVL ( lot_number, 'XX' ) = NVL ( p_lot_number, 'XX' )
                     OR p_lot_number IS NULL
                   )
            -- Lot number might not have been entered yet
            AND    NVL ( revision, 'XXX' ) = NVL ( p_revision, 'XXX' )
            AND    qty_type = 'LOADED'
            AND    lpn_id IS NULL
            AND    content_lpn_id IS NULL; -- bug 2640378
Line: 9139

               SELECT nvl(sum(primary_quantity),0)   --BUG3026540
               INTO   x_system_quantity
               FROM   WMS_LPN_CONTENTS
               WHERE  parent_lpn_id = p_parent_lpn_id
               AND    organization_id = p_organization_id
               AND    inventory_item_id = p_inventory_item_id
               AND    (    NVL ( lot_number, 'XX' ) =
                                                    NVL ( p_lot_number, 'XX' )
                        OR p_lot_number IS NULL
                      )
               -- Lot number might not have been entered yet
               AND    NVL ( revision, 'XXX' ) = NVL ( p_revision, 'XXX' )
               AND    NVL ( serial_summary_entry, 2 ) = 2;
Line: 9153

               SELECT NVL ( SUM ( quantity ), 0 )
               INTO   l_loaded_sys_qty
               FROM   wms_loaded_quantities_v
               WHERE  NVL ( lpn_id, NVL ( content_lpn_id, -1 ) ) = p_parent_lpn_id
               and    inventory_item_id = p_inventory_item_id
               and    organization_id = p_organization_id;
Line: 9180

            SELECT NVL ( SUM ( DECODE ( current_status, 3, 1, 0 ) ), 0 )
            INTO   x_system_quantity
            FROM   mtl_serial_numbers
            WHERE  lpn_id IS NULL
            AND    inventory_item_id = p_inventory_item_id
            AND    current_organization_id = p_organization_id
            AND    current_subinventory_code = p_subinventory
            AND    NVL ( current_locator_id, -99 ) = NVL ( p_locator_id, -99 )
            AND    (    NVL ( lot_number, 'XX' ) = NVL ( p_lot_number, 'XX' )
                     OR p_lot_number IS NULL
                   )
            -- Lot number might not have been entered yet
            AND    NVL ( revision, 'XXX' ) = NVL ( p_revision, 'XXX' );
Line: 9194

            select count(*)
            into   l_loaded_sys_qty
                           from   mtl_serial_numbers_temp msnt, wms_loaded_quantities_v wl
                           where  ((msnt.transaction_temp_id = wl.transaction_temp_id
                     and wl.lot_number is null) or
                                   (msnt.transaction_temp_id = wl.serial_transaction_temp_id
                     and wl.lot_number is not null)
                                       )
            and    wl.containerized_flag = 2
                           and    wl.inventory_item_id = p_inventory_item_id
                           and    wl.subinventory_code = p_subinventory
                           and    nvl(wl.locator_id,-99) = nvl(p_locator_id,-99)
            and    (nvl(wl.lot_number,'@@@') = nvl(p_lot_number,'@@@')
                    or p_lot_number is null)
            and    nvl(wl.revision,'##') = nvl(p_revision,'##');
Line: 9218

            SELECT COUNT ( * )
            INTO   x_system_quantity
            FROM   mtl_serial_numbers
            WHERE  lpn_id = p_parent_lpn_id
            AND    inventory_item_id = p_inventory_item_id
            AND    current_organization_id = p_organization_id
            AND    (    NVL ( lot_number, 'XX' ) = NVL ( p_lot_number, 'XX' )
                     OR p_lot_number IS NULL
                   )
            -- Lot number might not have been entered yet
            AND    NVL ( revision, 'XXX' ) = NVL ( p_revision, 'XXX' );
Line: 9231

            SELECT Count(DISTINCT msn.serial_number)
            into   l_loaded_sys_qty
                      from   mtl_serial_numbers_temp msnt, mtl_serial_numbers msn, wms_loaded_quantities_v wl
                           where  msn.lpn_id = nvl(wl.content_lpn_id,nvl(wl.lpn_id,-1))
						   AND   ((msnt.transaction_temp_id = wl.transaction_temp_id and wl.lot_number is null)
							  or (msnt.transaction_temp_id = wl.serial_transaction_temp_id and wl.lot_number is not null))
                           and   wl.containerized_flag = 1
                      and    msn.inventory_item_id = wl.inventory_item_id
					  AND    msn.serial_number BETWEEN msnt.FM_SERIAL_NUMBER AND msnt.TO_SERIAL_NUMBER
                      and    msn.current_organization_id = wl.ORGANIZATION_ID
                      and    wl.inventory_item_id = p_inventory_item_id
                           and    wl.organization_id = p_organization_id
                           and    msn.lpn_id = p_parent_lpn_id
            and    nvl(msn.lot_number,'@@@') = nvl(wl.lot_number,'@@@')
			and    nvl(msn.revision,'XXX') = nvl(wl.revision,'XXX')
            and    (msn.lot_number = p_lot_number or
                   p_lot_number is null)
            AND    NVL ( wl.revision, 'XXX' ) = NVL ( p_revision, 'XXX' );
Line: 9250

            /*SELECT SUM(NVL( wl.quantity,0))  --9452528
            into   l_loaded_sys_qty
                      from   mtl_serial_numbers msn, wms_loaded_quantities_v wl
                           where  msn.lpn_id = nvl(wl.content_lpn_id,nvl(wl.lpn_id,-1))
                           and   wl.containerized_flag = 1
                      and    msn.inventory_item_id = wl.inventory_item_id
                      and    msn.current_organization_id = wl.ORGANIZATION_ID
                      and    wl.inventory_item_id = p_inventory_item_id
                           and    wl.organization_id = p_organization_id
                           and    msn.lpn_id = p_parent_lpn_id
            and    (nvl(msn.lot_number,'@@@') = nvl(wl.lot_number,'@@@') or
                   p_lot_number is null)
            AND    NVL ( wl.revision, 'XXX' ) = NVL ( p_revision, 'XXX' );*/
Line: 9358

         SELECT COUNT(*)
         INTO x_scheduled_qty
         FROM mtl_serial_numbers msn, mtl_cc_serial_numbers mcsn,
         mtl_material_statuses_vl mms, mtl_cycle_count_entries mcce
         WHERE msn.inventory_item_id = p_inventory_item_id
         AND msn.current_organization_id = p_organization_id
         AND msn.current_status IN (1, 3)
         AND msn.status_id = mms.status_id(+)
         AND msn.serial_number = mcsn.serial_number
         AND mcsn.cycle_count_entry_id = mcce.cycle_count_entry_id
         AND mcce.cycle_count_header_id = p_cycle_count_header_id
         AND mcce.inventory_item_id = p_inventory_item_id
         AND mcce.organization_id = p_organization_id
         AND mcce.subinventory = p_subinventory
         AND NVL(mcce.locator_id, -99999) = NVL(p_locator_id, -99999)
         AND NVL(mcce.revision, '@@@@@') = NVL(p_revision, '@@@@@')
         AND NVL(mcce.lot_number, '###' ) = NVL(p_lot_number, '###')
         AND NVL(mcce.parent_lpn_id, -99999) = NVL(p_parent_lpn_id, -99999)
         AND mcce.entry_status_code IN (1, 3)
         AND NVL(mcce.export_flag, 2) = 2
         AND EXISTS (select 1 from mtl_cycle_count_entries
                          where cycle_count_entry_id = mcce.cycle_count_entry_id
                          and number_of_counts is null);
Line: 9383

           SELECT mcce.system_quantity_current
           INTO x_scheduled_qty
           FROM mtl_cycle_count_entries mcce
           WHERE mcce.cycle_count_header_id = p_cycle_count_header_id
           AND mcce.inventory_item_id = p_inventory_item_id
           AND mcce.organization_id = p_organization_id
           AND mcce.subinventory = p_subinventory
           AND NVL(mcce.locator_id, -99999) = NVL(p_locator_id, -99999)
           AND NVL(mcce.revision, '@@@@@') = NVL(p_revision, '@@@@@')
           AND NVL(mcce.lot_number, '###' ) = NVL(p_lot_number, '###')
           AND NVL(mcce.parent_lpn_id, -99999) = NVL(p_parent_lpn_id, -99999)
           AND mcce.entry_status_code IN (1, 3)
           AND NVL(mcce.export_flag, 2) = 2;
Line: 9442

         SELECT wdt.transaction_temp_id
         FROM   wms_dispatched_tasks wdt
         WHERE  wdt.person_id = l_employee_id
         AND    wdt.task_type = 3
         AND    NOT EXISTS (
                   SELECT 'ACTIVE_TASK'
                   FROM   mtl_cycle_count_entries
                   WHERE  entry_status_code in (1,3)
                   AND    NVL(export_flag,2) = 2
                   AND    cycle_count_entry_id = wdt.transaction_temp_id );--bug 12614348
Line: 9464

      SELECT DISTINCT NVL ( person_id, -999 )
      INTO            l_employee_id
      FROM            wms_dispatched_tasks_history
      WHERE           transaction_id = p_transaction_temp_id AND task_type = 3;
Line: 9495

            print_debug ( 'Inserting record into tasks history table' );
Line: 9500

         INSERT INTO WMS_DISPATCHED_TASKS_HISTORY
                     ( task_id,
                       transaction_id,
                       organization_id,
                       user_task_type,
                       person_id,
                       effective_start_date,
                       effective_end_date,
                       equipment_id,
                       equipment_instance,
                       person_resource_id,
                       machine_resource_id,
                       status,
                       dispatched_time,
                       loaded_time,
                       drop_off_time,
                       last_update_date,
                       last_updated_by,
                       creation_date,
                       created_by,
                       last_update_login,
                       attribute_category,
                       attribute1,
                       attribute2,
                       attribute3,
                       attribute4,
                       attribute5,
                       attribute6,
                       attribute7,
                       attribute8,
                       attribute9,
                       attribute10,
                       attribute11,
                       attribute12,
                       attribute13,
                       attribute14,
                       attribute15,
                       task_type,
                       priority,
                       task_group_id
                     )
            SELECT task_id,
                   transaction_temp_id,
                   organization_id,
                   user_task_type,
                   person_id,
                   effective_start_date,
                   effective_end_date,
                   equipment_id,
                   equipment_instance,
                   person_resource_id,
                   machine_resource_id,
                   6,
                   dispatched_time,
                   loaded_time,
                   drop_off_time,
                   last_update_date,
                   last_updated_by,
                   creation_date,
                   created_by,
                   last_update_login,
                   attribute_category,
                   attribute1,
                   attribute2,
                   attribute3,
                   attribute4,
                   attribute5,
                   attribute6,
                   attribute7,
                   attribute8,
                   attribute9,
                   attribute10,
                   attribute11,
                   attribute12,
                   attribute13,
                   attribute14,
                   attribute15,
                   task_type,
                   priority,
                   task_group_id
            FROM   WMS_DISPATCHED_TASKS
            WHERE  TRANSACTION_TEMP_ID = l_task_temp_id AND TASK_TYPE = 3;
Line: 9591

         DELETE FROM WMS_DISPATCHED_TASKS
         WHERE       TRANSACTION_TEMP_ID = l_task_temp_id AND TASK_TYPE = 3;
Line: 9597

               print_debug ( 'Error while inserting into WMS_DISPATCHED_TASKS for l_task_temp_id: ' || l_task_temp_id );
Line: 9641

	PROCEDURE update_cc_status
		(x_result_out						OUT		NOCOPY VARCHAR2,
		 x_cc_id								OUT		NOCOPY VARCHAR2,
		 p_organization_id			IN		NUMBER,
		 p_parent_lpn_id				IN		NUMBER,
		 p_inventory_item_id		IN		NUMBER,
		 p_sub_code							IN		VARCHAR2,
		 p_loc_id								IN		NUMBER,
		 p_cc_header_id					IN		NUMBER,
		 p_task_id							IN		NUMBER,
		 p_revision							IN		VARCHAR2)

    IS
    PRAGMA AUTONOMOUS_TRANSACTION;
Line: 9671

            print_debug ( '***Inside update_cc_status***' );
Line: 9672

            print_debug ( '***Inside update_cc_status p_organization_id : ***'||p_organization_id );
Line: 9673

            print_debug ( '***Inside update_cc_status p_parent_lpn_id : ***'||p_parent_lpn_id );
Line: 9674

						print_debug ( '***Inside update_cc_status l_parent_lpn_id : ***'||l_parent_lpn_id );
Line: 9675

            print_debug ( '***Inside update_cc_status p_inventory_item_id : ***'||p_inventory_item_id );
Line: 9676

            print_debug ( '***Inside update_cc_status p_sub_code : ***'||p_sub_code );
Line: 9677

            print_debug ( '***Inside update_cc_status p_loc_id : ***'||p_loc_id );
Line: 9678

            print_debug ( '***Inside update_cc_status p_cc_header_id : ***'||p_cc_header_id );
Line: 9679

            print_debug ( '***Inside update_cc_status p_task_id : ***'||p_task_id );
Line: 9680

            print_debug ( '***Inside update_cc_status p_revision : ***'||p_revision);
Line: 9684

    SELECT Min(CYCLE_COUNT_ENTRY_ID)
      INTO l_cc_id
      FROM mtl_cycle_count_entries
     WHERE organization_id        = p_organization_id
       AND cycle_count_header_id  = p_cc_header_id
       AND entry_status_code     IN (1,3)
       AND inventory_item_id      = p_inventory_item_id
       AND Nvl(subinventory,'@@@')= Nvl(p_sub_code,'@@@')
       AND Nvl(locator_id,-999)   = Nvl(p_loc_id,-999)
       AND NVL ( parent_lpn_id, -99999 ) = NVL ( l_parent_lpn_id, -99999 )
       AND Nvl(revision,'###')    = Nvl(p_revision,'###');
Line: 9701

    SELECT 'Y'
      INTO l_temp_exists
      FROM wms_dispatched_tasks
     WHERE transaction_temp_id =  l_cc_id
       AND status = 9;
Line: 9710

      print_debug ( '***Inside update_cc_status Exception Block- No data found while chking the wdt for temp_id***' );
Line: 9715

      print_debug ( '***Inside update_cc_status Exception Block- Others while chking the wdt for temp_id***' );
Line: 9725

    UPDATE wms_dispatched_tasks
        SET transaction_temp_id = l_cc_id
      WHERE transaction_temp_id = p_task_id;
Line: 9736

      print_debug ( 'No Need to Update rows in wdt ');
Line: 9750

     print_debug ( '***Inside update_cc_status Exception Block- No Data Found***' );
Line: 9758

     print_debug ( '***Inside update_cc_status Exception Block- Others***' );
Line: 9763

END update_cc_status;
Line: 9798

         wms_picking_pkg.g_previous_task_status.delete(p_transaction_temp_id);
Line: 9811

        UPDATE  wms_dispatched_tasks
           SET  status = l_prev_task_status
             ,last_update_date = SYSDATE
             ,last_updated_by = p_user_id
         WHERE  person_id = p_employee_id
           AND task_type = 3
           AND (  status IN (3,9) )
           AND  transaction_temp_id = p_transaction_temp_id;
Line: 9821

          print_debug('no WDT to update  for this employee id  for this  Transaction Temp id with status in ( 3,9) ' );
Line: 9828

        DELETE  wms_dispatched_tasks
         WHERE  person_id = p_employee_id
          AND task_type = 3
          AND (status   IN (1,3,9 )) ;
Line: 9834

          print_debug('no WDT with status 3,9,1 remaining to delete for this employee id   ' );
Line: 9837

           print_debug('Deleted all WDT with staus 3,9,1 for p_employee_id =  ' || p_employee_id);
Line: 9921

  PROCEDURE insert_cc_task( p_organization_id      IN          NUMBER
				,p_user_id                         IN          NUMBER
                ,p_employee_id                     IN          NUMBER
                ,p_sign_on_equipment_id            IN          NUMBER
                ,p_task_method                     IN          VARCHAR2
				,p_cycle_count_entry_id            IN          NUMBER
                ,p_cc_header_id                    IN          NUMBER
                ,p_item_id                         IN          NUMBER
                ,p_revision                        IN          VARCHAR2
                ,p_sub_code                        IN          VARCHAR2
                ,p_loc_id                          IN          VARCHAR2
                ,x_temp_id                         OUT NOCOPY  NUMBER
                ,x_return_status                   OUT NOCOPY  VARCHAR2
				,x_msg_count                       OUT NOCOPY  NUMBER
                ,x_msg_data                        OUT NOCOPY  VARCHAR2)
IS
   l_proc_name               VARCHAR2(30) :=  'INSERT_CC_TASK';
Line: 9950

     print_debug ('***Inside insert_cc_task p_employee_id : ' || p_employee_id);
Line: 9951

     print_debug ( '***Inside insert_cc_task p_organization_id : ***'||p_organization_id );
Line: 9952

     print_debug ( '***Inside insert_cc_task p_item_id : ***'||p_item_id );
Line: 9953

     print_debug ( '***Inside insert_cc_task p_sub_code : ***'||p_sub_code );
Line: 9954

     print_debug ( '***Inside insert_cc_task p_loc_id : ***'||p_loc_id );
Line: 9955

     print_debug ( '***Inside insert_cc_task p_cc_header_id : ***'||p_cc_header_id );
Line: 9956

     print_debug ( '***Inside insert_cc_task p_revision : ***'||p_revision);
Line: 9961

    SELECT min(cycle_count_entry_id)
      INTO l_transaction_temp_id
      FROM mtl_cycle_count_entries
      WHERE organization_id        = p_organization_id
       AND cycle_count_header_id   = p_cc_header_id
       AND entry_status_code      IN (1,3)
       AND inventory_item_id      = p_item_id
       AND nvl(revision,'###')    = nvl(p_revision,'###')
       AND nvl(subinventory,'@@@')= nvl(p_sub_code,'@@@')
       AND nvl(locator_id,-999)   = nvl(p_loc_id,-999)
	   AND standard_operation_id is not null;
Line: 9977

       SELECT nvl(standard_operation_id,0),nvl(task_priority,0)
       INTO l_standard_operation_id,l_task_priority
       from mtl_cycle_count_entries
       WHERE cycle_count_entry_id = l_transaction_temp_id;
Line: 9984

      SELECT 1
         INTO l_wdt_rowcnt
         FROM dual
         WHERE exists (SELECT 1
                         FROM wms_dispatched_tasks t
                         WHERE t.transaction_temp_id = l_transaction_temp_id);
Line: 9998

       SELECT "ROLE",
               equipment,
               eqp_id
         INTO  l_person_resource_id,
               l_machine_resource_id,
               l_equipment_id
         FROM  wms_person_resource_utt_v
               WHERE emp_id = p_employee_id
               AND standard_operation_id = l_standard_operation_id
               AND NVL(eqp_id, -999) = NVL(p_sign_on_equipment_id, NVL(eqp_id, -999));
Line: 10011

          INSERT INTO wms_dispatched_tasks
              (task_id,
               transaction_temp_id,
               organization_id,
               user_task_type,
               person_id,
               effective_start_date,
               effective_end_date,
               equipment_id,
               equipment_instance,
               person_resource_id,
               machine_resource_id,
               status,
               dispatched_time,
               last_update_date,
               last_updated_by,
               creation_date,
               created_by,
               task_type,
               operation_plan_id,
               move_order_line_id,
               priority,
               task_method)
              VALUES
              (wms_dispatched_tasks_s.NEXTVAL,
               l_transaction_temp_id,
               p_organization_id,
               l_standard_operation_id,
               p_employee_id,
               sysdate,
               sysdate,
               l_equipment_id,
               null,
               l_person_resource_id,
               l_machine_resource_id,
               3, -- Dispatched
               sysdate,
               sysdate,
               p_user_id,
               sysdate,
               p_user_id,
               3, --cycle count task
               null,
               null,
               l_task_priority,
               p_task_method);
Line: 10060

			   print_debug('Inserted into WDT'||'l_progress'||l_progress);
Line: 10066

        UPDATE wms_dispatched_tasks
        SET status                = 9, -- Active
        last_update_date      = sysdate,
        last_updated_by       = p_user_id
        WHERE transaction_temp_id = l_transaction_temp_id;
Line: 10072

        print_debug('updated WDT to Active');
Line: 10090

END insert_cc_task;
Line: 10113

		SELECT msn.current_organization_id, msn.inventory_item_id, msn.current_status, mp.organization_code
		FROM mtl_serial_numbers msn,mtl_parameters mp
		WHERE  msn.serial_number = p_fserial_num
		AND msn.current_organization_id IS NOT NULL
		AND msn.inventory_item_id IS NOT NULL
		AND msn.current_organization_id = mp.organization_id;
Line: 10130

			SELECT 'x'
			INTO l_nothing
     	     FROM MTL_SERIAL_NUMBERS S, MTL_PARAMETERS P
     	     WHERE S.CURRENT_ORGANIZATION_ID = P.ORGANIZATION_ID
     	     AND S.SERIAL_NUMBER = p_from_serial
     	     AND P.SERIAL_NUMBER_TYPE = 3
			 AND P.ORGANIZATION_ID <> p_organization_id;
Line: 10336

 mtl_serial_numbers, mtl_cycle_count_entries will be updated and the out parameter x_return_result will
 have the value 1.

 In case count quantity is not equal to system quantity (or there are other discrepancies), this procedure
 will not perform any logic and x_return_result will be set equal to 2.

*/

PROCEDURE process_multiple_qty_only ( x_return_result OUT NOCOPY NUMBER )
IS
   l_system_quantity NUMBER;
Line: 10358

        SELECT subinventory_code,
          locator_id
        INTO l_lpn_subinventory,
          l_lpn_loc_id
        FROM wms_license_plate_numbers
        WHERE lpn_id = g_cc_entry.parent_lpn_id;
Line: 10388

        SELECT COUNT(*)
        INTO l_count_present_qty
        FROM mtl_serial_numbers msn,
         mtl_cc_serial_numbers mccsn
        WHERE mccsn.cycle_count_entry_id = g_cc_entry.cycle_count_entry_id
        AND msn.serial_number            = mccsn.serial_number
        AND msn.current_organization_id  = g_cc_entry.organization_id
        AND msn.inventory_item_id        = g_cc_entry.inventory_item_id
        AND msn.group_mark_id            = 1;
Line: 10443

             UPDATE mtl_cc_serial_numbers
             SET last_update_date       = SYSDATE,
               last_updated_by          = g_user_id,
               last_update_login        = g_login_id,
               number_of_counts         = NVL(number_of_counts, 0) + 1,
               unit_status_current      = 1,
               unit_status_prior        = NVL(unit_status_current, 1),
               unit_status_first        = NVL(unit_status_first, 1),
               approval_condition       = NULL,
               pos_adjustment_qty       = 0,
               neg_adjustment_qty       = 0
            WHERE cycle_count_entry_id = g_cc_entry.cycle_count_entry_id;
Line: 10457

                 print_debug('Number of records updated in MTL_CC_SERIAL_NUMBERS table: ' || SQL%ROWCOUNT);
Line: 10461

            UPDATE mtl_serial_numbers msn
            SET msn.group_mark_id             = NULL
            WHERE msn.current_organization_id = g_cc_entry.organization_id
            AND msn.inventory_item_id         = g_cc_entry.inventory_item_id
            AND EXISTS
              (SELECT 1
              FROM mtl_cc_serial_numbers mccsn
              WHERE mccsn.cycle_count_entry_id = g_cc_entry.cycle_count_entry_id
              AND mccsn.serial_number          = msn.serial_number
              )
            AND msn.group_mark_id = 1;
Line: 10474

                 print_debug('Number of records updated in MTL_SERIAL_NUMBERS table: ' || SQL%ROWCOUNT);
Line: 10500

        delete_reservation();
Line: 10531

        update_row();