DBA Data[Home] [Help]

APPS.INV_LOC_WMS_UTILS SQL Statements

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

Line: 53

   /* Select all required values at same time
   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id; */
Line: 62

   SELECT
       physical_location_id,
       inventory_location_id,
       location_maximum_units,
       location_current_units,
       location_available_units,
       location_suggested_units,
       location_weight_uom_code,
       max_weight,
       current_weight,
       suggested_weight,
       available_weight,
       volume_uom_code,
       max_cubic_area,
       current_cubic_area,
       suggested_cubic_area,
       available_cubic_area
     INTO l_physical_locator_id,
       l_locator_id,
       x_location_maximum_units,
       x_location_current_units,
       x_location_available_units,
       x_location_suggested_units,
       x_location_weight_uom_code,
       x_max_weight,
       x_current_weight,
       x_suggested_weight,
       x_available_weight,
       x_volume_uom_code,
       x_max_cubic_area,
       x_current_cubic_area,
       x_suggested_cubic_area,
       x_available_cubic_area
     from mtl_item_locations
     where organization_id              = p_organization_id
       and   inventory_location_id      = p_inventory_location_id;
Line: 101

     select
       location_maximum_units,
       location_current_units,
       location_available_units,
       location_suggested_units,
       location_weight_uom_code,
       max_weight,
       current_weight,
       suggested_weight,
       available_weight,
       volume_uom_code,
       max_cubic_area,
       current_cubic_area,
       suggested_cubic_area,
       available_cubic_area
     into
       x_location_maximum_units,
       x_location_current_units,
       x_location_available_units,
       x_location_suggested_units,
       x_location_weight_uom_code,
       x_max_weight,
       x_current_weight,
       x_suggested_weight,
       x_available_weight,
       x_volume_uom_code,
       x_max_cubic_area,
       x_current_cubic_area,
       x_suggested_cubic_area,
       x_available_cubic_area
     from mtl_item_locations
     where organization_id 		= p_organization_id
       and   inventory_location_id 	= l_physical_locator_id;
Line: 199

   /* Select all required values at same time
   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id; */
Line: 207

   SELECT physical_location_id ,
	  inventory_location_id ,
       location_maximum_units,
       location_current_units,
       location_available_units,
       location_suggested_units
   INTO l_physical_locator_id,
	l_locator_id,
        x_location_maximum_units,
        x_location_current_units,
        x_location_available_units,
        x_location_suggested_units
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id;
Line: 224

      select
         location_maximum_units,
         location_current_units,
         location_available_units,
         location_suggested_units
       into
         x_location_maximum_units,
         x_location_current_units,
         x_location_available_units,
         x_location_suggested_units
       from mtl_item_locations
       where organization_id 		= p_organization_id
         and inventory_location_id 	= l_inventory_location_id;
Line: 303

   /* Select all required values at same time
   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id; */
Line: 311

   SELECT physical_location_id ,
        inventory_location_id,
        location_weight_uom_code,
        max_weight,
        current_weight,
        suggested_weight,
        available_weight
   INTO l_physical_locator_id,
	l_locator_id,
        x_location_weight_uom_code,
        x_max_weight,
        x_current_weight,
        x_suggested_weight,
        x_available_weight
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id;
Line: 330

      select
         location_weight_uom_code,
         max_weight,
         current_weight,
         suggested_weight,
         available_weight
      into
         x_location_weight_uom_code,
         x_max_weight,
         x_current_weight,
         x_suggested_weight,
         x_available_weight
       from mtl_item_locations
       where organization_id 		= p_organization_id
         and   inventory_location_id 	= l_inventory_location_id;
Line: 410

   /* Select all required values at same time
   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id; */
Line: 419

   SELECT physical_location_id ,
      inventory_location_id,
       volume_uom_code,
       max_cubic_area,
       current_cubic_area,
       suggested_cubic_area,
       available_cubic_area
   INTO l_physical_locator_id,
	l_locator_id,
        x_volume_uom_code,
        x_max_cubic_area,
        x_current_cubic_area,
        x_suggested_cubic_area,
        x_available_cubic_area
    FROM mtl_item_locations
    WHERE organization_id 		= p_organization_id
       and   inventory_location_id 	= p_inventory_location_id;
Line: 438

    select
       volume_uom_code,
       max_cubic_area,
       current_cubic_area,
       suggested_cubic_area,
       available_cubic_area
     into
       x_volume_uom_code,
       x_max_cubic_area,
       x_current_cubic_area,
       x_suggested_cubic_area,
       x_available_cubic_area
     from mtl_item_locations
     where organization_id 		= p_organization_id
       and   inventory_location_id 	= l_physical_locator_id;
Line: 494

PROCEDURE update_loc_curr_capacity_nauto
  ( x_return_status             OUT NOCOPY VARCHAR2, -- return status (success/error/unexpected_error)
    x_msg_count                 OUT NOCOPY NUMBER,   -- number of messages in the message queue
    x_msg_data                  OUT NOCOPY VARCHAR2, -- message text when x_msg_count>0
    p_organization_id           IN  NUMBER,   -- org of locator whose capacity is to be determined
    p_inventory_location_id     IN  NUMBER,   -- identifier of locator
    p_inventory_item_id         IN  NUMBER,   -- identifier of item
    p_primary_uom_flag          IN  VARCHAR2, -- 'Y' - transaction was in item's primary UOM
					      -- 'N' - transaction was NOT in item's primary UOM
					      --       or the information is not known
    p_transaction_uom_code      IN  VARCHAR2, -- UOM of the transacted material that causes the
					      -- locator capacity to get updated
    p_quantity                  IN  NUMBER,   -- transaction quantity in p_transaction_uom_code
    p_issue_flag                IN  VARCHAR2  -- 'Y' - Issue transaction
					      -- 'N' - Receipt transaction
  )
  IS
     -- item attributes
     l_item_primary_uom_code     varchar2(3);
Line: 543

     l_update_units		 boolean := TRUE;  -- always update units
Line: 544

     l_update_weight		 boolean := FALSE; -- only update if have location and item UOMs
Line: 545

     l_update_volume		 boolean := FALSE; -- only update if have location and item UOMs
Line: 560

       mdebug('In update_loc_curr_capacity_nauto');
Line: 569

   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id;
Line: 584

   ############# If the locator capacity is infinite, then dont update anything, simply return#############
   */
   SELECT location_maximum_units, max_weight, max_cubic_area
   INTO l_max_units, l_max_weight, l_max_cubic_area
   FROM mtl_item_locations_kfv
   WHERE organization_id        = p_organization_id
     AND inventory_location_id  = l_inventory_location_id;
Line: 598

      mdebug('Before locking locator ' || l_inventory_location_id || ' in update_loc_curr_capacity_nauto');
Line: 601

   SELECT inventory_location_id INTO l_inventory_location_id
   FROM mtl_item_locations
   WHERE  inventory_location_id = l_inventory_location_id
       and organization_id = p_organization_id
   FOR UPDATE NOWAIT;
Line: 608

      mdebug('After locking locator ' || l_inventory_location_id || ' in update_loc_curr_capacity_nauto');
Line: 616

   select
     primary_uom_code,
     weight_uom_code,
     unit_weight,
     volume_uom_code,
     unit_volume
   into
     l_item_primary_uom_code,
     l_item_weight_uom_code,
     l_item_unit_weight,
     l_item_volume_uom_code,
     l_item_unit_volume
   from mtl_system_items
   where organization_id 	= p_organization_id
   and   inventory_item_id 	= p_inventory_item_id;
Line: 632

   select
     location_maximum_units,
     location_current_units,
     location_suggested_units,
     location_available_units,
     location_weight_uom_code,
     max_weight,
     current_weight,
     suggested_weight,
     available_weight,
     volume_uom_code,
     max_cubic_area,
     current_cubic_area,
     suggested_cubic_area,
     available_cubic_area
   into
     l_max_units,
     l_current_units,
     l_suggested_units,
     l_available_units,
     l_location_weight_uom_code,
     l_max_weight,
     l_current_weight,
     l_suggested_weight,
     l_available_weight,
     l_volume_uom_code,
     l_max_cubic_area,
     l_current_cubic_area,
     l_suggested_cubic_area,
     l_available_cubic_area
     from mtl_item_locations
     where organization_id 	= p_organization_id
     and   inventory_location_id 	= l_inventory_location_id;
Line: 667

      mdebug('After select: p_organization_id: '|| p_organization_id);
Line: 668

      mdebug('After select: p_inventory_item_id: '|| p_inventory_item_id);
Line: 669

      mdebug('After select: p_inventory_location_id: '|| l_inventory_location_id);
Line: 670

      mdebug('After select: l_current_units: '|| l_current_units);
Line: 671

      mdebug('After select: l_max_units: '|| l_max_units);
