DBA Data[Home] [Help]

APPS.INV_LOC_WMS_PUB SQL Statements

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

Line: 5

  * Table to pass DFF attributes to create_locator and update_locator apis
  **/
   TYPE char_tbl IS TABLE OF VARCHAR2(1500) INDEX BY BINARY_INTEGER;
Line: 18

		SELECT count(1) into l_dummy
		FROM mtl_material_transactions_temp
		WHERE organization_id = p_org_id
		AND   locator_id = p_loc_id
		AND ROWNUM =1 ;
Line: 27

		  SELECT count(1) into l_dummy
		  FROM mtl_material_transactions_temp
		  WHERE transfer_organization = p_org_id
		  AND   transfer_to_location  = p_loc_id
		  AND ROWNUM =1 ;
Line: 37

		  SELECT count(1) INTO l_dummy
		  FROM mtl_onhand_quantities_detail
		  WHERE locator_id = p_loc_id
		  AND   organization_id = p_org_id
		  AND ROWNUM =1 ;
Line: 47

		   SELECT count(1) INTO l_dummy
		   FROM mtl_system_items_b
		   WHERE organization_id = p_org_id
		   AND wip_supply_locator_id = p_loc_id
		   AND rownum = 1;
Line: 494

    l_status_rec        inv_material_status_pub.mtl_status_update_rec_type;
Line: 527

    SAVEPOINT locator_insert;
Line: 553

         SELECT enforce_locator_alis_unq_flag
         INTO   l_org_alias_uniqueness
         FROM   mtl_parameters
         WHERE  organization_id = l_organization_id;
Line: 576

          SELECT organization_id,
                 enforce_locator_alis_unq_flag
          INTO   l_organization_id,
                 l_org_alias_uniqueness
          FROM   mtl_parameters
          WHERE  organization_code = p_organization_code;
Line: 614

     SELECT secondary_inventory_name,
                enable_locator_alias,
            enforce_alias_uniqueness,
            NVL(subinventory_type, 1)
       INTO l_subinventory_code,
                l_alias_enabled,
            l_sub_alias_uniqueness,
            l_subinventory_type
       FROM mtl_secondary_inventories
       WHERE secondary_inventory_name = p_subinventory_code
           AND organization_id = l_organization_id;
Line: 677

             SELECT concatenated_segments
             INTO   l_locator
             FROM   mtl_item_locations_kfv
             WHERE  organization_id = p_organization_id
             AND    alias = l_alias
             AND    NVL(physical_location_id,inventory_location_id) = inventory_location_id;
Line: 700

                SELECT concatenated_segments
                INTO   l_locator
                FROM   mtl_item_locations_kfv
                WHERE  organization_id = p_organization_id
                AND    alias = l_alias
                AND    subinventory_code = p_subinventory_code
                AND    NVL(physical_location_id,inventory_location_id) = inventory_location_id;
Line: 739

            SELECT inventory_location_id
            INTO  x_inventory_location_id
            FROM  mtl_item_locations_kfv
            WHERE  organization_id       = l_organization_id
               AND subinventory_code     = p_subinventory_code
               AND concatenated_segments = p_concatenated_segments
               AND ROWNUM < 2;
Line: 790

        SELECT status_id
          INTO l_status_id
          FROM mtl_material_statuses_vl
         WHERE status_id = p_status_id
           AND enabled_flag = 1;
Line: 805

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_location_weight_uom_code;
Line: 822

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_volume_uom_code;
Line: 837

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_pick_uom_code;
Line: 854

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_dimension_uom_code;
Line: 871

   /*   SELECT 'FAILED'
        INTO l_validity_check
        FROM DUAL
       WHERE EXISTS(   */



-- We need to check the pphysical locator isntead of the Logical locator .
-- root cause of duplicate records in other subinventories ..
-- Bug 7581675

l_physical_concat_seg := INV_PROJECT.GET_LOCSEGS(p_concatenated_segments);
Line: 886

               SELECT subinventory_code
           INTO l_subinventory_code
                 FROM mtl_item_locations_kfv
                WHERE concatenated_segments like l_physical_concat_seg||'%' -- instead of p_concatenated_segments
                  AND p_subinventory_code <> subinventory_code
                  AND organization_id = l_organization_id
          AND ROWNUM = 1 ;
