DBA Data[Home] [Help]

APPS.WMS_DEVICE_CONFIRMATION_PUB SQL Statements

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

Line: 53

   SELECT lot_number,lot_qty,serial_number
     FROM wms_device_requests
     WHERE relation_id = p_relation_id
     AND task_id = p_txn_temp_id
     AND business_event_id IN (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.wms_be_load_confirm)
     AND task_summary = 'N';
Line: 67

   SELECT COUNT(*),SUM(lot_qty) INTO l_count_child_rec,l_total_lot_qty
     FROM wms_device_requests
     WHERE relation_id = p_relation_id
     AND task_id = p_txn_temp_id
     AND business_event_id IN (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.wms_be_load_confirm)
     AND task_summary = 'N';
Line: 101

	      SELECT 1 INTO l_lot_cnt FROM dual WHERE exists
		(SELECT lot_number FROM mtl_transaction_lots_temp
		 WHERE transaction_temp_id = p_txn_temp_id
		 AND lot_number = l_child_rec.lot_number );
Line: 107

		 SELECT TRANSACTION_QUANTITY INTO l_orig_lot_qty
		   FROM mtl_transaction_lots_temp
		   WHERE transaction_temp_id = p_txn_temp_id
		   AND lot_number = l_child_rec.lot_number;
Line: 135

		 SELECT 1 INTO l_serial_cnt FROM dual WHERE exists
		   (SELECT fm_serial_number--What if RANGE serials ??
		    FROM mtl_serial_numbers_temp msnt,
		    mtl_transaction_lots_temp mtlt
		    WHERE mtlt.transaction_temp_id = p_txn_temp_id
		    AND   msnt.transaction_temp_id = mtlt.serial_transaction_temp_id
		    AND  msnt.fm_serial_number =  l_child_rec.serial_number);
Line: 164

	      SELECT 1 INTO l_serial_cnt FROM dual WHERE exists
		(SELECT fm_serial_number
		 FROM mtl_serial_numbers_temp msnt
		 WHERE msnt.transaction_temp_id = p_txn_temp_id
		 AND msnt.fm_serial_number = l_child_rec.serial_number);
Line: 216

   l_LAST_UPDATE_DATE  DATE;
Line: 219

   l_last_updated_by NUMBER ;
Line: 225

      SELECT relation_id -- all following are passed by WCS
	, task_id
	, task_summary
	, business_event_id
	, transaction_quantity
	, transfer_sub_code
	, transfer_loc_id
	, lpn_id
	, xfer_lpn_id
	, device_status
	, reason_id
	, organization_id--Its NOT NULL Column
	, status_code
	, status_msg
	, lot_number
	, lot_qty
	, serial_number
	, device_id
	FROM wms_device_requests
	WHERE business_event_id IN (wms_device_integration_pvt.wms_be_load_confirm,wms_device_integration_pvt.wms_be_task_confirm)
	ORDER BY relation_id ASC,task_id ASC, task_summary desc;
Line: 250

   SELECT wms_device_requests_s.nextval INTO l_request_id FROM dual;
Line: 270

	    SELECT
	      DEVICE_ID
	      ,responsibility_application_id
	      ,responsibility_id
	      INTO
	      l_device_id
	      ,l_resp_application_id
	      ,l_resp_id
	      FROM wms_device_requests_hist
	      WHERE request_id = nvl(l_rec.relation_id,-1)
	      --nvl,to handle ERROR: when WCS does NOT pass relation_id or task_id
	      AND task_id = nvl(l_rec.task_id,-1)
	      AND task_summary = 'Y'
	      AND business_event_id IN (wms_device_integration_pvt.wms_be_pick_release,wms_device_integration_pvt.wms_be_wip_pick_release,wms_device_integration_pvt.wms_be_mo_task_alloc)
	      AND ROWNUM<2;
Line: 304

      INSERT INTO wms_device_requests_hist(request_id
					   , relation_id -- parent_request_id
					   , task_id
					   , business_event_id
					   , transaction_quantity
					   , transfer_sub_code
					   , transfer_loc_id
					   , lpn_id
					   , xfer_lpn_id
					   , device_status
					   , reason_id
					   , task_summary
					   , organization_id
					   , device_id
					   , request_date
					   , requested_by
					   , status_code
					   , status_msg
					   , responsibility_application_id
					   , responsibility_id
					   , creation_date
					   , created_by
					   , last_update_date
					   , last_updated_by
					   , lot_number
					   , lot_qty
					   , serial_number
					   ) VALUES (l_request_id
						     , l_rec.relation_id
						     , l_rec.task_id
						     , l_rec.business_event_id
						     , l_rec.transaction_quantity
						     , l_rec.transfer_sub_code
						     , l_rec.transfer_loc_id
						     , l_rec.lpn_id
						     , l_rec.xfer_lpn_id
						     , l_rec.device_status
						     , l_rec.reason_id
						     , l_rec.task_summary
						     , l_rec.organization_id
						     , l_device_id
						     , SYSDATE
						     , fnd_global.USER_ID
						     , nvl(l_rec.status_code,'E') --Bug#4535546.Added nvl
						     , l_rec.status_msg
						     , l_resp_application_id
						     , l_resp_id
						     , SYSDATE
						     , fnd_global.USER_ID
						     , SYSDATE
						     , fnd_global.USER_ID
						     , l_rec.lot_number
						     , l_rec.lot_qty
						     , l_rec.serial_number
						     );
Line: 399

PROCEDURE update_wdr_for_error_rec(p_task_id IN NUMBER
				   ,p_relation_id IN NUMBER) IS
l_status_msg VARCHAR2(240);
Line: 407

   UPDATE wms_device_requests
     SET status_code = 'E',
     status_msg = l_status_msg
     WHERE  business_event_id IN (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.wms_be_load_confirm)
     AND task_id = p_task_id
     AND relation_id = p_relation_id;
Line: 417

END update_wdr_for_error_rec;
Line: 554

      SELECT serial_number
	FROM   mtl_serial_numbers
	WHERE  lpn_id = p_lpn
	AND    inventory_item_id = p_item_id
	AND    Nvl(lot_number,-999) = Nvl(p_lot,-999);
Line: 561

      SELECT
	mtlt.primary_quantity,
	mtlt.lot_number
	FROM
	mtl_transaction_lots_temp mtlt
	WHERE  mtlt.transaction_temp_id = p_temp_id;
Line: 582

   t_lpn_lot_qty_table.delete;
Line: 586

      SELECT  1,
	lpn_context
	INTO  l_lpn_exists,
	l_lpn_context
	FROM  wms_license_plate_numbers wlpn
	WHERE wlpn.organization_id = p_org_id
	AND   wlpn.lpn_id = p_lpn;
Line: 627

      SELECT 1
	INTO l_loaded
	FROM dual
	WHERE exists
	( SELECT 1
	  from mtl_material_transactions_temp
	  where transaction_header_id
	  =(SELECT transaction_header_id
	    from mtl_material_transactions_temp
	    WHERE transaction_temp_id=p_temp_id)
	  AND (transfer_lpn_id=p_lpn OR content_lpn_id=p_lpn)
	  AND cost_group_id = p_cost_group_id);