Line: 718

	l_update_weight := TRUE;
Line: 743

	l_update_volume := TRUE;
Line: 747

  IF (l_update_weight) then
     -- check that current_weight and suggested weight are not null or < 0
     -- if current_weight is null, drive current_weight to zero
     IF (l_current_weight IS NULL) OR (l_current_weight < 0) then
	l_current_weight := 0;
Line: 767

	   -- update available weight, and make sure that it is > 0
	   l_upd_loc_available_weight := l_max_weight
	     - (l_upd_loc_current_weight + l_suggested_weight);
Line: 777

	-- update current weight
	l_upd_loc_current_weight := l_current_weight - l_loc_uom_xacted_weight;
Line: 779

	 -- update current_ weight, and make sure that it is > 0
	IF (l_upd_loc_current_weight < 0) THEN
	   l_upd_loc_current_weight := 0;
Line: 788

	   -- update available weight, and make sure that it is > 0
	   l_upd_loc_available_weight := l_max_weight
	     -  (l_upd_loc_current_weight + l_suggested_weight);
Line: 808

  IF (l_update_volume) then
     -- check that current_volume and suggested volume are not null or < 0
     -- if current_volume is null, drive current_volume to zero
     IF (l_current_cubic_area IS NULL) OR (l_current_cubic_area < 0) then
	l_current_cubic_area := 0;
Line: 827

	   -- update available volume, and make sure that it is > 0
	   l_upd_loc_available_volume := l_max_cubic_area
	     - (l_upd_loc_current_volume + l_suggested_cubic_area);
Line: 837

	-- update current volume
	l_upd_loc_current_volume := l_current_cubic_area - l_loc_uom_xacted_volume;
Line: 839

	-- update current_volume, and make sure that it is > 0
	IF (l_upd_loc_current_volume < 0) THEN
	   l_upd_loc_current_volume := 0;
Line: 848

	   -- update available volume, and make sure that it is > 0
	   l_upd_loc_available_volume := l_max_cubic_area
	     - (l_upd_loc_current_volume + l_suggested_cubic_area);
Line: 867

  IF (l_update_units) then
     -- check that current_units and suggested units are not null or < 0
     -- if current_units is null, drive current_units to zero
     IF (l_current_units IS NULL) OR (l_current_units < 0) then
	l_current_units := 0;
Line: 888

	   -- update available units, and make sure that it is > 0
	   l_upd_loc_available_units := l_max_units
	     - (l_upd_loc_current_units + l_suggested_units);
Line: 897

	-- update current units
	l_upd_loc_current_units := l_current_units - l_primary_quantity;
Line: 899

	-- update current_units, and make sure that it is > 0
	IF (l_upd_loc_current_units < 0) THEN
	   l_upd_loc_current_units := 0;
Line: 908

	   -- update available units, and make sure that it is > 0
	   l_upd_loc_available_units := l_max_units
	     -  (l_upd_loc_current_units + l_suggested_units);
Line: 929

  IF (l_update_weight) OR (l_update_volume) OR (l_update_units) THEN
     UPDATE mtl_item_locations
       SET
       location_current_units 	        = l_upd_loc_current_units,
       location_available_units 	= l_upd_loc_available_units,
       current_weight             	= l_upd_loc_current_weight,
       available_weight		        = l_upd_loc_available_weight,
       current_cubic_area		= l_upd_loc_current_volume,
       available_cubic_area 		= l_upd_loc_available_volume
       where   inventory_location_id = l_inventory_location_id
       and     organization_id           = p_organization_id;
Line: 971

	      , 'update_loc_curr_capacity_nauto'
	      );
Line: 978

END update_loc_curr_capacity_nauto;
Line: 983

PROCEDURE update_loc_current_capacity
  ( x_return_status             OUT NOCOPY VARCHAR2, -- return status (success/error/unexpected_error)
    x_msg_count                 OUT NOCOPY NUMBER,   -- number of messages in the message queue
    x_msg_data                  OUT NOCOPY VARCHAR2, -- message text when x_msg_count>0
    p_organization_id           IN  NUMBER,   -- org of locator whose capacity is to be determined
    p_inventory_location_id     IN  NUMBER,   -- identifier of locator
    p_inventory_item_id         IN  NUMBER,   -- identifier of item
    p_primary_uom_flag          IN  VARCHAR2, -- 'Y' - transaction was in item's primary UOM
					      -- 'N' - transaction was NOT in item's primary UOM
					      --       or the information is not known
    p_transaction_uom_code      IN  VARCHAR2, -- UOM of the transacted material that causes the
					      -- locator capacity to get updated
    p_quantity                  IN  NUMBER,   -- transaction quantity in p_transaction_uom_code
    p_issue_flag                IN  VARCHAR2  -- 'Y' - Issue transaction
					      -- 'N' - Receipt transaction
  )
IS
     -- this whole function is an autonomous commit
     PRAGMA autonomous_transaction;
Line: 1013

  inv_loc_wms_utils.update_loc_curr_capacity_nauto
  ( x_return_status             => l_return_status,
    x_msg_count                 => x_msg_count,
    x_msg_data                  => x_msg_data,
    p_organization_id           => p_organization_id,
    p_inventory_location_id     => p_inventory_location_id,
    p_inventory_item_id         => p_inventory_item_id,
    p_primary_uom_flag          => p_primary_uom_flag,
    p_transaction_uom_code      => p_transaction_uom_code,
    p_quantity                  => p_quantity,
    p_issue_flag                => p_issue_flag);
Line: 1064

	      , 'update_loc_current_capacity'
	      );
Line: 1071

END update_loc_current_capacity;
Line: 1078

PROCEDURE update_loc_sugg_cap_wo_empf
  ( x_return_status             OUT NOCOPY VARCHAR2, -- return status (success/error/unexpected_error)
    x_msg_count                 OUT NOCOPY NUMBER,   -- number of messages in the message queue
    x_msg_data                  OUT NOCOPY VARCHAR2, -- message text when x_msg_count>0
    p_organization_id           IN  NUMBER,   -- org of locator whose capacity is to be determined
    p_inventory_location_id     IN  NUMBER,   -- identifier of locator
    p_inventory_item_id         IN  NUMBER,   -- identifier of item
    p_primary_uom_flag          IN  VARCHAR2, -- 'Y' - transaction was in item's primary UOM
					      -- 'N' - transaction was NOT in item's primary UOM
					      --       or the information is not known
    p_transaction_uom_code      IN  VARCHAR2, -- UOM of the transacted material that causes the
					      -- locator capacity to get updated
    p_quantity                  IN  NUMBER   -- transaction quantity in p_transaction_uom_code

  )
IS
     -- this whole function is an autonomous commit
     PRAGMA autonomous_transaction;
Line: 1106

  inv_loc_wms_utils.update_loc_sugg_capacity_nauto
  ( x_return_status             => l_return_status,
    x_msg_count                 => x_msg_count,
    x_msg_data                  => x_msg_data,
    p_organization_id           => p_organization_id,
    p_inventory_location_id     => p_inventory_location_id,
    p_inventory_item_id         => p_inventory_item_id,
    p_primary_uom_flag          => p_primary_uom_flag,
    p_transaction_uom_code      => p_transaction_uom_code,
    p_quantity                  => p_quantity
  );
Line: 1157

	      , 'update_loc_suggested_capacity'
	      );
Line: 1164

END update_loc_sugg_cap_wo_empf;
Line: 1171

PROCEDURE update_loc_sugg_capacity_nauto
  ( x_return_status             OUT NOCOPY VARCHAR2, -- return status (success/error/unexpected_error)
    x_msg_count                 OUT NOCOPY NUMBER,   -- number of messages in the message queue
    x_msg_data                  OUT NOCOPY VARCHAR2, -- message text when x_msg_count>0
    p_organization_id           IN  NUMBER,   -- org of locator whose capacity is to be determined
    p_inventory_location_id     IN  NUMBER,   -- identifier of locator
    p_inventory_item_id         IN  NUMBER,   -- identifier of item
    p_primary_uom_flag          IN  VARCHAR2, -- 'Y' - transaction was in item's primary UOM
					      -- 'N' - transaction was NOT in item's primary UOM
					      --       or the information is not known
    p_transaction_uom_code      IN  VARCHAR2, -- UOM of the transacted material that causes the
					      -- locator capacity to get updated
    p_quantity                  IN  NUMBER   -- transaction quantity in p_transaction_uom_code

  )
  IS
     -- item attributes
     l_item_primary_uom_code     varchar2(3);
Line: 1219

     l_update_units		 boolean := TRUE;  -- always update units
Line: 1220

     l_update_weight		 boolean := FALSE; -- only update if have location and item UOMs
Line: 1221

     l_update_volume		 boolean := FALSE; -- only update if have location and item UOMs
Line: 1237

      mdebug('In update_loc_sugg_capacity_nauto');