Line: 945

            SELECT NVL(default_loc_status_id, 1)
              INTO l_status_id
              FROM mtl_secondary_inventories
             WHERE organization_id = l_organization_id
               AND secondary_inventory_name = p_subinventory_code;
Line: 980

            SELECT project_reference_enabled  ,  project_control_level
            INTO   l_project_reference_enabled,  l_project_control_level
            FROM PJM_ORG_PARAMETERS_V
            WHERE organization_id= l_organization_id;
Line: 987

            SELECT segment19,segment20
            INTO   l_segment19,l_segment20
            FROM mtl_item_locations
            WHERE organization_id = l_organization_id
            AND inventory_location_id = x_inventory_location_id;
Line: 1114

          UPDATE mtl_item_locations
             SET subinventory_code = NVL(p_subinventory_code, NULL)
               , status_id = NVL(l_status_id, NULL)
               , inventory_location_type = NVL(l_loc_type, NULL)
               , description = NVL(p_description, NULL)
               , picking_order = NVL(p_picking_order, NULL)
               , location_maximum_units = NVL(p_location_maximum_units, NULL)
               , location_weight_uom_code = NVL(p_location_weight_uom_code, NULL)
               , max_weight = NVL(p_max_weight, NULL)
               , volume_uom_code = NVL(p_volume_uom_code, NULL)
               , max_cubic_area = NVL(p_max_cubic_area, NULL)
               , x_coordinate = NVL(p_x_coordinate, NULL)
               , y_coordinate = NVL(p_y_coordinate, NULL)
               , z_coordinate = NVL(p_z_coordinate, NULL)
               , physical_location_id = NVL(p_physical_location_id, NULL)
               , pick_uom_code = NVL(p_pick_uom_code, NULL)
               , dimension_uom_code = NVL(p_dimension_uom_code, NULL)
               , LENGTH = NVL(p_length, NULL)
               , width = NVL(p_width, NULL)
               , height = NVL(p_height, NULL)
               , dropping_order = NVL(p_dropping_order, NULL)
               , creation_date = SYSDATE
               , created_by = fnd_global.user_id
               , last_updated_by = fnd_global.user_id
               , last_update_date = SYSDATE
               , attribute_category = p_attribute_category
               , attribute1 = p_attribute1
               , attribute2 = p_attribute2
               , attribute3 = p_attribute3
               , attribute4 = p_attribute4
               , attribute5 = p_attribute5
               , attribute6 = p_attribute6
               , attribute7 = p_attribute7
               , attribute8 = p_attribute8
               , attribute9 = p_attribute9
               , attribute10 =p_attribute10
               , attribute11 =p_attribute11
               , attribute12 =p_attribute12
               , attribute13 =p_attribute13
               , attribute14 =p_attribute14
               , attribute15 =p_attribute15
               , alias       = l_alias
             WHERE organization_id = l_organization_id
             AND inventory_location_id = x_inventory_location_id;
Line: 1167

          l_status_rec.update_method          := inv_material_status_pub.g_update_method_manual;
Line: 1173

          l_status_rec.last_update_date       := SYSDATE;
Line: 1174

          l_status_rec.last_update_login      := fnd_global.user_id;
Line: 1177

          inv_material_status_pkg.insert_status_history(l_status_rec);
Line: 1189

      ROLLBACK TO locator_insert;
Line: 1194

      ROLLBACK TO locator_insert;
Line: 1200

      ROLLBACK TO locator_insert;