Line: 663

      SELECT
	w.subinventory_code,
   INV_PROJECT.GET_LOCSEGS(w.locator_id, w.organization_id),
	w.license_plate_number,
	w.locator_id,
	w.lpn_context
	INTO
	l_sub,
	l_loc,
	l_from_lpn,
	l_loc_id,
	l_lpn_context
	FROM
	wms_license_plate_numbers w
	WHERE
	w.lpn_id = p_lpn
	AND    w.locator_id is not null;
Line: 694

      SELECT COUNT(*)
	INTO l_sub_active
	FROM mtl_secondary_inventories
	WHERE Nvl(disable_date, Sysdate+1) > Sysdate
	AND organization_id = p_org_id
	AND secondary_inventory_name = l_sub;
Line: 709

      SELECT COUNT(*)
	INTO l_loc_active
	FROM mtl_item_locations_kfv
	WHERE Nvl(disable_date, sysdate+1) > sysdate
	AND organization_id = p_org_id
	AND subinventory_code = l_sub
	AND inventory_location_id = l_loc_id;
Line: 754

      SELECT 1
	INTO l_so_cnt
	FROM dual
	WHERE  exists
	(SELECT 1
	 FROM wsh_delivery_details
	 WHERE lpn_id=p_lpn
	 AND organization_id=p_org_id
	 );
Line: 780

   SELECT
     primary_uom_code,
     lot_control_code,
     serial_number_control_code
     INTO
     l_primary_uom,
     l_lot_code,
     l_serial_code
     FROM   mtl_system_items
     WHERE  organization_id = p_org_id
     AND    inventory_item_id = p_item_id;
Line: 793

   SELECT mmtt.transfer_subinventory
     INTO l_xfr_sub_code
     FROM mtl_material_transactions_temp mmtt
     WHERE mmtt.transaction_temp_id = p_temp_id;
Line: 811

      SELECT 1 INTO l_item_cnt FROM DUAL WHERE exists
       ( SELECT 1
	 FROM wms_lpn_contents wlc
	 WHERE wlc.parent_lpn_id =  p_lpn
 	 AND   wlc.organization_id = p_org_id
	 AND   wlc.inventory_item_id = p_item_id
	 AND   Nvl(wlc.revision,'-999') = Nvl(p_rev,Nvl(wlc.revision,'-999')));  --bug 2495592
Line: 840

	 SELECT 1 INTO l_item_cnt FROM DUAL WHERE exists
	   ( SELECT 1
	     FROM wms_lpn_contents wlc,
	          mtl_transaction_lots_temp mtlt
	     WHERE wlc.parent_lpn_id =  p_lpn
	     AND   wlc.organization_id = p_org_id
	     AND   wlc.inventory_item_id = p_item_id
	     AND   Nvl(wlc.revision,'-999') = Nvl(p_rev,Nvl(wlc.revision,'-999'))
	     AND   (mtlt.transaction_temp_id = p_temp_id
		    AND   mtlt.lot_number = wlc.lot_number));
Line: 901

       select allocated_lpn_id
       into   l_allocated_lpn_id
       from mtl_material_transactions_temp
       where transaction_temp_id = p_temp_id;
Line: 936

   SELECT count( distinct inventory_item_id ),
          count( distinct lot_number ),
          count( distinct revision )    ,
          count( distinct cost_group_id )
   INTO   l_item_cnt2,
          l_lot_cnt,
          l_rev_cnt,
          l_cg_cnt
   FROM   wms_lpn_contents
   WHERE  parent_lpn_id =  p_lpn
   AND    organization_id = p_org_id;
Line: 948

   select count(*)
   into   l_lpn_include_lpn
   from   wms_license_plate_numbers
   where  outermost_lpn_id = p_lpn
   and    organization_id = p_org_id;
Line: 988

	          --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
	          -- in order to get correct att.
		  inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   TRUE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   l_mtlt_lot_number
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   -l_mtlt_primary_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
		           , p_lpn_id                =>   p_lpn
		           , p_transfer_subinventory_code => l_xfr_sub_code
	    	   );
Line: 1019

   			trace('lpn_match: after update qty tree for lpn l_att:' || l_att||' for lot:'||l_mtlt_lot_number);
Line: 1023

   			 trace('lpn_match: calling update qty tree with lpn 1st time failed ');
Line: 1031

	          inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   TRUE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   l_mtlt_lot_number
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   -l_mtlt_primary_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		           , p_transfer_subinventory_code => l_xfr_sub_code
	    	   );
Line: 1060

   			trace('lpn_match: after update qty tree without lpn l_att:' || l_att||' for lot:'||l_mtlt_lot_number);
Line: 1064

   			 trace('lpn_match: calling update qty tree back without lpn 1st time failed ');
Line: 1155

		  --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		  -- in order to get correct att.
		  inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   TRUE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   l_mtlt_lot_number
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   l_mtlt_primary_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
			   , p_lpn_id                =>   p_lpn
		           , p_transfer_subinventory_code => l_xfr_sub_code
		   );
Line: 1186

   		        trace('lpn_match: after update qty tree back for lpn l_att:' || l_att||' for lot:'||l_mtlt_lot_number);
Line: 1190

   		         trace('lpn_match: calling update qty tree back with lpn 1st time failed ');
Line: 1198

		  inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   TRUE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   l_mtlt_lot_number
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   l_mtlt_primary_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		           , p_transfer_subinventory_code => l_xfr_sub_code
		   );
Line: 1227

   			trace('lpn_match: after update qty tree back without lpn l_att:' || l_att||' for lot:'||l_mtlt_lot_number);
Line: 1231

   			 trace('lpn_match: calling update qty tree back without lpn 1st time failed ');
Line: 1249

	       SELECT COUNT(fm_serial_number)
		 INTO   l_serial_exist_cnt
		 FROM   mtl_serial_numbers_temp msnt
		 WHERE  msnt.transaction_temp_id = p_temp_id
		 AND    msnt.fm_serial_number IN
		 ( SELECT serial_number
		   FROM   mtl_serial_numbers
		   WHERE  lpn_id = p_lpn
		   AND    inventory_item_id = p_item_id
		   AND    Nvl(revision, '-999') = Nvl(p_rev, '-999')
		   );
Line: 1277

	       SELECT COUNT(fm_serial_number)
		 INTO   l_total_serial_cnt
		 FROM   mtl_serial_numbers_temp msnt,
		 mtl_transaction_lots_temp mtlt
		 WHERE  mtlt.transaction_temp_id = p_temp_id
		 AND    msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 1302

		  --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		  -- in order to get correct att.
			  inv_quantity_tree_pub.update_quantities
				  (  p_api_version_number    =>   1.0
				   , p_init_msg_lst          =>   fnd_api.g_false
				   , x_return_status         =>   l_return_status
				   , x_msg_count             =>   l_msg_cnt
				   , x_msg_data              =>   l_msg_data
				   , p_organization_id       =>   p_org_id
				   , p_inventory_item_id     =>   p_item_id
				   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
				   , p_is_revision_control   =>   b_is_revision_control
				   , p_is_lot_control        =>   FALSE
				   , p_is_serial_control     =>   b_is_serial_control
				   , p_revision              =>   nvl(p_rev, NULL)
				   , p_lot_number            =>   null
				   , p_subinventory_code     =>   l_sub
				   , p_locator_id            =>   l_loc_id
				   , p_primary_quantity      =>   -p_qty
				   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
				   , x_qoh                   =>   l_qoh
				   , x_rqoh		     =>   l_rqoh
				   , x_qr		     =>   l_qr
				   , x_qs		     =>   l_qs
				   , x_att		     =>   l_att
				   , x_atr		     =>   l_atr
				   , p_lpn_id                =>   p_lpn
		                   , p_transfer_subinventory_code => l_xfr_sub_code
			   );