Line: 1246

   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id;
Line: 1261

   ############# If the locator capacity is infinite, then dont update anything, simply return#############
   */
   SELECT location_maximum_units, max_weight, max_cubic_area
   INTO l_max_units, l_max_weight, l_max_cubic_area
   FROM mtl_item_locations_kfv
   WHERE organization_id        = p_organization_id
     AND inventory_location_id  = l_inventory_location_id;
Line: 1275

      mdebug('Before locking locator ' || l_inventory_location_id || ' in update_loc_sugg_capacity_nauto');
Line: 1278

   SELECT inventory_location_id INTO l_inventory_location_id
   FROM mtl_item_locations
   WHERE  inventory_location_id = l_inventory_location_id
       and organization_id = p_organization_id
   FOR UPDATE NOWAIT;
Line: 1285

      mdebug('After locking locator ' || l_inventory_location_id || ' in update_loc_sugg_capacity_nauto');
Line: 1292

   select
     primary_uom_code,
     weight_uom_code,
     unit_weight,
     volume_uom_code,
     unit_volume
   into
     l_item_primary_uom_code,
     l_item_weight_uom_code,
     l_item_unit_weight,
     l_item_volume_uom_code,
     l_item_unit_volume
   from mtl_system_items
   where organization_id 	= p_organization_id
   and   inventory_item_id 	= p_inventory_item_id;
Line: 1308

   select
     location_maximum_units,
     location_current_units,
     location_suggested_units,
     location_available_units,
     location_weight_uom_code,
     max_weight,
     current_weight,
     suggested_weight,
     available_weight,
     volume_uom_code,
     max_cubic_area,
     current_cubic_area,
     suggested_cubic_area,
     available_cubic_area
   into
     l_max_units,
     l_current_units,
     l_suggested_units,
     l_available_units,
     l_location_weight_uom_code,
     l_max_weight,
     l_current_weight,
     l_suggested_weight,
     l_available_weight,
     l_volume_uom_code,
     l_max_cubic_area,
     l_current_cubic_area,
     l_suggested_cubic_area,
     l_available_cubic_area
     from mtl_item_locations
     where organization_id 	= p_organization_id
     and   inventory_location_id 	= l_inventory_location_id;
Line: 1343

      mdebug('After select: p_organization_id: '|| p_organization_id);
Line: 1344

      mdebug('After select: p_inventory_item_id: '|| p_inventory_item_id);
Line: 1345

      mdebug('After select: p_inventory_location_id: '|| l_inventory_location_id);
Line: 1346

      mdebug('After select: l_suggested_units: '|| l_suggested_units);
Line: 1347

      mdebug('After select: l_max_units: '|| l_max_units);
Line: 1393

	l_update_weight := TRUE;
Line: 1419

	l_update_volume := TRUE;
Line: 1423

  IF (l_update_weight) then
     -- check that current_weight and suggested weight are not null or < 0
     -- if current_weight is null, drive current_weight to zero
     IF (l_current_weight IS NULL) OR (l_current_weight < 0) then
	l_current_weight := 0;
Line: 1442

	-- update available weight, and make sure that it is > 0
	l_upd_loc_available_weight := l_max_weight
	  - (l_upd_loc_suggested_weight + l_current_weight);
Line: 1456

  IF (l_update_volume) then
     -- check that current_volume and suggested volume are not null or < 0
     -- if current_volume is null, drive current_volume to zero
     IF (l_current_cubic_area IS NULL) OR (l_current_cubic_area < 0) then
	l_current_cubic_area := 0;
Line: 1475

	-- update available volume, and make sure that it is > 0
	l_upd_loc_available_volume := l_max_cubic_area
	  - (l_upd_loc_suggested_volume + l_current_cubic_area);
Line: 1489

  IF (l_update_units) then
    -- check that current_units and suggested units are not null or < 0
     -- if current_units is null, drive current_units to zero
     IF (l_current_units IS NULL) OR (l_current_units < 0) then
	l_current_units := 0;
Line: 1508

	-- update available units, and make sure that it is > 0
	l_upd_loc_available_units := l_max_units
	  - (l_upd_loc_suggested_units + l_current_units);
Line: 1525

  IF (l_update_weight) OR (l_update_volume) OR (l_update_units) THEN
     UPDATE mtl_item_locations
       SET
       location_suggested_units 	= l_upd_loc_suggested_units,
       location_available_units 	= l_upd_loc_available_units,
       suggested_weight             	= l_upd_loc_suggested_weight,
       available_weight		        = l_upd_loc_available_weight,
       suggested_cubic_area		= l_upd_loc_suggested_volume,
       available_cubic_area 		= l_upd_loc_available_volume
       where inventory_location_id = l_inventory_location_id
       and     organization_id           = p_organization_id;
Line: 1567

	      , 'update_loc_sugg_capacity_nauto'
	      );
Line: 1574

END update_loc_sugg_capacity_nauto;
Line: 1579

PROCEDURE update_loc_suggested_capacity
  ( x_return_status             OUT NOCOPY VARCHAR2, -- return status (success/error/unexpected_error)
    x_msg_count                 OUT NOCOPY NUMBER,   -- number of messages in the message queue
    x_msg_data                  OUT NOCOPY VARCHAR2, -- message text when x_msg_count>0
    p_organization_id           IN  NUMBER,   -- org of locator whose capacity is to be determined
    p_inventory_location_id     IN  NUMBER,   -- identifier of locator
    p_inventory_item_id         IN  NUMBER,   -- identifier of item
    p_primary_uom_flag          IN  VARCHAR2, -- 'Y' - transaction was in item's primary UOM
					      -- 'N' - transaction was NOT in item's primary UOM
					      --       or the information is not known
    p_transaction_uom_code      IN  VARCHAR2, -- UOM of the transacted material that causes the
					      -- locator capacity to get updated
    p_quantity                  IN  NUMBER   -- transaction quantity in p_transaction_uom_code

  )
IS
     -- this whole function is an autonomous commit
     PRAGMA autonomous_transaction;
Line: 1607

  inv_loc_wms_utils.update_loc_sugg_capacity_nauto
  ( x_return_status             => l_return_status,
    x_msg_count                 => x_msg_count,
    x_msg_data                  => x_msg_data,
    p_organization_id           => p_organization_id,
    p_inventory_location_id     => p_inventory_location_id,
    p_inventory_item_id         => p_inventory_item_id,
    p_primary_uom_flag          => p_primary_uom_flag,
    p_transaction_uom_code      => p_transaction_uom_code,
    p_quantity                  => p_quantity
  );
Line: 1681

	      , 'update_loc_suggested_capacity'
	      );
Line: 1688

END update_loc_suggested_capacity;
Line: 1704

					      -- locator capacity to get updated
					      -- Note: can be NULL if p_primary_uom_flag = 'Y'
    p_quantity                  IN  NUMBER    -- transaction quantity in p_transaction_uom_code

  )
  IS

     -- item attributes
     l_item_primary_uom_code     varchar2(3);
Line: 1743

     l_update_units		 boolean := TRUE;  -- always update units
Line: 1744

     l_update_weight		 boolean := FALSE; -- only update if have location and item UOMs
Line: 1745

     l_update_volume		 boolean := FALSE; -- only update if have location and item UOMs
Line: 1781

   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_locator_id
   FROM mtl_item_locations
   WHERE  inventory_location_id =p_inventory_location_id
       and organization_id = p_organization_id;
Line: 1796

   ############# If the locator capacity is infinite, then dont update anything, simply return#############
   */
   SELECT location_maximum_units, max_weight, max_cubic_area
   INTO l_max_units, l_max_weight, l_max_cubic_area
   FROM mtl_item_locations_kfv
   WHERE organization_id        = p_organization_id
     AND inventory_location_id  = l_inventory_location_id;
Line: 1817

         SELECT inventory_location_id INTO l_inventory_location_id
         FROM mtl_item_locations
         WHERE  inventory_location_id = l_inventory_location_id
         AND    organization_id = p_organization_id
         FOR UPDATE NOWAIT;
Line: 1853

   select
     primary_uom_code,
     weight_uom_code,
     unit_weight,
     volume_uom_code,
     unit_volume
   into
     l_item_primary_uom_code,
     l_item_weight_uom_code,
     l_item_unit_weight,
     l_item_volume_uom_code,
     l_item_unit_volume
   from mtl_system_items
   where organization_id 	= p_organization_id
   and   inventory_item_id 	= p_inventory_item_id;