Line: 1211

  ** procedure    : update_locator
  ** description  : this procedure updates an existing locator
  **
  ** i/p          :
  ** NOTE:
  **  if the default value of the input parameter is used, then
  **  that column retains its original value and is not changed
  **  during update.
  **      this can be achieved by not passing this parameter during the
  **  API call.
  **
  ** p_organization_id
  **      identifier of organization in which locator is to
  **      be updated.
  ** p_organization_code
  **      organization code of organziation in which locator
  **      is to be updated. Either p_organization_id or
  **      p_organziation_code MUST be passed
  ** p_inventory_location_id
  **  identifier of locator to be updated
  ** p_concatenated_segments
  **      concatenated segment string with separator
  **      of the locator to be updated. Eg:A.1.1
  **  either p_inventory_location_id or p_concatenated_segments
  **  MUST be passed.
  ** p_description
  **      locator description
  ** p_inventory_location_type
  **      type of locator.
  **      dock door(1) or staging lane(2) or storage locator(3)
  ** p_picking_order
  **      number that identifies physical position of locator
  **      for  travel optimization during picking and task dispatching.
  **      It has a a higher precedence over x,y,z coordinates.
  ** p_location_maximum_units
  **      Maxmimum units the locator can hold
  ** p_subinventory_code
  **      Subinventory to which locator belongs
  ** p_location_weight_uom_code
  **      UOM of locator's max weight capacity
  ** p_max_weight
  **      Max weight locator can hold
  ** p_volume_uom_code
  **      UOM of locator's max volume capacity
  ** p_max_cubic_area
  **      Max volume capacity of the locator
  ** p_x_coordinate
  **      X-position of the locator in space. Used
  **      for  travel optimization during picking and task dispatching.
  ** p_y_coordinate
  **      Y-position of the locator in space. Used
  **      for  travel optimization during picking and task dispatching.
  ** p_z_coordinate
  **      Z-position of the locator in space. Used
  **      for  travel optimization during picking and task dispatching.
  ** p_physical_location_id
  **      locators that are the same physically have the same
  **      inventory_location_id in this column
  ** p_pick_uom_code
  **      UOM in which material is picked from locator
  ** p_dimension_uom_code
  **      UOM in which locator dimensions are expressed
  ** p_length
  **      Length of the locator
  ** p_width
  **      Width of the locator
  ** p_height
  **      Height of the locator
  ** p_status_id
  **      Material Status that needs to be associated to locator
  ** p_dropping_order
  **      For ordering drop-off locators and also to order by putaway
  **      drop-off operations (bug 2681871)
  ** For the DFF attributes mentioned below, to update correctly use the following strategy
  **     To retain the value in the table, do not pass any value OR pass NULL as i/p
  **     To update the attribute with NULL, pass fnd_api.g_miss_char
  **     To update with any other value, pass the appropriate value
  ** p_attribute_category Holds the Context of the Descriptive FlexField for the Locator
  ** p_attribute1 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute2 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute3 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute4 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute5 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute6 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute7 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute8 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute9 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute10 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute11 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute12 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute13 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute14 Holds the Descriptive FlexField attribute for the Locator
  ** p_attribute15 Holds the Descriptive FlexField attribute for the Locator
  **
  ** o/p:
  ** x_return_status
  **      return status indicating success, error, unexpected error
  ** x_msg_count
  **      number of messages in message list
  ** x_msg_data
  **      if the number of messages in message list is 1, contains
  **      message text
  **
  ** ---------------------------------------------------------------------------
  */
  PROCEDURE UPDATE_LOCATOR (x_return_status               OUT NOCOPY VARCHAR2,
                            x_msg_count               OUT NOCOPY NUMBER,
                            x_msg_data            OUT NOCOPY VARCHAR2,
                          p_organization_id             IN NUMBER ,
                          p_organization_code           IN VARCHAR2,
                          p_inventory_location_id   IN NUMBER,
                          p_concatenated_segments   IN VARCHAR2,
                          p_description         IN VARCHAR2 ,
                          p_disabled_date       IN DATE ,
                          p_inventory_location_type     IN NUMBER ,
                          p_picking_order       IN NUMBER ,
                          p_location_maximum_units  IN NUMBER ,
                          p_location_Weight_uom_code    IN VARCHAR2 ,
                          p_max_weight              IN NUMBER ,
                          p_volume_uom_code         IN VARCHAR2 ,
                          p_max_cubic_area      IN NUMBER ,
                          p_x_coordinate        IN NUMBER ,
                          p_y_coordinate        IN NUMBER ,
                          p_z_coordinate        IN NUMBER ,
                          p_physical_location_id    IN NUMBER ,
                          p_pick_uom_code       IN VARCHAR2 ,
                          p_dimension_uom_code          IN VARCHAR2 ,
                          p_length          IN NUMBER ,
                          p_width           IN NUMBER ,
                          p_height          IN NUMBER ,
                          p_status_id               IN NUMBER ,
                             p_dropping_order        IN NUMBER ,
                          p_attribute_category    IN VARCHAR2 ,
                          p_attribute1               IN   VARCHAR2
  , p_attribute2               IN            VARCHAR2
  , p_attribute3               IN            VARCHAR2
  , p_attribute4               IN            VARCHAR2
  , p_attribute5               IN            VARCHAR2
  , p_attribute6               IN            VARCHAR2
  , p_attribute7               IN            VARCHAR2
  , p_attribute8               IN            VARCHAR2
  , p_attribute9               IN            VARCHAR2
  , p_attribute10              IN            VARCHAR2
  , p_attribute11              IN            VARCHAR2
  , p_attribute12              IN            VARCHAR2
  , p_attribute13              IN            VARCHAR2
  , p_attribute14              IN            VARCHAR2
  , p_attribute15              IN            VARCHAR2
  , p_alias                    IN            VARCHAR2
  ) AS
    l_organization_id       NUMBER;