Line: 1333

   			     trace('lpn_match: update qty tree with lpn 2nd time: l_att:' || l_att);
Line: 1337

   			     trace('lpn_match: calling update qty tree with lpn 2nd time failed ');
Line: 1345

			  inv_quantity_tree_pub.update_quantities
				  (  p_api_version_number    =>   1.0
				   , p_init_msg_lst          =>   fnd_api.g_false
				   , x_return_status         =>   l_return_status
				   , x_msg_count             =>   l_msg_cnt
				   , x_msg_data              =>   l_msg_data
				   , p_organization_id       =>   p_org_id
				   , p_inventory_item_id     =>   p_item_id
				   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
				   , p_is_revision_control   =>   b_is_revision_control
				   , p_is_lot_control        =>   FALSE
				   , p_is_serial_control     =>   b_is_serial_control
				   , p_revision              =>   nvl(p_rev, NULL)
				   , p_lot_number            =>   null
				   , p_subinventory_code     =>   l_sub
				   , p_locator_id            =>   l_loc_id
				   , p_primary_quantity      =>   -p_qty
				   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
				   , x_qoh                   =>   l_qoh
				   , x_rqoh		     =>   l_rqoh
				   , x_qr		     =>   l_qr
				   , x_qs		     =>   l_qs
				   , x_att		     =>   l_att
				   , x_atr		     =>   l_atr
			       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		                   , p_transfer_subinventory_code => l_xfr_sub_code
			   );
Line: 1374

   			     trace('lpn_match: update qty tree without lpn 2nd time:l_att:'||l_att);
Line: 1378

   			     trace('lpn_match: calling update qty tree back without lpn 2nd time failed ');
Line: 1432

		  --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		  -- in order to get correct att.
		  inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   FALSE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   null
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   p_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
			   , p_lpn_id                =>   p_lpn
		           , p_transfer_subinventory_code => l_xfr_sub_code
		   );
Line: 1463

   		     trace('lpn_match: update qty tree back with lpn 2nd time: l_att:' || l_att);
Line: 1467

   		     trace('lpn_match: calling update qty tree with lpn 2nd time failed ');
Line: 1475

		  inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   FALSE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   null
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   p_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		           , p_transfer_subinventory_code => l_xfr_sub_code
		   );
Line: 1504

   		     trace('lpn_match: update qty tree back without lpn 2nd time:l_att:'||l_att);
Line: 1508

   		     trace('lpn_match: calling update qty tree back without lpn 2nd time failed ');
Line: 1531

	 SELECT
	   primary_quantity,
	   transaction_uom
	   INTO
	   l_mmtt_qty,
	   l_txn_uom
	   FROM   mtl_material_transactions_temp
	   WHERE  transaction_temp_id = p_temp_id;
Line: 1560

	       SELECT COUNT(fm_serial_number)
		 INTO   l_serial_exist_cnt
		 FROM
		 mtl_serial_numbers_temp msnt,
		 mtl_transaction_lots_temp mtlt
		 WHERE  mtlt.transaction_temp_id = p_temp_id
		 AND    msnt.transaction_temp_id = mtlt.serial_transaction_temp_id
		 AND    msnt.fm_serial_number IN
		 (	SELECT serial_number
			FROM   mtl_serial_numbers
			WHERE  lpn_id = p_lpn
			AND    inventory_item_id = p_item_id
			AND    Nvl(revision, '-999') = Nvl(p_rev, '-999')
			);
Line: 1624

		  --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		  -- in order to get correct att.
		  inv_quantity_tree_pub.update_quantities
		    (  p_api_version_number    =>   1.0
		       , p_init_msg_lst          =>   fnd_api.g_false
		       , x_return_status         =>   l_return_status
		       , x_msg_count             =>   l_msg_cnt
		       , x_msg_data              =>   l_msg_data
		       , p_organization_id       =>   p_org_id
		       , p_inventory_item_id     =>   p_item_id
		       , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
		       , p_is_revision_control   =>   b_is_revision_control
		       , p_is_lot_control        =>   TRUE
		       , p_is_serial_control     =>   b_is_serial_control
		       , p_revision              =>   nvl(p_rev, NULL)
		       , p_lot_number            =>   l_mtlt_lot_number
		       , p_subinventory_code     =>   l_sub
		       , p_locator_id            =>   l_loc_id
		       , p_primary_quantity      =>   -l_mtlt_primary_qty
		       , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
		       , x_qoh                   =>   l_qoh
		       , x_rqoh		     =>   l_rqoh
		       , x_qr		     =>   l_qr
		       , x_qs		     =>   l_qs
		       , x_att		     =>   l_att
		       , x_atr		     =>   l_atr
		       , p_lpn_id                =>   p_lpn
		       , p_transfer_subinventory_code => l_xfr_sub_code
		    );
Line: 1655

   		     trace('lpn_match: update qty tree 3rd time for lpn l_att:'||l_att||' for lot:'||l_mtlt_lot_number);
Line: 1659

   		     trace('lpn_match: calling update qty tree with lpn 3rd time failed ');
Line: 1667

		  inv_quantity_tree_pub.update_quantities
		    (  p_api_version_number    =>   1.0
		       , p_init_msg_lst          =>   fnd_api.g_false
		       , x_return_status         =>   l_return_status
		       , x_msg_count             =>   l_msg_cnt
		       , x_msg_data              =>   l_msg_data
		       , p_organization_id       =>   p_org_id
		       , p_inventory_item_id     =>   p_item_id
		       , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
		       , p_is_revision_control   =>   b_is_revision_control
		       , p_is_lot_control        =>   TRUE
		       , p_is_serial_control     =>   b_is_serial_control
		       , p_revision              =>   nvl(p_rev, NULL)
		       , p_lot_number            =>   l_mtlt_lot_number
		       , p_subinventory_code     =>   l_sub
		       , p_locator_id            =>   l_loc_id
		       , p_primary_quantity      =>   -l_mtlt_primary_qty
		       , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
		       , x_qoh                   =>   l_qoh
		       , x_rqoh		     =>   l_rqoh
		       , x_qr		     =>   l_qr
		       , x_qs		     =>   l_qs
		       , x_att		     =>   l_att
		       , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		       , p_transfer_subinventory_code => l_xfr_sub_code
		    );
Line: 1696

   		     trace('lpn_match: after update without lpn 3rd time l_att:'|| l_att||' for lot:'||l_mtlt_lot_number);
Line: 1700

   		     trace('lpn_match: calling update qty tree back 3rd time without lpn 3rd time failed ');
Line: 1852

		  --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		  -- in order to get correct att.
		  inv_quantity_tree_pub.update_quantities
			  (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   TRUE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   l_mtlt_lot_number
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   l_mtlt_primary_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
			   , p_lpn_id                =>   p_lpn
		           , p_transfer_subinventory_code => l_xfr_sub_code
		    );