Line: 1869

   select
     location_maximum_units,
     location_current_units,
     location_suggested_units,
     location_available_units,
     location_weight_uom_code,
     max_weight,
     current_weight,
     suggested_weight,
     available_weight,
     volume_uom_code,
     max_cubic_area,
     current_cubic_area,
     suggested_cubic_area,
     available_cubic_area
   into
     l_max_units,
     l_current_units,
     l_suggested_units,
     l_available_units,
     l_location_weight_uom_code,
     l_max_weight,
     l_current_weight,
     l_suggested_weight,
     l_available_weight,
     l_volume_uom_code,
     l_max_cubic_area,
     l_current_cubic_area,
     l_suggested_cubic_area,
     l_available_cubic_area
     from mtl_item_locations
     where organization_id 	= p_organization_id
     and   inventory_location_id 	= l_inventory_location_id;
Line: 1943

	l_update_weight := TRUE;
Line: 1969

	l_update_volume := TRUE;
Line: 1973

  IF (l_update_weight) then
     -- check that current_weight and suggested weight are not null or < 0
     -- if current_weight is null, drive current_weight to zero
     IF (l_current_weight IS NULL) OR (l_current_weight < 0) then
	l_current_weight := 0;
Line: 1997

	-- update available weight, and make sure that it is > 0
	l_upd_loc_available_weight := l_max_weight
	  - (l_upd_loc_suggested_weight + l_current_weight);
Line: 2011

  IF (l_update_volume) then
     -- check that current_volume and suggested volume are not null or < 0
     -- if current_volume is null, drive current_volume to zero
     IF (l_current_cubic_area IS NULL) OR (l_current_cubic_area < 0) then
	l_current_cubic_area := 0;
Line: 2035

	-- update available volume, and make sure that it is > 0
	l_upd_loc_available_volume := l_max_cubic_area
	  - (l_upd_loc_suggested_volume + l_current_cubic_area);
Line: 2049

  IF (l_update_units) then
    -- check that current_units and suggested units are not null or < 0
     -- if current_units is null, drive current_units to zero
     IF (l_current_units IS NULL) OR (l_current_units < 0) then
	l_current_units := 0;
Line: 2073

	-- update available units, and make sure that it is > 0
	l_upd_loc_available_units := l_max_units
	  - (l_upd_loc_suggested_units + l_current_units);
Line: 2087

  IF (l_update_weight) OR (l_update_volume) OR (l_update_units) THEN
     UPDATE mtl_item_locations
       SET
       location_suggested_units 	= l_upd_loc_suggested_units,
       location_available_units 	= l_upd_loc_available_units,
       suggested_weight             	= l_upd_loc_suggested_weight,
       available_weight		        = l_upd_loc_available_weight,
       suggested_cubic_area		= l_upd_loc_suggested_volume,
       available_cubic_area 		= l_upd_loc_available_volume
       where inventory_location_id = l_inventory_location_id
       and   organization_id       = p_organization_id;
Line: 2176

					      -- locator capacity to get updated
					      -- Note: can be NULL if p_primary_uom_flag = 'Y'
    p_quantity                  IN  NUMBER    -- transaction quantity in p_transaction_uom_code

  )
  IS
	-- this whole function is an autonomous commit

     PRAGMA autonomous_transaction;
Line: 2211

   SELECT nvl(sum(wlc.primary_quantity),0) /* Bug 5689378 */
     INTO x_quantity
     FROM wms_lpn_contents wlc
        , wms_license_plate_numbers wlpn
    WHERE wlc.parent_lpn_id = wlpn.lpn_id
      AND wlpn.outermost_lpn_id = p_lpn_id;
Line: 2519

     select inventory_location_id,
            subinventory_code,
            location_weight_uom_code,
            volume_uom_code,
            location_maximum_units,
            max_weight,
            max_cubic_area
     from   mtl_item_locations
     where organization_id = p_organization_id
       AND subinventory_code = nvl(p_subinventory,subinventory_code)
       --Bug #3949621 (Changed the query, because for PJM Orgs, Physical Location Id won't be null)
       AND nvl(physical_location_id,inventory_location_id) = nvl(p_locator_id ,nvl(physical_location_id,inventory_location_id) );
Line: 2538

     SELECT
           'MOQ_RECORD'                       record_source,
           moq.inventory_item_id              inventory_item_id,
           moq.primary_transaction_quantity   transaction_quantity,
           moq.containerized_flag             containerized_flag,
           TO_NUMBER(NULL)                    transaction_action_id,
           TO_NUMBER(NULL)                    transfer_lpn_id,
           TO_NUMBER(NULL)                    content_lpn_id,
         --TO_NUMBER(NULL)                    lpn_id,
         --moq.lpn_id                         lpn_id,
           wlpn.outermost_lpn_id              lpn_id,
           TO_NUMBER(NULL)                    transaction_status
     FROM MTL_ONHAND_QUANTITIES_DETAIL  MOQ,
          mtl_item_locations mil,
          wms_license_plate_numbers wlpn
     WHERE moq.locator_id        = mil.inventory_location_id
     AND   mil.organization_id   = moq.organization_id
     AND   mil.subinventory_code = moq.subinventory_code
     AND   nvl(mil.physical_location_id,mil.inventory_location_id) = l_locator_id
     AND   moq.organization_id      = p_organization_id
     AND   moq.subinventory_code    = l_subinventory_code
     AND   moq.locator_id           = l_locator_id --Added to address Bug 4333758
     AND   moq.transaction_quantity > 0
     AND   moq.lpn_id = wlpn.lpn_id(+)

     UNION ALL

     /*
     ** We want all transactions that are pending. And we want all Putaway
     ** suggestions. However, we are dealing with just the Source location/sub
     ** in this side of the UNION.
     */
     SELECT
           'MMTT_SOURCE_LOCATOR_RECORD'          record_source
          , mmtt.inventory_item_id               inventory_item_id
          , mmtt.primary_quantity                transaction_quantity
          , TO_NUMBER(NULL)                      containerized_flag
          , mmtt.transaction_action_id           transaction_action_id
          , mmtt.transfer_lpn_id                 transfer_lpn_id
          , mmtt.content_lpn_id                  content_lpn_id
          , mmtt.lpn_id                          lpn_id
          , transaction_status                   transaction_status
     FROM mtl_material_transactions_temp mmtt,
          mtl_item_locations mil
     WHERE mmtt.locator_id        = mil.inventory_location_id
     AND   mil.organization_id    = mmtt.organization_id
     AND   mil.subinventory_code  = mmtt.subinventory_code
     AND   nvl(mil.physical_location_id,mil.inventory_location_id) = l_locator_id
     AND   mmtt.organization_id   = p_organization_id
     AND   mmtt.subinventory_code = l_subinventory_code
     AND   mmtt.locator_id        = l_locator_id --Added to address Bug 4333758
     AND   mmtt.posting_flag      = 'Y'
     AND ( Nvl(mmtt.transaction_status,0) <> l_allocated_txn_status  OR -- pending txns
              -- only receipt suggested transactions are used
            (Nvl(mmtt.transaction_status,0) = l_allocated_txn_status  AND
                 mmtt.transaction_action_id IN (l_txn_action_int_rcpt , l_txn_action_rcpt ))
          )

     UNION ALL

     /*
     ** We want all pending transactions and suggestions that are sub transfers.
     ** However, we only deal with the destination sub/locator in this side of UNION.
     */
     SELECT
            'MMTT_DESTINATION_LOCATOR_RECORD'    record_source
          , mmtt.inventory_item_id               inventory_item_id
          , mmtt.primary_quantity                transaction_quantity
          , TO_NUMBER(NULL)                      containerized_flag
          , mmtt.transaction_action_id           transaction_action_id
          , mmtt.transfer_lpn_id                 transfer_lpn_id
          , mmtt.content_lpn_id                  content_lpn_id
          , mmtt.lpn_id                          lpn_id
          , transaction_status                   transaction_status
     FROM mtl_material_transactions_temp mmtt,
          mtl_item_locations mil
     WHERE mmtt.transfer_to_location = mil.inventory_location_id
     AND   mil.organization_id       = mmtt.organization_id
     AND   mil.subinventory_code     = mmtt.transfer_subinventory--bug 6110275 for destination locator
     AND   nvl(mil.physical_location_id,mil.inventory_location_id) = l_locator_id
     AND   mmtt.organization_id         = p_organization_id
     AND   mmtt.transfer_subinventory   = l_subinventory_code
     AND   mmtt.transfer_to_location    = l_locator_id --Added to address Bug 4333758
     AND   mmtt.posting_flag            = 'Y'
     AND   mmtt.transaction_action_id IN (l_txn_action_subxfer , l_txn_action_orgxfer, l_txn_action_stgxfer );
Line: 2653

        t_locator.delete;
Line: 2654

        t_subinventory_code.delete;
Line: 2655

        t_location_weight_uom_code.delete;
Line: 2656

        t_volume_uom_code.delete;
Line: 2657

        t_location_maximum_units.delete;
Line: 2658

        t_max_weight.delete;
Line: 2659

        t_max_cubic_area.delete;