Line: 1372

    l_status_rec            inv_material_status_pub.mtl_status_update_rec_type;
Line: 1391

    SAVEPOINT locator_update;
Line: 1394

    l_procedure_name := 'UPDATE_LOCATOR';
Line: 1413

         SELECT enforce_locator_alis_unq_flag
         INTO   l_org_alias_uniqueness
         FROM   mtl_parameters
         WHERE  organization_id = l_organization_id;
Line: 1435

           SELECT organization_id,
                  enforce_locator_alis_unq_flag
           INTO   l_organization_id,
                  l_org_alias_uniqueness
           FROM   mtl_parameters
           WHERE  organization_code = p_organization_code;
Line: 1466

          SELECT inventory_location_id
          INTO l_inventory_location_id
          FROM MTL_ITEM_LOCATIONS_KFV
          WHERE concatenated_segments = p_concatenated_segments
            and organization_id = l_organization_id;
Line: 1520

      SELECT NVL(msi.subinventory_type, 1)
        INTO l_subinventory_type
        FROM mtl_item_locations mil, mtl_secondary_inventories msi
        WHERE mil.inventory_location_id = l_inventory_location_id
        AND mil.organization_id = l_organization_id
        AND mil.subinventory_code = msi.secondary_inventory_name
        AND msi.organization_id = l_organization_id;
Line: 1552

      SELECT status_id,
             subinventory_code
      INTO   l_status_id,
             l_subinventory_code
      FROM   mtl_item_locations
      WHERE  inventory_location_id = l_inventory_location_id
      AND    organization_id = l_organization_id;
Line: 1565

    SELECT enable_locator_alias,
           enforce_alias_uniqueness
    INTO   l_alias_enabled,
           l_sub_alias_uniqueness
    FROM   mtl_secondary_inventories
    WHERE  secondary_inventory_name = l_subinventory_code
    AND    organization_id = l_organization_id;
Line: 1595

             SELECT concatenated_segments
             INTO   l_locator
             FROM   mtl_item_locations_kfv
             WHERE  organization_id = p_organization_id
             AND    alias = l_alias
             AND    NVL(physical_location_id,inventory_location_id) = inventory_location_id;
Line: 1617

                SELECT concatenated_segments
                INTO   l_locator
                FROM   mtl_item_locations_kfv
                WHERE  organization_id = p_organization_id
                AND    alias = l_alias
                AND    subinventory_code = l_subinventory_code
                AND    NVL(physical_location_id,inventory_location_id) = inventory_location_id;
Line: 1648

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_location_weight_uom_code;
Line: 1666

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_volume_uom_code;
Line: 1683

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_pick_uom_code;
Line: 1701

        SELECT 1
          INTO l_chkflg
          FROM mtl_units_of_measure
         WHERE uom_code = p_dimension_uom_code;
Line: 1718

        SELECT 1
          INTO l_chkflg
          FROM mtl_material_statuses_vl
         WHERE status_id = p_status_id
           AND enabled_flag = 1;
Line: 1887

      We will update the MTL_ITEM_LOCATIONS
          table with the information provided
    */
    --bug 7297065
    IF (p_disabled_date is not null ) THEN

         l_is_disable_allow := is_disable_allow(p_org_id =>l_organization_id,
                                                 p_loc_id=> l_inventory_location_id
                                                );