Line: 1883

   		     trace('lpn_match: update qty tree back 3rd time for lpn l_att:'||l_att||' for lot:'||l_mtlt_lot_number);
Line: 1887

   		     trace('lpn_match: calling update qty tree with lpn 3rd time failed ');
Line: 1895

		  inv_quantity_tree_pub.update_quantities
		    (  p_api_version_number    =>   1.0
			   , p_init_msg_lst          =>   fnd_api.g_false
			   , x_return_status         =>   l_return_status
			   , x_msg_count             =>   l_msg_cnt
			   , x_msg_data              =>   l_msg_data
			   , p_organization_id       =>   p_org_id
			   , p_inventory_item_id     =>   p_item_id
			   , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			   , p_is_revision_control   =>   b_is_revision_control
			   , p_is_lot_control        =>   TRUE
			   , p_is_serial_control     =>   b_is_serial_control
			   , p_revision              =>   nvl(p_rev, NULL)
			   , p_lot_number            =>   l_mtlt_lot_number
			   , p_subinventory_code     =>   l_sub
			   , p_locator_id            =>   l_loc_id
			   , p_primary_quantity      =>   l_mtlt_primary_qty
			   , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			   , x_qoh                   =>   l_qoh
			   , x_rqoh		     =>   l_rqoh
			   , x_qr		     =>   l_qr
			   , x_qs		     =>   l_qs
			   , x_att		     =>   l_att
			   , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		           , p_transfer_subinventory_code => l_xfr_sub_code
		   );
Line: 1924

   		     trace('lpn_match: after update qty tree back without lpn 3rd time l_att:'|| l_att||' for lot:'||l_mtlt_lot_number);
Line: 1928

   		     trace('lpn_match: calling update qty tree back without lpn 3rd time failed ');
Line: 1952

	       SELECT COUNT(fm_serial_number)
		 INTO   l_total_serial_cnt
		 FROM   mtl_serial_numbers_temp msnt,
		 mtl_transaction_lots_temp mtlt
		 WHERE  mtlt.transaction_temp_id = p_temp_id
		 AND    msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 2002

		     SELECT COUNT(fm_serial_number)
		       INTO   l_serial_exist_cnt
		       FROM   mtl_serial_numbers_temp msnt
		       WHERE  msnt.transaction_temp_id = p_temp_id
		       AND    msnt.fm_serial_number IN
		       ( SELECT serial_number
			 FROM   mtl_serial_numbers
			 WHERE  lpn_id = p_lpn
			 AND    inventory_item_id = p_item_id
			 AND    Nvl(revision, '-999') = Nvl(p_rev, '-999')
			 );
Line: 2039

		     --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		     -- in order to get correct att.
		     inv_quantity_tree_pub.update_quantities
		       (  p_api_version_number    =>   1.0
			  , p_init_msg_lst          =>   fnd_api.g_false
			  , x_return_status         =>   l_return_status
			  , x_msg_count             =>   l_msg_cnt
			  , x_msg_data              =>   l_msg_data
			  , p_organization_id       =>   p_org_id
			  , p_inventory_item_id     =>   p_item_id
			  , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			  , p_is_revision_control   =>   b_is_revision_control
			  , p_is_lot_control        =>   FALSE
			  , p_is_serial_control     =>   b_is_serial_control
			  , p_revision              =>   nvl(p_rev, NULL)
			  , p_lot_number            =>   null
			  , p_subinventory_code     =>   l_sub
			  , p_locator_id            =>   l_loc_id
			  , p_primary_quantity      =>   -l_mmtt_qty
			  , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			  , x_qoh                   =>   l_qoh
			  , x_rqoh		     =>   l_rqoh
			  , x_qr		     =>   l_qr
			  , x_qs		     =>   l_qs
			  , x_att		     =>   l_att
		          , x_atr		     =>   l_atr
		          , p_lpn_id                =>   p_lpn
		          , p_transfer_subinventory_code => l_xfr_sub_code
		       );
Line: 2070

   			trace('lpn_match: update qty tree with lpn 4th time: l_att:' || l_att);
Line: 2074

   			trace('lpn_match: calling update qty tree with lpn 4th time failed ');
Line: 2082

		     inv_quantity_tree_pub.update_quantities
		       (  p_api_version_number    =>   1.0
			  , p_init_msg_lst          =>   fnd_api.g_false
			  , x_return_status         =>   l_return_status
			  , x_msg_count             =>   l_msg_cnt
			  , x_msg_data              =>   l_msg_data
			  , p_organization_id       =>   p_org_id
			  , p_inventory_item_id     =>   p_item_id
			  , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			  , p_is_revision_control   =>   b_is_revision_control
			  , p_is_lot_control        =>   FALSE
			  , p_is_serial_control     =>   b_is_serial_control
			  , p_revision              =>   nvl(p_rev, NULL)
			  , p_lot_number            =>   null
			  , p_subinventory_code     =>   l_sub
			  , p_locator_id            =>   l_loc_id
			  , p_primary_quantity      =>   -l_mmtt_qty
			  , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			  , x_qoh                   =>   l_qoh
			  , x_rqoh		     =>   l_rqoh
			  , x_qr		     =>   l_qr
			  , x_qs		     =>   l_qs
			  , x_att		     =>   l_att
		       , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		       , p_transfer_subinventory_code => l_xfr_sub_code
		       );
Line: 2111

   			trace('lpn_match: update qty tree without lpn 4th time:l_att:'||l_att);
Line: 2115

   			trace('lpn_match: calling update qty tree without lpn 4th time failed ');
Line: 2205

		     --from lpn is the same as allocated_lpn, we need to update qty tree as negative qty
		     -- in order to get correct att.
		     inv_quantity_tree_pub.update_quantities
		       (  p_api_version_number    =>   1.0
			  , p_init_msg_lst          =>   fnd_api.g_false
			  , x_return_status         =>   l_return_status
			  , x_msg_count             =>   l_msg_cnt
			  , x_msg_data              =>   l_msg_data
			  , p_organization_id       =>   p_org_id
			  , p_inventory_item_id     =>   p_item_id
			  , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			  , p_is_revision_control   =>   b_is_revision_control
			  , p_is_lot_control        =>   FALSE
			  , p_is_serial_control     =>   b_is_serial_control
			  , p_revision              =>   nvl(p_rev, NULL)
			  , p_lot_number            =>   null
			  , p_subinventory_code     =>   l_sub
			  , p_locator_id            =>   l_loc_id
			  , p_primary_quantity      =>   l_mmtt_qty
			  , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			  , x_qoh                   =>   l_qoh
			  , x_rqoh		     =>   l_rqoh
			  , x_qr		     =>   l_qr
			  , x_qs		     =>   l_qs
			  , x_att		     =>   l_att
		          , x_atr		     =>   l_atr
		          , p_lpn_id                =>   p_lpn
		          , p_transfer_subinventory_code => l_xfr_sub_code
		       );
Line: 2236

   			trace('lpn_match: update qty tree back with lpn 4th time: l_att:' || l_att);