Line: 2661

        t_location_current_units.delete;
Line: 2662

        t_location_suggested_units.delete;
Line: 2663

        t_location_available_units.delete;
Line: 2664

        t_current_weight.delete;
Line: 2665

        t_suggested_weight.delete;
Line: 2666

        t_available_weight.delete;
Line: 2667

        t_current_cubic_area.delete;
Line: 2668

        t_suggested_cubic_area.delete;
Line: 2669

        t_available_cubic_area.delete;
Line: 2670

        t_inventory_item_id.delete;
Line: 2671

        t_empty_flag.delete;
Line: 2672

        t_mixed_items_flag.delete;
Line: 2705

           t_item_units.delete;
Line: 2738

                        select
                          inventory_item_id
                        , primary_uom_code
                        , weight_uom_code
                        , unit_weight
                        , volume_uom_code
                        , unit_volume
                        into
                          t_item_info(l_inventory_item_id).inventory_item_id
                        , t_item_info(l_inventory_item_id).item_primary_uom_code
                        , t_item_info(l_inventory_item_id).item_weight_uom_code
                        , t_item_info(l_inventory_item_id).item_unit_weight
                        , t_item_info(l_inventory_item_id).item_volume_uom_code
                        , t_item_info(l_inventory_item_id).item_unit_volume
                        from mtl_system_items
                        where organization_id        = p_organization_id
                        and   inventory_item_id      = l_inventory_item_id;
Line: 3334

                update mtl_item_locations
                set
                  location_current_units   = t_location_current_units(i)
                , location_suggested_units = t_location_suggested_units(i)
                , location_available_units = t_location_available_units(i)
                , current_weight           = t_current_weight(i)
                , suggested_weight         = t_suggested_weight(i)
                , available_weight         = t_available_weight(i)
                , current_cubic_area       = t_current_cubic_area(i)
                , suggested_cubic_area     = t_suggested_cubic_area(i)
                , available_cubic_area     = t_available_cubic_area(i)
                , inventory_item_id        = t_inventory_item_id(i)
                , empty_flag               = t_empty_flag(i)
                , mixed_items_flag         = t_mixed_items_flag(i)
	       , last_update_date     = sysdate                                                       /* Added for Bug 6363028 */
                where organization_id        = p_organization_id
                and   inventory_location_id  = t_locator(i);
Line: 3544

   SELECT   physical_location_id
	     ,   inventory_location_id
     INTO   l_physical_locator_id
	     ,   l_loc_id
     FROM   mtl_item_locations
    WHERE   inventory_location_id = p_inventory_location_id
      AND   organization_id = p_organization_id;
Line: 3590

   SELECT location_weight_uom_code
        , max_weight
        , suggested_weight
        , suggested_cubic_area
        , current_weight
        , available_weight
        , volume_uom_code
        , max_cubic_area
        , current_cubic_area
        , available_cubic_area
        , location_maximum_units
        , location_current_units
        , location_available_units
        , location_suggested_units
     INTO l_locator_weight_uom_code
        , l_locator_max_weight
        , l_locator_suggested_weight
        , l_locator_suggested_cubic_area
        , l_locator_current_weight
        , l_locator_available_weight
        , l_locator_volume_uom_code
        , l_locator_max_cubic_area
        , l_locator_current_cubic_area
        , l_locator_available_cubic_area
        , l_locator_maximum_units
        , l_locator_current_units
        , l_locator_available_units
        , l_locator_suggested_units
     FROM MTL_ITEM_LOCATIONS
    WHERE organization_id = p_organization_id
	   AND inventory_location_id = p_inventory_location_id;
Line: 4408

   UPDATE MTL_ITEM_LOCATIONS mil
      SET current_weight           = nvl(l_locator_current_weight,current_weight)
        , available_weight         = nvl(l_locator_available_weight,available_weight)
        , current_cubic_area       = nvl(l_locator_current_cubic_area,current_cubic_area)
        , available_cubic_area     = nvl(l_locator_available_cubic_area,available_cubic_area)
        , location_current_units   = nvl(l_locator_current_units,location_current_units)
        , location_available_units = nvl(l_locator_available_units,mil.location_available_units)
    WHERE inventory_location_id    = p_inventory_location_id
      AND organization_id          = p_organization_id;
Line: 4419

      mdebug(l_proc_name||'Locator Current Weight after update      : '||l_locator_current_weight);
Line: 4420

      mdebug(l_proc_name||'Locator Available Weight after update    : '||l_locator_available_weight);
Line: 4421

      mdebug(l_proc_name||'Locator Current Cubic Area after update  : '||l_locator_current_cubic_area);
Line: 4422

      mdebug(l_proc_name||'Locator Available Cubic Area after update: '||l_locator_available_cubic_area);
Line: 4423

      mdebug(l_proc_name||'Locator Current Units after update       : '||l_locator_current_units);
Line: 4424

      mdebug(l_proc_name||'Locator Available Units after update     : '||l_locator_available_units);
Line: 4516

  UPDATE MTL_ITEM_LOCATIONS
     SET current_weight           = nvl(l_locator_current_weight,current_weight)
       , available_weight         = nvl(l_locator_available_weight,available_weight)
       , current_cubic_area       = nvl(l_locator_current_cubic_area,current_cubic_area)
       , available_cubic_area     = nvl(l_locator_available_cubic_area,available_cubic_area)
       , location_current_units   = nvl(l_locator_current_units,location_current_units)
       , location_available_units = nvl(l_locator_available_units,location_available_units)
   WHERE inventory_location_id    = p_inventory_location_id
     AND organization_id          = p_organization_id;
Line: 4527

     mdebug(l_proc_name||'Locator Current Weight after update      : '||l_locator_current_weight);
Line: 4528

     mdebug(l_proc_name||'Locator Available Weight after update    : '||l_locator_available_weight);
Line: 4529

     mdebug(l_proc_name||'Locator Current Cubic Area after update  : '||l_locator_current_cubic_area);
Line: 4530

     mdebug(l_proc_name||'Locator Available Cubic Area after update: '||l_locator_available_cubic_area);
Line: 4531

     mdebug(l_proc_name||'Locator Current Units after update       : '||l_locator_current_units);
Line: 4532

     mdebug(l_proc_name||'Locator Available Units after update     : '||l_locator_available_units);
Line: 4585

   l_update_table                         BOOLEAN := TRUE;
Line: 4612

   SELECT inventory_location_id INTO l_old_inventory_location_id
   FROM mtl_item_locations
   WHERE  inventory_location_id = l_old_inventory_location_id
       and organization_id = l_old_organization_id
   FOR UPDATE NOWAIT;
Line: 4772

      First Update the Source Locator's Capacity.
        * If content lpn is passed  => Issue the lpn from the source locator.
        * If lpn id is passed       => check whether the whole lpn is being transfered or not. if so, need to
                                       decrement the container weight and volume, else decrement the transacted
                                       items weight and volume.
      Then Update the destination Locator's capacity.
        * If content lpn is passesd  => receive into it.
        * If transfer lpn is passed  => receive into it.
        * else                       => receive loose
      -------------------------------------------------------------------------------------------------------*/
/* Do update the locator capacity only if the locator capacity is finite */
  IF NOT (l_old_loc_attr.l_locator_maximum_units IS NULL AND l_old_loc_attr.l_locator_max_weight IS NULL AND l_old_loc_attr.l_locator_max_cubic_area IS NULL) THEN

    IF p_content_lpn_id IS NOT NULL THEN
       /*-----------------------------------------------------------------
         Issue Content LPN from the source locator
         -----------------------------------------------------------------*/
       upd_lpn_loc_cpty_for_issue(
            x_return_status                   =>        x_return_status
          , x_msg_data                        =>        x_msg_data
          , x_msg_count                       =>        x_msg_count
          , p_loc_attr                        =>        l_old_loc_attr
          , p_content_lpn_id                  =>        p_content_lpn_id
          , p_cnt_lpn_attr                    =>        l_cnt_lpn_attr
          , p_transaction_action_id           =>        1
          , p_item_attr                       =>        p_item_attr
          , p_quantity                        =>        l_quantity
          , p_inventory_location_id           =>        l_old_inventory_location_id
          , p_organization_id                 =>        l_old_organization_id
          );
Line: 4807

       l_update_table := FALSE;
Line: 4835

             l_update_table := FALSE;
Line: 4926

  IF l_update_table THEN
     UPDATE MTL_ITEM_LOCATIONS
        SET current_weight           = nvl(l_old_loc_current_weight,current_weight)
          , available_weight         = nvl(l_old_loc_available_weight,available_weight)
          , current_cubic_area       = nvl(l_old_loc_current_vol,current_cubic_area)
          , available_cubic_area     = nvl(l_old_loc_available_vol,available_cubic_area)
          , location_current_units   = nvl(l_old_loc_current_units,location_current_units)
          , location_available_units = nvl(l_old_loc_available_units,location_available_units)
      WHERE inventory_location_id    = l_old_inventory_location_id
        AND organization_id          = l_old_organization_id;