Line: 1906

    UPDATE mtl_item_locations
       SET description = DECODE(p_description, fnd_api.g_miss_char, description, p_description)
         , disable_date = DECODE(p_disabled_date, fnd_api.g_miss_date, disable_date, p_disabled_date)
         , inventory_location_type =
                                   DECODE(
                                     p_inventory_location_type
                                   , fnd_api.g_miss_num, inventory_location_type
                                   , p_inventory_location_type
                                   )
         , picking_order = DECODE(p_picking_order, fnd_api.g_miss_num, picking_order, p_picking_order)
         , location_maximum_units = DECODE(p_location_maximum_units, fnd_api.g_miss_num, location_maximum_units, p_location_maximum_units)
         , location_weight_uom_code =
                               DECODE(
                                 p_location_weight_uom_code
                               , fnd_api.g_miss_char, location_weight_uom_code
                               , p_location_weight_uom_code
                               )
         , max_weight = DECODE(p_max_weight, fnd_api.g_miss_num, max_weight, p_max_weight)
         , volume_uom_code = DECODE(p_volume_uom_code, fnd_api.g_miss_char, volume_uom_code, p_volume_uom_code)
         , max_cubic_area = DECODE(p_max_cubic_area, fnd_api.g_miss_num, max_cubic_area, p_max_cubic_area)
         , x_coordinate = DECODE(p_x_coordinate, fnd_api.g_miss_num, x_coordinate, p_x_coordinate)
         , y_coordinate = DECODE(p_y_coordinate, fnd_api.g_miss_num, y_coordinate, p_y_coordinate)
         , z_coordinate = DECODE(p_z_coordinate, fnd_api.g_miss_num, z_coordinate, p_z_coordinate)
         , pick_uom_code = DECODE(p_pick_uom_code, fnd_api.g_miss_char, pick_uom_code, p_pick_uom_code)
         , dimension_uom_code = DECODE(p_dimension_uom_code, fnd_api.g_miss_char, dimension_uom_code, p_dimension_uom_code)
         , LENGTH = DECODE(p_length, fnd_api.g_miss_num, LENGTH, p_length)
         , width = DECODE(p_width, fnd_api.g_miss_num, width, p_width)
         , height = DECODE(p_height, fnd_api.g_miss_num, height, p_height)
         , status_id = DECODE(p_status_id, fnd_api.g_miss_num, status_id, p_status_id)
         , dropping_order = DECODE(p_dropping_order, fnd_api.g_miss_num, dropping_order, p_dropping_order)
         , last_updated_by = fnd_global.user_id
         , last_update_date = SYSDATE
         , attribute_category = decode(p_attribute_category, NULL, attribute_category, fnd_api.g_miss_char, NULL, p_attribute_category)
         , attribute1 = decode(p_attribute1, NULL, attribute1, fnd_api.g_miss_char, NULL, p_attribute1)
         , attribute2 = decode(p_attribute2, NULL, attribute2, fnd_api.g_miss_char, NULL, p_attribute2)
         , attribute3 = decode(p_attribute3, NULL, attribute3, fnd_api.g_miss_char, NULL, p_attribute3)
         , attribute4 = decode(p_attribute4, NULL, attribute4, fnd_api.g_miss_char, NULL, p_attribute4)
         , attribute5 = decode(p_attribute5, NULL, attribute5, fnd_api.g_miss_char, NULL, p_attribute5)
         , attribute6 = decode(p_attribute6, NULL, attribute6, fnd_api.g_miss_char, NULL, p_attribute6)
         , attribute7 = decode(p_attribute7, NULL, attribute7, fnd_api.g_miss_char, NULL, p_attribute7)
         , attribute8 = decode(p_attribute8, NULL, attribute8, fnd_api.g_miss_char, NULL, p_attribute8)
         , attribute9 = decode(p_attribute9, NULL, attribute9, fnd_api.g_miss_char, NULL, p_attribute9)
         , attribute10 = decode(p_attribute10, NULL, attribute10, fnd_api.g_miss_char, NULL, p_attribute10)
         , attribute11 = decode(p_attribute11, NULL, attribute11, fnd_api.g_miss_char, NULL, p_attribute11)
         , attribute12 = decode(p_attribute12, NULL, attribute12, fnd_api.g_miss_char, NULL, p_attribute12)
         , attribute13 = decode(p_attribute13, NULL, attribute13, fnd_api.g_miss_char, NULL, p_attribute13)
         , attribute14 = decode(p_attribute14, NULL, attribute14, fnd_api.g_miss_char, NULL, p_attribute14)
         , attribute15 = decode(p_attribute15, NULL, attribute15, fnd_api.g_miss_char, NULL, p_attribute15)
         , alias = l_alias
         WHERE inventory_location_id = l_inventory_location_id
       AND organization_id = l_organization_id;