Line: 2240

   			trace('lpn_match: calling update qty tree back with lpn 4th time failed ');
Line: 2248

		     inv_quantity_tree_pub.update_quantities
		       (  p_api_version_number    =>   1.0
			  , p_init_msg_lst          =>   fnd_api.g_false
			  , x_return_status         =>   l_return_status
			  , x_msg_count             =>   l_msg_cnt
			  , x_msg_data              =>   l_msg_data
			  , p_organization_id       =>   p_org_id
			  , p_inventory_item_id     =>   p_item_id
			  , p_tree_mode             =>   INV_Quantity_Tree_PUB.g_transaction_mode
			  , p_is_revision_control   =>   b_is_revision_control
			  , p_is_lot_control        =>   FALSE
			  , p_is_serial_control     =>   b_is_serial_control
			  , p_revision              =>   nvl(p_rev, NULL)
			  , p_lot_number            =>   null
			  , p_subinventory_code     =>   l_sub
			  , p_locator_id            =>   l_loc_id
			  , p_primary_quantity      =>   l_mmtt_qty
			  , p_quantity_type         =>   inv_quantity_tree_pvt.g_qs_txn
			  , x_qoh                   =>   l_qoh
			  , x_rqoh		     =>   l_rqoh
			  , x_qr		     =>   l_qr
			  , x_qs		     =>   l_qs
			  , x_att		     =>   l_att
		       , x_atr		     =>   l_atr
		       --  , p_lpn_id                =>   p_lpn      withour lpn_id, only to locator level
		       , p_transfer_subinventory_code => l_xfr_sub_code
		       );
Line: 2277

   		     trace('lpn_match: update qty tree back without lpn 4th time:l_att:'||l_att);
Line: 2281

   		     trace('lpn_match: calling update qty tree back without lpn 4th time failed ');
Line: 2296

		     SELECT
		       COUNT(fm_serial_number)
		       INTO
		       l_total_serial_cnt
		       FROM
		       mtl_serial_numbers_temp msnt
		       WHERE msnt.transaction_temp_id=p_temp_id;
Line: 2536

l_last_updated_by NUMBER;
Line: 2567

   SELECT
     msnt.fm_serial_number,
     msnt.to_serial_number
     FROM  mtl_serial_numbers_temp msnt
     WHERE msnt.transaction_temp_id = l_txn_temp_id;
Line: 2574

   SELECT
     msnt.fm_serial_number,
     msnt.to_serial_number
     FROM
     mtl_serial_numbers_temp msnt,
     mtl_transaction_lots_temp mtlt
     WHERE mtlt.transaction_temp_id = l_txn_temp_id
     AND msnt.transaction_temp_id = mtlt.serial_transaction_temp_id;
Line: 2585

   SELECT relation_id -- parent_request_id
     , task_id
     , task_summary
     , business_event_id
     , transaction_quantity
     , transfer_sub_code
     , transfer_loc_id
     , lpn_id
     , xfer_lpn_id
     , device_status
     , reason_id
     , organization_id--Its NOT NULL Column
     FROM wms_device_requests
     WHERE business_event_id IN
        (wms_device_integration_pvt.wms_be_task_confirm, wms_device_integration_pvt.wms_be_load_confirm)
     AND device_status = 'S'
     AND task_summary = 'Y'
     ORDER BY xfer_lpn_id;
Line: 2605

CURSOR c_mtlt_update (p_relation_id NUMBER, p_temp_id NUMBER) IS
   SELECT lot_number,lot_qty FROM wms_device_requests
     WHERE relation_id = p_relation_id
     AND task_id = p_temp_id
     AND task_summary = 'N'
     AND business_event_id IN
     (wms_device_integration_pvt.wms_be_task_confirm,
      wms_device_integration_pvt.wms_be_load_confirm);
Line: 2621

  CURSOR c_update_xfer_lpns_context IS
     SELECT wlpn.lpn_id,organization_id FROM wms_license_plate_numbers wlpn
       WHERE wlpn.lpn_context <> wms_container_pub.lpn_context_pregenerated
       --to avoid LPNS that have been unpacked by TM for non-LPN ctrld sub
       AND wlpn.lpn_id IN
       (SELECT wdr.xfer_lpn_id
        FROM wms_device_requests wdr,
        wms_device_requests_hist wdrh,
        wms_dispatched_tasks wdt
        WHERE wdr.business_event_id = wms_device_integration_pvt.WMS_BE_TASK_CONFIRM
        AND wdr.task_id = wdt.transaction_temp_id
        AND wdt.task_type IN (4,5,7) -- ONLY for Replenishment, MO Xfer,Staging TASKS
	AND wdr.status_code = 'S'
        AND wdr.device_status = 'S'
        AND wdr.task_summary = 'Y'
        AND wdr.task_summary = wdrh.task_summary
        and wdrh.request_id = wdr.relation_id
        AND wdr.task_id = wdrh.task_id
        AND wdr.transaction_quantity > 0
        AND wdrh.business_event_id IN (wms_device_integration_pvt.wms_be_pick_release,wms_device_integration_pvt.wms_be_wip_pick_release,wms_device_integration_pvt.wms_be_mo_task_alloc)
        AND wdrh.TASK_TYPE_ID = 1);
Line: 2646

   SELECT transaction_temp_id, organization_id, transfer_lpn_id, content_lpn_id
     FROM mtl_material_transactions_temp mmtt
     WHERE mmtt.transaction_header_id = l_txn_hdr_id;
Line: 2652

CURSOR c_open_period_check IS SELECT distinct organization_id, task_id
  FROM wms_device_requests
  WHERE business_event_id = wms_device_integration_pvt.WMS_BE_TASK_CONFIRM
  AND status_code = 'S'
  AND device_status = 'S'
  AND task_summary = 'Y';
Line: 2668

   SELECT mtl_material_transactions_s.NEXTVAL INTO l_txn_hdr_id FROM DUAL;
Line: 2687

	 --update wdr for error_code and error_mesg
	 ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2690

	 update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2701

	    --update wdr for error_code and error_mesg
	    ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2704

	    update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2714

	       SELECT task_id,lpn_id INTO l_txn_temp_id,l_orig_lpn_id
		 FROM wms_device_requests_hist
		 WHERE request_id = l_rec.relation_id
		 AND task_id = l_rec.task_id
		 AND business_event_id IN (wms_device_integration_pvt.wms_be_pick_release,wms_device_integration_pvt.wms_be_wip_pick_release,wms_device_integration_pvt.wms_be_mo_task_alloc)
		 AND ROWNUM <2;
Line: 2726

		  --update wdr for error_code and error_mesg
		  ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2729

		  update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2743

	       SELECT
		 transaction_header_id,
	       inventory_item_id,
	       move_order_line_id,
	       primary_quantity,
	       transaction_quantity,
	       transfer_subinventory,
	       transfer_to_location,
	       revision,
	       transaction_source_type_id,
	       transaction_action_id,
	       subinventory_code,
	       locator_id,
	       last_updated_by,
	       transaction_uom,
	       transaction_type_id,
	       cost_group_id
	       INTO
	       l_orig_txn_hdr_id,
	       l_inventory_item_id,
	       l_move_order_line_id,
	       l_pr_qty,
	       l_mmtt_txn_qty,
	       l_xfer_sub_code,
	       l_xfer_loc_id,
	       l_rev,
	       l_tran_source_type_id,
	       l_tran_action_id,
	       l_sub_code,
	       l_loc_id,
	       l_last_updated_by,
	       l_transaction_uom,
	       l_tran_type_id,
	       l_cost_group_id
	       FROM mtl_material_transactions_temp
	       WHERE transaction_temp_id = l_txn_temp_id;