Line: 4937

  END IF; /* Update locator capacity only if the locator capacity is finite */
Line: 4939

/* Do update the locator capacity only if the locator capacity is finite */
 IF NOT (p_loc_attr.l_locator_maximum_units IS NULL AND p_loc_attr.l_locator_max_weight IS NULL AND p_loc_attr.l_locator_max_cubic_area IS NULL) THEN

    IF p_trn_lpn_id IS NOT NULL THEN
       /*-----------------------------------------------------------------
         Receive the transfer LPN into the destination Locator.
         -----------------------------------------------------------------*/
       upd_lpn_loc_cpty_for_rcpt (
            x_return_status                   =>        x_return_status
          , x_msg_data                        =>        x_msg_data
          , x_msg_count                       =>        x_msg_count
          , p_loc_attr                        =>        p_loc_attr
          , p_transfer_lpn_id                 =>        p_trn_lpn_id
          , p_trn_lpn_attr                    =>        p_trn_lpn_attr
          , p_transaction_action_id           =>        27
          , p_item_attr                       =>        p_item_attr
          , p_quantity                        =>        p_quantity
          , p_inventory_location_id           =>        p_inventory_location_id
          , p_organization_id                 =>        p_organization_id
          );
Line: 5025

       UPDATE MTL_ITEM_LOCATIONS
          SET current_weight           = nvl(l_loc_current_weight,current_weight)
            , available_weight         = nvl(l_loc_available_weight,available_weight)
            , current_cubic_area       = nvl(l_loc_current_vol,current_cubic_area)
            , available_cubic_area     = nvl(l_loc_available_vol,available_cubic_area)
            , location_current_units   = nvl(l_loc_current_units,location_current_units)
            , location_available_units = nvl(l_loc_available_units,location_available_units)
        WHERE inventory_location_id    = p_inventory_location_id
          AND organization_id          = p_organization_id;
Line: 5035

   END IF; /* Update locator capacity only if the locator capacity is finite */
Line: 5146

    UPDATE MTL_ITEM_LOCATIONS
       SET current_cubic_area    = nvl(l_locator_current_cubic_area,current_cubic_area)
         , available_cubic_area  = nvl(l_locator_available_cubic_area,available_cubic_area)
         , current_weight        = nvl(l_locator_current_weight,current_weight)
         , available_weight      = nvl(l_locator_available_weight,available_weight)
     WHERE inventory_location_id = p_inventory_location_id
       AND organization_id       = p_organization_id;
Line: 5155

       mdebug(l_proc_name||'Locator Current Cubic Area after update  : '||l_locator_current_cubic_area);
Line: 5156

       mdebug(l_proc_name||'Locator Available Cubic Area after update: '||l_locator_available_cubic_area);
Line: 5157

       mdebug(l_proc_name||'Locator Current weight after update      : '||l_locator_current_weight);
Line: 5158

       mdebug(l_proc_name||'Locator Available weight after update    : '||l_locator_available_weight);
Line: 5319

    UPDATE MTL_ITEM_LOCATIONS
       SET current_cubic_area    = nvl(l_locator_current_cubic_area,current_cubic_area)
         , available_cubic_area  = nvl(l_locator_available_cubic_area,available_cubic_area)
         , current_weight        = nvl(l_locator_current_weight,current_weight)
         , available_weight      = nvl(l_locator_available_weight,available_weight)
     WHERE inventory_location_id = p_inventory_location_id
       AND organization_id       = p_organization_id;
Line: 5328

       mdebug(l_proc_name||'Locator Current Cubic Area after update  : '||l_locator_current_cubic_area);
Line: 5329

       mdebug(l_proc_name||'Locator Available Cubic Area after update: '||l_locator_available_cubic_area);
Line: 5330

       mdebug(l_proc_name||'Locator Current Weight After update      : '||l_locator_current_weight);
Line: 5331

       mdebug(l_proc_name||'Locator Available Weight after update    : '||l_locator_available_weight);
Line: 5348

	    			                                        -- locator capacity to get updated
    ,p_transaction_action_id     IN         NUMBER     -- transaction action id for pack,unpack,issue,receive,
 					                                        -- transfer
    ,p_lpn_id                    IN         NUMBER     -- lpn id
    ,p_transfer_lpn_id		      IN         NUMBER     -- transfer_lpn_id
    ,p_content_lpn_id	         IN         NUMBER     -- content_lpn_id
    ,p_quantity                  IN         NUMBER     -- Primary quantity in primary UOM.
    ,p_container_item_id         IN         NUMBER     DEFAULT NULL
    ,p_cartonization_id          IN         NUMBER     DEFAULT NULL
    ,p_from_org_id               IN         NUMBER     DEFAULT NULL
    ,p_from_loc_id               IN         NUMBER     DEFAULT NULL
  )
IS
     l_inventory_location_id           NUMBER;
Line: 5398

      ############# If the locator capacity is infinite, then dont update anything, simply return#############
      */
      SELECT location_maximum_units, max_weight, max_cubic_area
      INTO l_max_units, l_max_weight, l_max_cubic_area
      FROM mtl_item_locations_kfv
      WHERE organization_id        = p_organization_id
        AND inventory_location_id  = l_inventory_location_id;
Line: 5415

             SELECT location_maximum_units, max_weight, max_cubic_area
              INTO l_max_units, l_max_weight, l_max_cubic_area
              FROM mtl_item_locations_kfv
              WHERE organization_id         = p_from_org_id
                AND inventory_location_id         = l_from_inventory_location_id;
Line: 5432

   SELECT inventory_location_id INTO l_inventory_location_id
   FROM mtl_item_locations
   WHERE  inventory_location_id = l_inventory_location_id
       and organization_id = p_organization_id
   FOR UPDATE NOWAIT;
Line: 5848

PROCEDURE update_lpn_loc_curr_capacity
  ( x_return_status             OUT NOCOPY VARCHAR2, -- return status (success/error/unexpected_error)
    x_msg_count                 OUT NOCOPY NUMBER,   -- number of messages in the message queue
    x_msg_data                  OUT NOCOPY VARCHAR2, -- message text when x_msg_count>0
    p_organization_id           IN         NUMBER,   -- org of locator whose capacity is to be determined
    p_inventory_location_id     IN         NUMBER,   -- identifier of locator
    p_inventory_item_id         IN         NUMBER,   -- identifier of item
    p_primary_uom_FLAG          IN         VARCHAR2, -- iF Y primary UOM
    p_transaction_uom_code      IN         VARCHAR2, -- UOM of the transacted material that causes the
					                                      -- locator capacity to get updated
    p_transaction_action_id	  IN         NUMBER,   -- transaction action id for pack,unpack,issue,receive,
					                                      -- transfer
    p_lpn_id                    IN         NUMBER,   -- lpn id
    p_transfer_lpn_id	        IN         NUMBER,   -- transfer_lpn_id
    p_content_lpn_id		        IN         NUMBER,   -- content_lpn_id
    p_quantity                  IN         NUMBER,   -- transaction quantity in p_transaction_uom_code
    p_container_item_id         IN         NUMBER DEFAULT NULL,
    p_cartonization_id          IN         NUMBER DEFAULT NULL,
    p_from_org_id               IN         NUMBER DEFAULT NULL,
    p_from_loc_id               IN         NUMBER DEFAULT NULL
  )
IS
PRAGMA autonomous_transaction;
Line: 5934

	      , 'update_lpn_loc_curr_capacity'
	      );
Line: 6305

	 SELECT GROSS_WEIGHT_UOM_CODE,
		CONTENT_VOLUME_UOM_CODE,
		GROSS_WEIGHT,
		CONTENT_VOLUME,
		LOCATOR_ID,
		SUBINVENTORY_CODE,
		INVENTORY_ITEM_ID
	  INTO  l_gross_weight_uom_code,
		l_content_volume_uom_code,
		l_gross_weight,
		l_content_volume,
		l_locator_id,
		l_subinventory_code,
		l_container_item_id
	   FROM wms_license_plate_numbers
	   WHERE lpn_id = p_lpn_id;
Line: 6327

   	   INV_TRX_UTIL_PUB.TRACE('The p_lpn_id  '||to_char(p_lpn_id),'LPN-ATTRIBUTE-UPDATE_LPN_LOC',9);
Line: 6336

		   ,'LPN-ATTRIBUTE-UPDATE_LPN_LOC',9
		  );
Line: 6361

   		 INV_TRX_UTIL_PUB.TRACE('Error fetching container item attributes - '||l_return_status , 'LPN-ATTRIBUTE-UPDATE_LPN_LOC',4);