Line: 1967

      l_status_rec.update_method          := inv_material_status_pub.g_update_method_manual;
Line: 1973

      l_status_rec.last_update_date       := SYSDATE;
Line: 1974

      l_status_rec.last_update_login      := fnd_global.user_id;
Line: 1978

      inv_material_status_pkg.insert_status_history(l_status_rec);
Line: 1984

      ROLLBACK TO locator_update;
Line: 1989

      ROLLBACK TO locator_update;
Line: 1994

      ROLLBACK TO locator_update;
Line: 2001

  END update_locator;
Line: 2019

  **     be updated. Either p_organization_id  or p_organziation_code
  **     MUST be passed
  ** p_subinventory_code
  **     The subinventory to which the locator need to be attached to .
  ** p_inventory_location_id
  **     Identifier of locator to be attached to the specified subinventory
  ** p_locator
  **     Concatenated segment string with separator of the locator to be
  **     updated. Eg:A.1.1 either p_inventory_location_id or
  **     p_concatenated_segments MUST be passed.
  ** p_status_id
  **     Identifier of status
  ** p_par_level
  **     PAR level for the item-locator. Valid only when the subinventory is PAR planned.
  **
  ** o/p:
  **
  ** x_return_status
  **      return status indicating success, error, unexpected error
  ** x_msg_count
  **      number of messages in message list
  ** x_msg_data
  **      if the number of messages in message list is 1, contains
  **      message text
  **
  ** ---------------------------------------------------------------------------
  */
  PROCEDURE create_loc_item_tie(
    x_return_status         OUT NOCOPY    VARCHAR2
  , x_msg_count             OUT NOCOPY    NUMBER
  , x_msg_data              OUT NOCOPY    VARCHAR2
  , p_inventory_item_id     IN            NUMBER
  , p_item                  IN            VARCHAR2
  , p_organization_id       IN            NUMBER
  , p_organization_code     IN            VARCHAR2
  , p_subinventory_code     IN            VARCHAR2
  , p_inventory_location_id IN            NUMBER
  , p_locator               IN            VARCHAR2
  , p_status_id             IN            NUMBER
  , p_par_level             IN            NUMBER DEFAULT NULL
  ) AS
    l_inventory_item_id NUMBER;
Line: 2086

          SELECT organization_id
            INTO l_organization_id
            FROM mtl_parameters
           WHERE organization_code = p_organization_code;
Line: 2111

          SELECT inventory_item_id
            INTO l_inventory_item_id
            FROM mtl_system_items_kfv
           WHERE concatenated_segments = p_item
             AND organization_id = l_organization_id;
Line: 2134

        SELECT NVL(planning_level, 2)
          INTO l_planning_level
          FROM mtl_secondary_inventories
         WHERE secondary_inventory_name = p_subinventory_code
           AND organization_id = l_organization_id;
Line: 2159

          SELECT inventory_location_id
            INTO l_locator_id
            FROM mtl_item_locations_kfv
           WHERE concatenated_segments = p_locator
             AND organization_id = l_organization_id;
Line: 2176

      SELECT 'VALID'
        INTO l_subflag
        FROM mtl_item_locations
       WHERE inventory_location_id = l_locator_id
         AND subinventory_code = p_subinventory_code
         AND organization_id = l_organization_id;
Line: 2191

      SELECT 'Y'
        INTO l_locator_exists
        FROM mtl_secondary_locators
       WHERE secondary_locator = l_locator_id
         AND organization_id = l_organization_id
         AND inventory_item_id = l_inventory_item_id;
Line: 2204

        SELECT 1
          INTO l_status_chk
          FROM mtl_material_statuses_vl
         WHERE status_id = p_status_id
           AND enabled_flag = 1;