Line: 2791

		   --update wdr for error_code and mesg
		   ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2794

		   update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2806

		       SELECT
			 msi.lpn_controlled_flag
			 INTO
			 l_lpn_controlled_flag
			 FROM
			 mtl_secondary_inventories msi
			 WHERE msi.organization_id = l_rec.organization_id
			 AND  msi.secondary_inventory_name = l_rec.transfer_sub_code
			 AND sysdate <= nvl(msi.disable_date,sysdate);
Line: 2823

			  --update wdr for error_code and mesg
			  ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2826

			  update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2835

		       --update wdr for error_code and mesg
		       ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2838

		       update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2852

		   SELECT 1 INTO l_count FROM DUAL WHERE exists
		     ( SELECT 1
		       FROM mtl_item_locations_kfv
		       WHERE organization_id = l_rec.organization_id
		       AND inventory_location_id = l_rec.transfer_loc_id
		       AND sysdate < nvl(disable_date,sysdate+1)
		       );
Line: 2866

		      --update wdr for error_code and mesg
		      ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2869

		      update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2899

		--update wdr for error_code and error_mesg
		ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2902

		update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2913

		      SELECT lpn_context
			INTO l_pick_lpn_context
			FROM wms_license_plate_numbers WHERE
			lpn_id = l_rec.lpn_id
			AND organization_id = l_rec.organization_id;
Line: 2932

			 --update wdr for error_code and error_mesg
			 ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2934

			 update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2945

		      --update wdr for error_code and error_mesg
		      ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 2947

		      update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 2998

		   --update wdr for error_code and error_mesg
		   ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3001

		   update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3019

		      SELECT lpn_context,license_plate_number
			INTO l_lpn_context, l_xfer_lpn
			FROM wms_license_plate_numbers WHERE
			lpn_id = l_rec.xfer_lpn_id
			AND organization_id = l_rec.organization_id;
Line: 3037

			 --update wdr for error_code and error_mesg
			 ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3040

			 update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3052

		      --update wdr for error_code and error_mesg
		      ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3055

		      update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3091

		   --update wdr for error_code and error_mesg
		   ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3094

		   update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3100

		   --update wdr for error_code and error_mesg
		   ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3103

		   update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3116

		--update wdr for error_code and error_mesg
		ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3119

		update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3125

	     SELECT lot_control_code,serial_number_control_code,primary_uom_code
	       INTO l_lot_code,l_serial_code,l_primary_uom
	       FROM mtl_system_items
	       WHERE organization_id = l_rec.organization_id
	       AND inventory_item_id = l_inventory_item_id;
Line: 3144

		--update wdr for error_code and error_mesg
		ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3147

		update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3167

               SELECT bremp.resource_id role_id
                    , t.wms_task_type
                    , t.standard_operation_id
                    , t.operation_plan_id
                    INTO l_per_res_id
                    , l_wms_task_type
                    , l_std_op_id
                    , l_operation_plan_id
                    FROM mtl_material_transactions_temp t, bom_std_op_resources bsor, bom_resources bremp
                    WHERE t.transaction_temp_id = l_rec.task_id
                    AND t.standard_operation_id = bsor.standard_operation_id
                    AND bsor.resource_id = bremp.resource_id
                    AND bremp.resource_type = 2
                    AND ROWNUM < 2;
Line: 3183

             SELECT employee_id INTO l_person_id
               FROM fnd_user WHERE user_id = fnd_global.user_id;
Line: 3189

             INSERT INTO wms_dispatched_tasks
               (
                task_id
                , transaction_temp_id
                , organization_id
                , user_task_type
                , person_id
                , effective_start_date
                , effective_end_date
                , person_resource_id
                , status
                , dispatched_time
                , last_update_date
                , last_updated_by
                , creation_date
                , created_by
                , task_type
                , operation_plan_id
                , move_order_line_id
                )
                 VALUES (
                         wms_dispatched_tasks_s.NEXTVAL
                         , l_rec.task_id --transaction_temp_id
                         , l_rec.organization_id
                         , NVL(l_std_op_id, 2)
                         , l_person_id
                         , SYSDATE
                         , SYSDATE
                         , l_per_res_id
                         , l_g_task_active
                         , SYSDATE
                         , SYSDATE
                         , fnd_global.user_id
                         , SYSDATE
                         , fnd_global.user_id
                         , l_wms_task_type
                         , l_operation_plan_id
                         , l_move_order_line_id
                         );
Line: 3245

		--Update the request_id for child records if they exist.

		IF (l_lot_code >1 OR l_serial_code >1) THEN--LOT OR/AND SERIAL ITEMS
		   IF (l_debug = 1) THEN
   		   trace('device_confirmation:validating lot/serial substitution');
Line: 3262

		      --update wdr for error_code and error_mesg
		      ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3265

		      update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3292

		      UPDATE mtl_material_transactions_temp
			SET content_lpn_id = l_rec.lpn_id,
			transfer_lpn_id = l_rec.xfer_lpn_id
			WHERE transaction_temp_id = l_txn_temp_id
			AND organization_id= l_rec.organization_id;
Line: 3298

		      -- Later update LPN context For this case of picked_from_LPN to Packing
		      -- context AS it will be entirely nested

		    ELSIF  l_lpn_match=2 THEN
		      if l_rec.lpn_id = l_rec.xfer_lpn_id then
			 --Error
			 IF (l_debug = 1) THEN
   			 trace('error out,Can not move the entire LPN');
Line: 3310

			 --update wdr for error_code and error_mesg
			 ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3313

			 update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3324

			    --update wdr for error_code and error_mesg
			    ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3327

			    update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3331

			    UPDATE mtl_material_transactions_temp
			      SET lpn_id = l_rec.lpn_id,
			      transfer_lpn_id = l_rec.xfer_lpn_id
			      WHERE transaction_temp_id = l_txn_temp_id
			      AND organization_id= l_rec.organization_id;
Line: 3348

			 --update wdr for error_code and error_mesg
			 ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3351

			 update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3354

			 UPDATE mtl_material_transactions_temp
			   SET lpn_id = l_rec.lpn_id,
			   transfer_lpn_id = l_rec.xfer_lpn_id
			   WHERE transaction_temp_id = l_txn_temp_id
			   AND organization_id= l_rec.organization_id;
Line: 3367

		   UPDATE mtl_material_transactions_temp
		     SET transfer_lpn_id = l_rec.xfer_lpn_id
			WHERE transaction_temp_id = l_txn_temp_id
			AND organization_id= l_rec.organization_id;
Line: 3385

		--Update MTLT/MSNT

		IF (l_qty_discrepancy_flag <> 0) AND l_rec.transaction_quantity <> 0 THEN --means qty_discrepancy
		  --we do not want to error out in case qty_picked is 0 and
		  --lot/serial info in child record is NOT provided

		   IF (l_lot_code >1 OR l_serial_code >1) THEN --LOT OR/AND SERIAL ITEMS
		      IF (l_debug = 1) THEN
   		      trace('device_confirmation:validating lot/serial substitution');