Line: 6366

   		 INV_TRX_UTIL_PUB.TRACE('Error fetching container item attributes - '||l_return_status , 'LPN-ATTRIBUTE-UPDATE_LPN_LOC',4);
Line: 6378

   		 INV_TRX_UTIL_PUB.TRACE('Gross_weight_uom_weight code different from container item weight uom code', 'LPN-ATTRIBUTE-UPDATE_LPN_LOC',4);
Line: 6397

   		 INV_TRX_UTIL_PUB.TRACE('l_container_item_xacted_weight is '||to_char(l_container_item_xacted_weight), 'LPN-ATTRIBUTE-UPDATE_LPN_LOC',4);
Line: 6419

   		 INV_TRX_UTIL_PUB.TRACE('l_container_item_xacted_volume is '||to_char(l_container_item_xacted_volume), 'LPN-ATTRIBUTE-UPDATE_LPN_LOC',4);
Line: 6433

		   ,'LPN-ATTRIBUTE-UPDATE_LPN_LOC',4
		  );
Line: 6525

	 SELECT primary_uom_code
		,weight_uom_code
		,unit_weight
		,volume_uom_code
		,unit_volume
	 INTO
	    l_item_primary_uom_code
	   ,l_item_weight_uom_code
	   ,l_item_unit_weight
	   ,l_item_volume_uom_code
	   ,l_item_unit_volume
	 FROM
	    mtl_system_items
	 WHERE
	    inventory_item_id = p_inventory_item_id  and
	    organization_id   = p_organization_id;
Line: 6629

   		  INV_TRX_UTIL_PUB.TRACE('The value of primary_uom_flag  <>y or PUOM is not equal to Transaction UOM', 'UPDATE_LPN_LOC_CURR_CAPACITY',9);
Line: 6869

   SELECT physical_location_id ,
	  inventory_location_id
   INTO l_physical_locator_id,
	l_loc_id
   FROM mtl_item_locations
   WHERE  inventory_location_id = p_inventory_location_id
   and    organization_id       = p_organization_id;
Line: 6888

   SELECT inventory_location_id INTO l_inventory_location_id
   FROM mtl_item_locations
   WHERE  inventory_location_id = l_inventory_location_id
       and organization_id = p_organization_id
   FOR UPDATE NOWAIT;
Line: 6970

	  SELECT physical_location_id ,
		 inventory_location_id
	  INTO l_des_physical_locator_id,
	       l_des_loc_id
	  FROM mtl_item_locations
	  WHERE  inventory_location_id = p_transfer_location_id
	  and    organization_id       = p_transfer_organization;
Line: 6989

	   SELECT inventory_location_id INTO l_des_inventory_location_id
	   FROM mtl_item_locations
	   WHERE  inventory_location_id = l_des_inventory_location_id
	       and organization_id = p_transfer_organization
	   FOR UPDATE NOWAIT;
Line: 7033

          UPDATE MTL_ITEM_LOCATIONS mil
	          SET EMPTY_FLAG            = nvl(l_empty_flag,mil.empty_flag)
	            , MIXED_ITEMS_FLAG      = nvl(l_mixed_flag,mil.mixed_items_flag)
               , INVENTORY_ITEM_ID     = nvl(l_item_id,mil.inventory_item_id)
	       , LAST_UPDATE_DATE     = sysdate                                                       /* Added for Bug 6363028 */
           WHERE INVENTORY_LOCATION_ID = l_des_inventory_location_id
	          AND ORGANIZATION_ID       = P_TRANSFER_ORGANIZATION;
Line: 7082

      UPDATE MTL_ITEM_LOCATIONS MIL
         SET EMPTY_FLAG            = NVL(l_empty_flag,MIL.empty_flag)
           , MIXED_ITEMS_FLAG      = NVL(l_mixed_flag,MIL.mixed_items_flag)
           , INVENTORY_ITEM_ID     = NVL(l_item_id,MIL.inventory_item_id)
           , LAST_UPDATE_DATE     = sysdate                                                       /* Added for Bug 6363028 */
       WHERE INVENTORY_LOCATION_ID = l_inventory_location_id
         AND ORGANIZATION_ID       = P_ORGANIZATION_ID;
Line: 7145

    SELECT inventory_item_id
    FROM MTL_ONHAND_QUANTITIES_DETAIL
    WHERE LOCATOR_ID = p_locator_id
    and   organization_id =p_org_id
    and   inventory_item_id <> p_inventory_item_id
    and   rownum <3
    group by inventory_item_id;
Line: 7175

	   SELECT LOCATION_CURRENT_UNITS,
                  location_suggested_units,
		  mixed_items_flag,
		  inventory_item_id,
		  empty_flag
	   INTO l_loc_current_units ,
                l_loc_suggested_units,
		l_mixed_flag,
		l_inventory_item_id,
		l_empty_flag
	   FROM MTL_ITEM_LOCATIONS
	   WHERE INVENTORY_LOCATION_ID = p_locator_id
	      AND ORGANIZATION_ID      = P_ORG_ID;
Line: 7208

		  SELECT 1
		  INTO l_chk_flag
		  FROM dual
		  WHERE EXISTS (SELECT 1
				FROM MTL_ONHAND_QUANTITIES_DETAIL
				WHERE	LOCATOR_ID        = P_LOCATOR_ID
				   AND	ORGANIZATION_ID	  = P_ORG_ID
				   AND	INVENTORY_ITEM_ID = P_INVENTORY_ITEM_ID
				 );
Line: 7221

		    SELECT 1
		    INTO l_chk_flag
		    FROM dual
		    WHERE EXISTS (SELECT 1
				  FROM  MTL_ONHAND_QUANTITIES_DETAIL
				  WHERE LOCATOR_ID        =  P_LOCATOR_ID
				    AND ORGANIZATION_ID   =  P_ORG_ID
				    AND INVENTORY_ITEM_ID <> P_INVENTORY_ITEM_ID
				  );
Line: 7317

 SELECT subinventory_code
   INTO l_subinventory_code
   FROM mtl_item_locations
   WHERE  inventory_location_id = p_locator_id
   and    organization_id       = p_org_id;
Line: 7324

	 SELECT 1
	 INTO l_chk_flag
	 FROM dual
	 WHERE EXISTS (
                       -- Onhand
		       SELECT 1
		       FROM  MTL_ONHAND_QUANTITIES_DETAIL
		       WHERE LOCATOR_ID     = P_LOCATOR_ID
			AND ORGANIZATION_ID = P_ORG_ID
			AND INVENTORY_ITEM_ID <> P_INVENTORY_ITEM_ID
                        AND SUBINVENTORY_CODE = l_subinventory_code --Added 3237709

                       UNION ALL --Bug 4566485

                       -- Pending/Suggestion receipts
	               SELECT 1
		       FROM  mtl_material_transactions_temp
		       WHERE LOCATOR_ID     = P_LOCATOR_ID
			AND ORGANIZATION_ID = P_ORG_ID
			AND INVENTORY_ITEM_ID <> P_INVENTORY_ITEM_ID
                        AND POSTING_FLAG    = 'Y'
                        AND transaction_action_id IN (12,27)
                        AND SUBINVENTORY_CODE = l_subinventory_code --Added 3237709

                       UNION ALL --Bug 4566485

                       -- Pending/Suggestion receipts on transfer side
	               SELECT 1
		       FROM  mtl_material_transactions_temp
		       WHERE TRANSFER_TO_LOCATION  = P_LOCATOR_ID
			AND ORGANIZATION_ID        = P_ORG_ID
			AND INVENTORY_ITEM_ID <> P_INVENTORY_ITEM_ID
                        AND POSTING_FLAG           = 'Y'
                        AND transaction_action_id IN (2,3,28)
                        AND SUBINVENTORY_CODE = l_subinventory_code --Added 3237709
		       );
Line: 7403

  SELECT MMTT.organization_id,
	 MMTT.inventory_item_id,
	 MMTT.locator_id,
	 MMTT.transfer_organization,
	 MMTT.transfer_to_location,
	 MMTT.transaction_action_id,
	 MMTT.primary_quantity,
	 MMTT.transaction_quantity,
	 MMTT.transfer_lpn_id,
	 MMTT.content_lpn_id,
	 MMTT.lpn_id
   FROM MTL_MATERIAL_TRANSACTIONS_TEMP MMTT,
	MTL_ITEM_LOCATIONS MIL
   WHERE MMTT.transaction_status <> 2
    AND MMTT.organization_id = p_organization_id
    AND MMTT.LOCATOR_ID = MIL.INVENTORY_LOCATION_ID
    AND MIL.MIXED_ITEMS_FLAG ='Y'
    AND MMTT.locator_id >0
    AND (MMTT.transfer_lpn_id is not null or
	 MMTT.content_lpn_id is not null or
	 MMTT.lpn_id is not null
	);