Line: 2220

      SELECT 1
        INTO l_item_sub
        FROM mtl_item_sub_inventories
       WHERE inventory_item_id = l_inventory_item_id
         AND secondary_inventory = p_subinventory_code
         AND organization_id = l_organization_id;
Line: 2228

        INSERT INTO mtl_item_sub_inventories
                    (
                     inventory_item_id
                   , organization_id
                   , secondary_inventory
                   , last_update_date
                   , last_updated_by
                   , creation_date
                   , created_by
                   , inventory_planning_code
                    )
             VALUES (
                     l_inventory_item_id
                   , l_organization_id
                   , p_subinventory_code
                   , SYSDATE
                   , fnd_global.user_id
                   , SYSDATE
                   , fnd_global.user_id
                   , 6
                    );
Line: 2251

    /* If the l_locator_flag is N then insert a row into MTL_SECONDARY_LOCATORS */
    IF l_locator_exists = 'N' THEN
      IF (inv_control.g_current_release_level >= inv_release.g_j_release_level) THEN
        INSERT INTO mtl_secondary_locators
                    (
                     inventory_item_id
                   , organization_id
                   , secondary_locator
                   , last_update_date
                   , last_updated_by
                   , creation_date
                   , created_by
                   , subinventory_code
                   , status_id
                   , maximum_quantity
                    )
             VALUES (
                     l_inventory_item_id
                   , l_organization_id
                   , l_locator_id
                   , SYSDATE
                   , fnd_global.user_id
                   , SYSDATE
                   , fnd_global.user_id
                   , p_subinventory_code
                   , p_status_id
                   , DECODE(l_planning_level, 1, p_par_level, NULL)
                    );
Line: 2280

        INSERT INTO mtl_secondary_locators
                    (
                     inventory_item_id
                   , organization_id
                   , secondary_locator
                   , last_update_date
                   , last_updated_by
                   , creation_date
                   , created_by
                   , subinventory_code
                   , status_id
                    )
             VALUES (
                     l_inventory_item_id
                   , l_organization_id
                   , l_locator_id
                   , SYSDATE
                   , fnd_global.user_id
                   , SYSDATE
                   , fnd_global.user_id
                   , p_subinventory_code
                   , p_status_id
                    );
Line: 2306

      /* Locator selected has already been assigned to this item and subinventory */
      fnd_msg_pub.ADD;
Line: 2334

  ** procedure   : delete_locator
  ** description : this procedure deletes a locator in a given organization.
  ** i/p
  ** p_inventory_location_id
  **     identifier of locator to be deleted
  ** p_concatenated_segments
  **     concatenated segment string with separator of the locator to be deleted. Eg:A.1.1
  ** p_organization_id
  **     identifier of organization in which locator is to be deleted.
  ** p_organization_code
  **     organization code of organziation in which locator is to be deleted.
  **     Either  p_organization_id  or   p_organziation_code MUST be passed
  ** p_validation_req_flag
  **     the flag which determines whether validation is required or not.
  **     If it is 'N',the locator is deleted without any further validation
  **     on its existence  in other tables.If it is'Y', the locator is deleted
  **     only if doesnot exist in other tables.
  **
  ** o/p
  ** x_return_status
  **     return status indicating success, error, unexpected error
  ** x_msg_count
  **     number of messages in message list
  ** x_msg_data   :
  **     if the number of messages in message list is 1,
  **     contains message text x_inventory_location_id
  **
  **-----------------------------------------------------------------------------------
  */
  PROCEDURE delete_locator(
    x_return_status         OUT NOCOPY    VARCHAR2
  , x_msg_count             OUT NOCOPY    NUMBER
  , x_msg_data              OUT NOCOPY    VARCHAR2
  , p_inventory_location_id IN            NUMBER
  , p_concatenated_segments IN            VARCHAR2
  , p_organization_id       IN            NUMBER
  , p_organization_code     IN            VARCHAR2
  , p_validation_req_flag   IN            VARCHAR2
  ) IS
    /* Locator details */
    l_inventory_location_id NUMBER;
Line: 2392

      SELECT 1
        INTO l_chk_org
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM mtl_parameters
                     WHERE organization_id = p_organization_id);