Line: 3409

			 --update wdr for error_code and error_mesg
			 ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3412

			 update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3422

		    SELECT COUNT(*)
		      INTO l_mmtt_count
		      FROM  mtl_material_transactions_temp mmtt
		      WHERE mmtt.transaction_temp_id <> l_rec.task_id
		      AND   mmtt.move_order_line_id = l_move_order_line_id;
Line: 3432

		 SELECT mtrl.txn_source_line_id
		   INTO l_source_line_id
		   FROM mtl_txn_request_lines mtrl
		   WHERE mtrl.line_id = l_move_order_line_id;
Line: 3444

			  trace('Other MMTT lines exist too. Delete MMTT and UPDATE move ORDER line');
Line: 3446

		       DELETE FROM mtl_material_transactions_temp
			 WHERE transaction_temp_id = l_txn_temp_id;
Line: 3454

			     DELETE FROM mtl_serial_numbers_temp msnt
			       WHERE msnt.transaction_temp_id IN
			       (SELECT mtlt.serial_transaction_temp_id
				FROM  mtl_transaction_lots_temp mtlt
				WHERE mtlt.transaction_temp_id = l_txn_temp_id);
Line: 3461

			  DELETE FROM mtl_transaction_lots_temp mtlt
			    WHERE mtlt.transaction_temp_id = l_txn_temp_id;
Line: 3466

			  DELETE FROM mtl_serial_numbers_temp msnt
			    WHERE msnt.transaction_temp_id = l_txn_temp_id;
Line: 3471

		       UPDATE mtl_txn_request_lines
			 SET quantity_detailed = quantity_detailed - l_pr_qty-- this diff is zero
			 WHERE line_id = l_move_order_line_id;
Line: 3481

		       DELETE FROM wms_dispatched_tasks WHERE transaction_temp_id =  l_rec.task_id; --Bug 6987801
Line: 3494

			  --update wdr for error_code and error_mesg
			  ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3497

			  update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3515

			  --update wdr for error_code and error_mesg
			  ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3518

			  update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3522

		       DELETE FROM mtl_material_transactions_temp
			 WHERE transaction_temp_id = l_txn_temp_id;
Line: 3529

			     DELETE FROM mtl_serial_numbers_temp msnt
			       WHERE msnt.transaction_temp_id IN
			       (SELECT mtlt.serial_transaction_temp_id
				FROM  mtl_transaction_lots_temp mtlt
				WHERE mtlt.transaction_temp_id = l_txn_temp_id);
Line: 3536

			  DELETE FROM mtl_transaction_lots_temp mtlt
			    WHERE mtlt.transaction_temp_id = l_txn_temp_id;
Line: 3541

			  DELETE FROM mtl_serial_numbers_temp msnt
			    WHERE msnt.transaction_temp_id = l_txn_temp_id;