Line: 7427

  SELECT organization_id,
	 inventory_item_id,
	 locator_id,
	 transfer_organization,
	 transfer_to_location,
	transaction_action_id,
	primary_quantity,
	transaction_quantity,
	transfer_lpn_id,
	content_lpn_id,
	lpn_id
   FROM MTL_MATERIAL_TRANSACTIONS_TEMP
   WHERE transaction_status <> 2
    AND organization_id = p_organization_id
    and locator_id >0
    AND (transfer_lpn_id is not null or
	 content_lpn_id is not null or
	 lpn_id is not null
	);
Line: 7769

  SELECT WLPN.locator_id,
  nvl(sum(DECODE(MIL.LOCATION_WEIGHT_UOM_CODE,WLPN.GROSS_WEIGHT_UOM_CODE,
						     WLPN.gross_weight,
					     GREATEST(INV_CONVERT.INV_UM_CONVERT(
							     null
							    ,null
							    ,WLPN.GROSS_WEIGHT
							    ,WLPN.GROSS_WEIGHT_UOM_CODE
							    ,MIL.LOCATION_WEIGHT_UOM_CODE
							    ,null
							   ,null),0))),0) gross_weight,

	 nvl(sum(DECODE(MIL.VOLUME_UOM_CODE,WLPN.CONTENT_VOLUME_UOM_CODE,
					       WLPN.content_volume,
					      GREATEST(INV_CONVERT.INV_UM_CONVERT(
							     null
							    ,null
							    ,WLPN.CONTENT_VOLUME
							    ,WLPN.CONTENT_VOLUME_UOM_CODE
							    ,MIL.VOLUME_UOM_CODE
							    ,null
							   ,null),0))),0) content_volume
  FROM wms_license_plate_numbers WLPN,
       MTL_ITEM_LOCATIONS MIL
  WHERE MIL.INVENTORY_LOCATION_ID = WLPN.LOCATOR_ID
    AND WLPN.organization_id =p_organization_id
    AND WLPN.lpn_context =1
    AND WLPN.parent_lpn_id is null
    AND WLPN.locator_id  >0
  GROUP by  WLPN.locator_id ;
Line: 7801

  SELECT WLPN.locator_id,
	 nvl(sum(DECODE(MIL.LOCATION_WEIGHT_UOM_CODE,WLPN.GROSS_WEIGHT_UOM_CODE,
						     WLPN.gross_weight,
					     GREATEST(INV_CONVERT.INV_UM_CONVERT(
							     null
							    ,null
							    ,WLPN.GROSS_WEIGHT
							    ,WLPN.GROSS_WEIGHT_UOM_CODE
							    ,MIL.LOCATION_WEIGHT_UOM_CODE
							    ,null
							   ,null),0))),0) gross_weight,

	 nvl(sum(DECODE(MIL.VOLUME_UOM_CODE,WLPN.CONTENT_VOLUME_UOM_CODE,
					       WLPN.content_volume,
					      GREATEST(INV_CONVERT.INV_UM_CONVERT(
							     null
							    ,null
							    ,WLPN.CONTENT_VOLUME
							    ,WLPN.CONTENT_VOLUME_UOM_CODE
							    ,MIL.VOLUME_UOM_CODE
							    ,null
							   ,null),0))),0) content_volume
  FROM wms_license_plate_numbers WLPN,
       MTL_ITEM_LOCATIONS MIL
  WHERE WLPN.LOCATOR_ID =  MIL.INVENTORY_LOCATION_ID
    AND WLPN.organization_id =p_organization_id
    AND WLPN.lpn_context =1
    AND WLPN.parent_lpn_id is null
    AND WLPN.locator_id  >0
    AND MIL.MIXED_ITEMS_FLAG ='Y'
  GROUP by  WLPN.locator_id ;
Line: 7869

	SELECT physical_location_id ,
	       inventory_location_id
	INTO l_physical_locator_id,
	     l_locator_id
	FROM mtl_item_locations
	WHERE  inventory_location_id =l_curr_cpty.locator_id
	    and organization_id = p_organization_id;
Line: 7882

	/* Update current weight and current cubic area of the locator with the
	    LPN's gross weight and content volume
	*/
       IF (l_debug = 1) THEN
          INV_TRX_UTIL_PUB.TRACE('The value of locator _id is '||to_char(l_inventory_location_id), 'LPN_LOC_CURRENT_CAPACITY',10);
Line: 7892

        SELECT sum(abs(primary_transaction_quantity))
        into l_units
        FROM MTL_ONHAND_QUANTITIES_DETAIL
        WHERE locator_id = l_inventory_location_id
          AND containerized_flag = 1
          AND locator_id >0
          AND organization_id =p_organization_id;
Line: 7904

	UPDATE mtl_item_locations
	set current_weight=nvl(current_weight,0)+l_curr_cpty.gross_weight,
	    available_weight = max_weight-(nvl(suggested_weight,0) + nvl(current_weight,0)),
	   current_cubic_area = nvl(current_cubic_area,0) + l_curr_cpty.content_volume,
	   available_cubic_area = max_cubic_area -(nvl(suggested_cubic_area,0)+nvl(current_cubic_area,0)),
           LOCATION_CURRENT_UNITS = nvl(LOCATION_CURRENT_UNITS,0) + l_units,
           LOCATION_AVAILABLE_UNITS = greatest(nvl(LOCATION_MAXIMUM_UNITS,0)-(nvl(LOCATION_SUGGESTED_UNITS,0)+ nvl(LOCATION_CURRENT_UNITS,0)),0)
	where
	     inventory_location_id =l_inventory_location_id
	  and organization_id = p_organization_id;
Line: 7935

	SELECT physical_location_id ,
	       inventory_location_id
	INTO l_physical_locator_id,
	     l_locator_id
	FROM mtl_item_locations
	WHERE  inventory_location_id =l_curr_cpty.locator_id
	    and organization_id = p_organization_id;
Line: 7948

	/* Update current weight and current cubic area of the locator with the
	    LPN gross weight and content volume
	*/
       IF (l_debug = 1) THEN
          INV_TRX_UTIL_PUB.TRACE('The value of locator _id is '||to_char(l_inventory_location_id), 'LPN_LOC_CURRENT_CAPACITY',10);
Line: 7958

        SELECT sum(abs(primary_transaction_quantity))
        into l_units
        FROM MTL_ONHAND_QUANTITIES_DETAIL
        WHERE locator_id = l_inventory_location_id
          AND containerized_flag = 1
          AND locator_id >0
          AND organization_id =p_organization_id;
Line: 7970

	UPDATE mtl_item_locations
	set current_weight=nvl(current_weight,0)+l_curr_cpty.gross_weight,
	    available_weight = max_weight-(nvl(suggested_weight,0) + nvl(current_weight,0)),
	   current_cubic_area = nvl(current_cubic_area,0) + l_curr_cpty.content_volume,
	   available_cubic_area = max_cubic_area -(nvl(suggested_cubic_area,0)+nvl(current_cubic_area,0)),
           LOCATION_CURRENT_UNITS = nvl(LOCATION_CURRENT_UNITS,0) + nvl(l_units,0),
           LOCATION_AVAILABLE_UNITS = greatest(nvl(LOCATION_MAXIMUM_UNITS,0)-(nvl(LOCATION_SUGGESTED_UNITS,0)+ nvl(LOCATION_CURRENT_UNITS,0)),0)
	where
	     inventory_location_id =l_inventory_location_id
	  and organization_id = p_organization_id;
Line: 8077

   SELECT physical_location_id,
     inventory_location_id
     INTO l_physical_locator_id,
     l_locator_id
     FROM mtl_item_locations
     WHERE  inventory_location_id = p_locator_id
     and organization_id = p_org_id;
Line: 8094

      SELECT 1
	INTO l_chk_flag
	FROM dual
	WHERE EXISTS (
		      SELECT 1
		      FROM  rcv_supply rs
		      WHERE rs.to_locator_id    = p_locator_id
		      AND rs.to_organization_id = p_org_id
		      AND rs.to_subinventory    = p_subinventory
		      AND rs.quantity           > 0
		      );
Line: 8113

      SELECT COUNT(DISTINCT item_id)
	INTO l_mixed_num
	FROM rcv_supply rs
	WHERE rs.to_locator_id    = p_locator_id
	AND rs.to_organization_id = p_org_id
	AND rs.to_subinventory    = p_subinventory
	AND rs.quantity           > 0;
Line: 8138

   UPDATE mtl_item_locations mil
     SET empty_flag     = NVL(l_empty_flag,mil.empty_flag)
     , mixed_items_flag = NVL(l_mixed_flag,mil.mixed_items_flag)
     , last_update_date     = sysdate                                                       /* Added for Bug 6363028 */
     WHERE inventory_location_id = l_locator_id
     AND organization_id         = p_org_id;