Line: 2407

        SELECT organization_id
          INTO l_organization_id
          FROM mtl_parameters
         WHERE organization_code = p_organization_code;
Line: 2422

      SELECT 1
        INTO l_chk_loc
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM mtl_item_locations
                     WHERE inventory_location_id = p_inventory_location_id
                       AND organization_id = l_organization_id);
Line: 2467

      SELECT 1
        INTO l_physical_locator_id
        FROM DUAL
       WHERE EXISTS(SELECT 1
                      FROM mtl_item_locations
                     WHERE physical_location_id = l_inventory_location_id
                       AND organization_id = l_organization_id
               AND inventory_location_id <> physical_location_id); --Bug :5036570
Line: 2478

      /*Locator LOCATOR cannot be deleted as it exists as a Physical Locator to Some other Locators*/
      fnd_msg_pub.ADD;
Line: 2494

      SELECT 1
        INTO l_active_loc
        FROM mtl_item_locations
       WHERE inventory_location_id = l_inventory_location_id
         AND organization_id = l_organization_id
         AND NVL(disable_date, SYSDATE + 1) > SYSDATE;
Line: 2503

      /*Locator locator cannot be deleted as  it is active */
      fnd_msg_pub.ADD;
Line: 2513

     delete the locator from MTL_ITEM_LOCATIONS table without validating further .
     Otherwise do the following steps */
    IF p_validation_req_flag = 'Y' THEN --If For Validation
      /* Check if the locator is present in  MTL_ONHAND_QUANTITIES_DETAIL
         If the locator_id exists then error out*/
      BEGIN
        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM mtl_onhand_quantities_detail
                       WHERE locator_id = l_inventory_location_id
                         AND organization_id = l_organization_id);
Line: 2529

        /*Locator locator cannot be deleted as items exist in it*/
        fnd_msg_pub.ADD;
Line: 2541

        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM mtl_reservations
                       WHERE locator_id = l_inventory_location_id
                         AND organization_id = l_organization_id);
Line: 2551

        /*The locator locator cannot be deleted as reservations exist against it*/
        fnd_msg_pub.ADD;
Line: 2562

        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM wms_license_plate_numbers
                       WHERE locator_id = l_inventory_location_id
                         AND organization_id = l_organization_id);
Line: 2572

        /*Locator locator cannot be deleted as LPNs reside in it*/
        fnd_msg_pub.ADD;
Line: 2583

        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM mtl_secondary_locators
                       WHERE secondary_locator = l_inventory_location_id
                         AND organization_id = l_organization_id);
Line: 2593

        /*Locator locator cannot be deleted as it is tied to an item */
        fnd_msg_pub.ADD;
Line: 2604

        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM mtl_transactions_interface
                       WHERE locator_id = l_inventory_location_id
                         AND organization_id = l_organization_id);
Line: 2614

        /*Locator locator cannot be deleted as there are pending transactions against it*/
        fnd_msg_pub.ADD;
Line: 2628

        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(
                 SELECT 1
                   FROM mtl_material_transactions_temp
                  WHERE (locator_id = l_inventory_location_id
                         AND organization_id = l_organization_id)
                     OR(transfer_to_location = l_inventory_location_id
                        AND NVL(transfer_organization, organization_id) = l_organization_id));
Line: 2641

        /*Locator locator cannot be deleted as there are pending transactions against it*/
        fnd_msg_pub.ADD;
Line: 2652

        SELECT 1
          INTO l_chk_flag
          FROM DUAL
         WHERE EXISTS(SELECT 1
                        FROM rcv_transactions_interface
                       WHERE locator_id = l_inventory_location_id
                         AND to_organization_id = l_organization_id);
Line: 2662

        /*Locator locator cannot be deleted as there are pending transactions against it*/
        fnd_msg_pub.ADD;
Line: 2671

    /* If all the above steps  are success then delete the inventory_location_id
     from MTL_ITEM_LOCATIONS
     for the combination of inventory_location_id and organization_id*/
    DELETE      mtl_item_locations
          WHERE inventory_location_id = l_inventory_location_id
            AND organization_id = l_organization_id;
Line: 2694

        fnd_msg_pub.add_exc_msg('inv_loc_wms_pub', 'delete_locator');
Line: 2698

  END delete_locator;