Line: 3553

		    -- Update the context to whatever it started with
		    -- before processing the record with zero qty
		    --

		    /* updated as part of the bug 4411819
		    --using wms_container_pvt.Modify_LPN() API instead
		    UPDATE wms_license_plate_numbers
		      SET lpn_context = l_lpn_context -- this still has
		      --the original value of lpn context
		      WHERE lpn_id = l_rec.xfer_lpn_id;
Line: 3593

		       -- Clean up code. Have to delete MMTT, MTLT, MSNT, WDT, if picked less
		       -- and update move order line

		       IF (l_debug = 1) THEN
   		       trace('Deleteing all unpicked lot/serials from MTLT/MSNT');
Line: 3600

		       --delete all unpicked lot/serials from MTLT/MSNT
		       IF l_lot_code >1 THEN

			  IF (l_serial_code >1 AND l_serial_code<>6) THEN

			     DELETE FROM mtl_serial_numbers_temp msnt
			       WHERE transaction_temp_id IN
			       (SELECT msnt.transaction_temp_id
				FROM  mtl_transaction_lots_temp mtlt,
				mtl_serial_numbers_temp msnt
				WHERE mtlt.serial_transaction_temp_id = msnt.transaction_temp_id
				AND mtlt.transaction_temp_id =l_txn_temp_id)
			       AND msnt.fm_serial_number NOT IN
			       (SELECT serial_number FROM wms_device_requests
				WHERE relation_id = l_rec.relation_id
				AND task_id = l_txn_temp_id
				AND business_event_id = wms_device_integration_pvt.WMS_BE_TASK_CONFIRM
				AND task_summary = 'N');
Line: 3622

			  --Update qty in MTLT by qty passed in the child
			  -- records for corresponding lots

			  --In the child record, txn quantity is total
			  --quantity of the parent record. It is the
			  --lot_qty column which keeps correct lot qty for child record.

			  for l_mtlt_update in c_mtlt_update(l_rec.relation_id,l_txn_temp_id)
			    loop

			    l_mtlt_pr_qty :=l_mtlt_update.lot_qty;
Line: 3639

			    from_quantity 	=> l_mtlt_update.lot_qty,
			    from_unit	        => l_transaction_uom,
			    to_unit		=> l_primary_uom,
			    from_name	        => null,
			    to_name		=> null);
Line: 3646

			    trace('l_mtlt_pr_qty::'||l_mtlt_pr_qty||'mtlt_lot_TXN_QTY:::'||l_mtlt_update.lot_qty);
Line: 3648

			    update mtl_transaction_lots_temp set
			    TRANSACTION_QUANTITY = l_mtlt_update.lot_qty,
			    PRIMARY_QUANTITY = l_mtlt_pr_qty
			    WHERE transaction_temp_id = l_txn_temp_id
			    AND lot_number = l_mtlt_update.lot_number;
Line: 3662

			  DELETE FROM mtl_serial_numbers_temp msnt
			    WHERE  msnt.transaction_temp_id = l_txn_temp_id
			    AND    msnt.fm_serial_number NOT IN
			    ( SELECT wdr.serial_number FROM
			      wms_device_requests wdr
			      WHERE relation_id = l_rec.relation_id
			      AND task_id = l_txn_temp_id
			      AND task_summary = 'N'
			      AND business_event_id IN (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.WMS_BE_load_CONFIRM));
Line: 3678

		       UPDATE mtl_txn_request_lines
			 SET  quantity_detailed = l_rec.transaction_quantity
			 WHERE line_id = l_move_order_line_id;
Line: 3700

				--update wdr for error_code and error_mesg
				ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3703

				update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3707

				UPDATE mtl_material_transactions_temp
				  SET lpn_id = l_rec.lpn_id,
				  transfer_lpn_id = l_rec.xfer_lpn_id
				  WHERE transaction_temp_id = l_txn_temp_id
				  AND organization_id= l_rec.organization_id;
Line: 3715

			     UPDATE mtl_material_transactions_temp
			       SET content_lpn_id = l_rec.lpn_id,
			       transfer_lpn_id = l_rec.xfer_lpn_id
			       WHERE transaction_temp_id = l_txn_temp_id
			       AND organization_id= l_rec.organization_id;
Line: 3730

			     --update wdr for error_code and error_mesg
			     ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3733

			     update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3742

				--update wdr for error_code and error_mesg
				ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3745

				update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3749

				UPDATE mtl_material_transactions_temp
				  SET lpn_id = l_rec.lpn_id,
				  transfer_lpn_id = l_rec.xfer_lpn_id
				  WHERE transaction_temp_id = l_txn_temp_id
				  AND organization_id= l_rec.organization_id;
Line: 3760

			     UPDATE mtl_material_transactions_temp
			       SET content_lpn_id = l_rec.lpn_id,
			       transfer_lpn_id = l_rec.xfer_lpn_id
			       WHERE transaction_temp_id = l_txn_temp_id
				  AND organization_id= l_rec.organization_id;
Line: 3774

				--update wdr for error_code and error_mesg
				ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3777

				update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3780

				UPDATE mtl_material_transactions_temp
				  SET lpn_id = l_rec.lpn_id,
				  transfer_lpn_id = l_rec.xfer_lpn_id
				  WHERE transaction_temp_id = l_txn_temp_id
				  AND organization_id= l_rec.organization_id;
Line: 3793

			     --update wdr for error_code and error_mesg
			     ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3796

			     update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3809

			     --update wdr for error_code and error_mesg
			     ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3812

			     update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3815

			     UPDATE mtl_material_transactions_temp
			       SET lpn_id = l_rec.lpn_id,
			       transfer_lpn_id = l_rec.xfer_lpn_id
			       WHERE transaction_temp_id = l_txn_temp_id
			       AND organization_id= l_rec.organization_id;
Line: 3828

		       UPDATE mtl_material_transactions_temp
			 SET transfer_lpn_id = l_rec.xfer_lpn_id
			 WHERE transaction_temp_id = l_txn_temp_id
			 AND organization_id= l_rec.organization_id;
Line: 3840

		    --update MMTT for qty/loc/sub disc
		    ll_pr_qty := l_pr_qty ;
Line: 3898

		    UPDATE mtl_material_transactions_temp
		      SET transfer_subinventory = ll_xfer_sub_code
		      , transfer_to_location  = ll_xfer_loc_id
		      , primary_quantity      = ll_pr_qty
		      , transaction_quantity  = ll_mmtt_txn_qty
		      WHERE transaction_temp_id = l_txn_temp_id
		      AND organization_id      = l_rec.organization_id;
Line: 3933

		       , p_user_id          =>l_last_updated_by--from mmtt
		       , p_item_id          =>l_inventory_item_id
		       , p_is_loc_desc      =>TRUE --Bug 4319541
		       );
Line: 3945

		       --update wdr for error_code and error_mesg
		       ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3948

		       update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3954

		       --update wdr for error_code and error_mesg
		       ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 3957

		       update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 3968

			  SELECT  1
			    INTO  l_wf
			    FROM  MTL_TRANSACTION_REASONS
			    WHERE reason_id=l_rec.reason_id
			    and  workflow_name is not null
			      and workflow_name<>' '
			      and workflow_process is not null
				and workflow_process<>' ';
Line: 4020

			     --update wdr for error_code and error_mesg
			     ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 4023

			     update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 4032

			     --update wdr for error_code and error_mesg
			     ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 4035

			     update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 4051

             UPDATE mtl_material_transactions_temp
               SET  transaction_date = sysdate
               ,transaction_status = 3
               ,transaction_header_id = l_txn_hdr_id
               WHERE transaction_temp_id = l_txn_temp_id
               AND organization_id= l_rec.organization_id
               AND l_rec.business_event_id <> wms_device_integration_pvt.wms_be_load_confirm;
Line: 4065

             UPDATE wms_dispatched_tasks
               SET status =  l_g_task_loaded
               ,last_update_date = Sysdate
               ,loaded_time = Sysdate
               ,last_updated_by = fnd_global.user_id
               WHERE transaction_temp_id = l_rec.task_id;
Line: 4101

                     update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 4134

                update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 4152

		    --update wdr for error_code and error_mesg
		    ROLLBACK TO WMS_DEVICE_REQUESTS_SP;
Line: 4155

		    update_wdr_for_error_rec(l_rec.task_id,l_rec.relation_id);
Line: 4163

      UPDATE wms_device_requests
	SET status_code = 'S',
	status_msg = null
	WHERE  business_event_id in (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.wms_be_load_confirm)
	AND task_id = l_rec.task_id
	AND relation_id = l_rec.relation_id;
Line: 4202

	    trace('Need to update the account period in MMTT');
Line: 4204

	 UPDATE mtl_material_transactions_temp
	   SET  acct_period_id = l_period_id
	   WHERE transaction_temp_id = l_open_period_check.task_id
	   AND organization_id = l_open_period_check.organization_id;
Line: 4224

      trace('Done with all records: Insert WDT History ONLY for LPNs to be DROPPED');
Line: 4242

		 UPDATE mtl_material_transactions_temp mmtt
		   set transfer_lpn_id = NULL , lpn_id = NULL
		   WHERE mmtt.transaction_temp_id = l_mmtt_csr.transaction_temp_id;
Line: 4257

         , p_delete_mmtt_flag           => 'N'
         , p_txn_header_id              => l_txn_hdr_id
         , p_transfer_lpn_id            => NVL(l_mmtt_csr.transfer_lpn_id, l_mmtt_csr.content_lpn_id)
         );
Line: 4311

	 --Step6 Update LPN Context apporpriately for processed LPNs
	 --For droped LPN tasks ONLY:
	 --    Replenishment task = (reside IN inv) wms_container_pub.lpn_context_inv
	 --    so taks = Handled by TM (Do NOT do anything)
	 -- All successful LPNs are already Loaded in the loop above for each call


	 --Update the LPN context to Reside in INV for all LPNs for Replenishment
	 --tasks. For SO tasks, it is handled in the TM
	 -- the cursor c_update_xfer_lpns_context ensure that LPNs for
	 -- replenishment tasks are here only


	 FOR l_update_xfer_lpns_context IN c_update_xfer_lpns_context loop

	    --In case LPN is getting transferred, both lpn_id and
	    --xfer_lpn_id are same, so getting updated correctly

	    --as part of the bug 4411819, replaced
	    --wms_container_pub.modify_lpn_wrapper to  wms_container_pvt.Modify_LPN

	    l_lpn.lpn_id        := l_update_xfer_lpns_context.lpn_id;
Line: 4333

	    l_lpn.organization_id := l_update_xfer_lpns_context.organization_id;
Line: 4370

	 trace(' device_confirmation:Delete requested rows from WDR');
Line: 4372

      delete from wms_device_requests;--since temp table is session specific
Line: 4397

	 UPDATE wms_device_requests_hist
	   SET status_code = 'E',resubmit_date = sysdate,
	   status_msg= 'g_expected_error'
	   WHERE request_id = l_new_request_id
	   AND BUSINESS_EVENT_ID IN (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.wms_be_load_confirm);
Line: 4434

	 UPDATE wms_device_requests_hist
	   SET status_code = 'E',resubmit_date = Sysdate,
	   status_msg='g_unexpected_error'
	   WHERE request_id = l_new_request_id
	   AND BUSINESS_EVENT_ID IN (wms_device_integration_pvt.wms_be_task_confirm,wms_device_integration_pvt.wms_be_load_confirm);