DBA Data[Home] [Help]

APPS.INV_MAINTAIN_RESERVATION_PUB SQL Statements

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

Line: 219

        p_delete_flag          in   varchar2,
        p_sort_by_criteria     in   number,
        x_quantity_modified    out  nocopy number ) is

       -- define constants for api version and api name
       c_api_version_number constant number       := 1.0;
Line: 360

          mydebug('p_delete_flag = '|| p_delete_flag ,c_api_name,1);
Line: 364

       if upper(nvl(p_delete_flag,'N')) = 'N' then
          -- codereview.su.06. swap action types for sorting criteria
          if p_mtl_maintain_rsv_rec.action = c_action_demand then
            if p_sort_by_criteria is null then
               l_sort_by_criteria := inv_reservation_global.g_query_supply_rcpt_date_asc;
Line: 379

       elsif upper(nvl(p_delete_flag,'N')) = 'Y' then
          -- if delete flag is 'y' sort by criteria will be same as what user has passed.
          l_sort_by_criteria := p_sort_by_criteria;
Line: 629

       if upper(nvl(p_delete_flag,'N')) = 'Y' then
          -- check if there are any reservation records with staged_flag as 'y'
          -- if so, throw error
	  if (g_debug= c_debug_enabled) then
	     mydebug ('Inside delete flag is Y' ,c_api_name,1);
Line: 743

		   mydebug ('Deleting reservations, Delete flag: Y' ,c_api_name,1);
Line: 751

                inv_reservation_pvt.delete_reservation(
                   p_api_version_number => 1.0 ,
                   p_init_msg_lst      => fnd_api.g_false ,
                   x_return_status      => x_return_status,
                   x_msg_count          => x_msg_count,
                   x_msg_data           => x_msg_data,
                   p_rsv_rec            => l_original_rsv_rec ,
                   p_original_serial_number  => l_original_serial_number,
                   p_validation_flag   => fnd_api.g_true);
Line: 762

		   mydebug ('After calling delete: ' || x_return_status ,c_api_name,1);
Line: 766

                    l_fnd_log_message := 'error while calling delete_reservation api :';
Line: 773

                    l_fnd_log_message := 'error while calling delete_reservation api :';
Line: 780

                    l_fnd_log_message := 'calling delete_reservation api was successful:';
Line: 790

       elsif upper(nvl(p_delete_flag,'N')) = 'N' then
          -- check for expected quantity value
          -- dbms_output.put_line('delete flag is no');
Line: 1038

		   -- call update reservation api
		   -- dbms_output.put_line('calling update reservation api');
Line: 1058

		      mydebug('Update reservation', c_api_name,9);
Line: 1059

		      mydebug('Update qty' || l_primary_need_reduced_qty, c_api_name,9);
Line: 1061

		   inv_reservation_pvt.update_reservation
		     (
		      p_api_version_number =>  1.0,
		      p_init_msg_lst       =>  fnd_api.g_false,
		      x_return_status      =>  x_return_status,
		      x_msg_count          =>  x_msg_count,
		      x_msg_data           =>  x_msg_data ,
		      p_original_rsv_rec   =>  l_original_rsv_rec,
		      p_to_rsv_rec         =>  l_to_rsv_rec,
		      p_original_serial_number => l_original_serial_number,
		      p_to_serial_number   =>  l_to_serial_number,
		      p_validation_flag    =>  fnd_api.g_true ,
		      p_check_availability =>  fnd_api.g_false );
Line: 1075

		   -- check if delete reservation has raised any errors, if so raise exception
		   if x_return_status = fnd_api.g_ret_sts_error then
		      l_fnd_log_message := 'error while calling update reservation api 02:';
Line: 1084

		      l_fnd_log_message := 'error while calling update reservation api 02:';
Line: 1091

		      l_fnd_log_message := 'calling update reservation api was successful -02:';
Line: 1101

		   -- call delete reservation
		   IF g_debug= c_debug_enabled then
		      mydebug('Call delete reservation for reservation id' || l_mtl_reservation_tbl(i).reservation_id, c_api_name,9);
Line: 1107

		   -- dbms_output.put_line('calling delete reservation api');
Line: 1108

		   inv_reservation_pvt.delete_reservation
		     (
		      p_api_version_number =>  1.0,
		      p_init_msg_lst       =>  fnd_api.g_false,
		      x_return_status      =>  x_return_status,
		      x_msg_count          =>  x_msg_count,
		      x_msg_data           =>  x_msg_data ,
		      p_rsv_rec            =>  l_original_rsv_rec,
		      p_original_serial_number => l_original_serial_number,
		      p_validation_flag    =>  fnd_api.g_true  );
Line: 1119

		   -- check if delete reservation has raised any errors, if so raise exception
		   if x_return_status = fnd_api.g_ret_sts_error then
		      l_fnd_log_message := 'error while calling delete reservation api 02:';
Line: 1128

		      l_fnd_log_message := 'error while calling delete reservation api 02:';
Line: 1135

		      l_fnd_log_message := 'calling delete reservation api was successful -02:';
Line: 1157

	  end if; -- p_delete_flag = y
Line: 1510

     select decode (h.source_document_type_id, 10,
               inv_reservation_global.g_source_type_internal_ord,
               inv_reservation_global.g_source_type_oe )
       into l_demand_source_type_id
       from oe_order_headers_all h, oe_order_lines_all l
      where h.header_id = l.header_id
        and l.line_id = p_demand_source_line_id;
Line: 2199

PROCEDURE UPDATE_RES
   (p_supply_source_header_id       IN NUMBER
   ,p_supply_source_line_id         IN NUMBER
   ,p_supply_source_type_id         IN NUMBER
   ,p_primary_uom_code              IN VARCHAR2 DEFAULT NULL
   ,p_primary_reservation_quantity  IN NUMBER
   ,p_reservation_id                IN NUMBER
   ,p_project_id                    IN NUMBER
   ,p_task_id                       IN NUMBER
   ,x_msg_count                     OUT NOCOPY NUMBER
   ,x_msg_data                      OUT NOCOPY VARCHAR2
   ,x_return_status                 OUT NOCOPY VARCHAR2)
IS

   -- Define Constants for API version and API name
   C_api_version_number       CONSTANT NUMBER       := 1.0;
Line: 2215

   C_api_name                 CONSTANT VARCHAR2(30) := 'UPDATE_RES';
Line: 2259

   inv_reservation_pub.update_reservation
     (
        p_api_version_number        => 1.0
      , p_init_msg_lst              => fnd_api.g_false
      , x_return_status             => l_return_status
      , x_msg_count                 => x_msg_count
      , x_msg_data                  => x_msg_data
      , p_original_rsv_rec          => l_rsv
      , p_to_rsv_rec                => l_rsv_new
      , p_original_serial_number    => g_dummy_sn_tbl -- no serial contorl
      , p_to_serial_number          => g_dummy_sn_tbl -- no serial control
      , p_validation_flag           => fnd_api.g_true
      );
Line: 2281

      l_Fnd_Log_message := 'Calling update_reservation API was successful ';
Line: 2287

      l_Fnd_Log_message := 'Error while calling update_reservation API ';
Line: 2756

PROCEDURE DELETE_RES
(p_supply_source_header_id  IN NUMBER DEFAULT NULL
,p_supply_source_line_id    IN NUMBER DEFAULT NULL
,p_supply_source_type_id    IN NUMBER DEFAULT NULL
,x_msg_count               OUT NOCOPY NUMBER
,x_msg_data                OUT NOCOPY VARCHAR2
,x_return_status           OUT NOCOPY VARCHAR2)
IS
   -- Define Constants for API version and API name
   C_api_version_number       CONSTANT NUMBER       := 1.0;
Line: 2766

   C_api_name                 CONSTANT VARCHAR2(30) := 'DELETE_RES';
Line: 2815

   inv_reservation_pub.delete_reservation
     (
        p_api_version_number        => 1.0
      , p_init_msg_lst              => fnd_api.g_false
      , x_return_status             => l_return_status
      , x_msg_count                 => x_msg_count
      , x_msg_data                  => x_msg_data
      , p_rsv_rec                   => l_rsv
      , p_serial_number             => g_dummy_sn_tbl
      );
Line: 2834

      l_Fnd_Log_message := 'Calling delete_reservation API was successful ';
Line: 2840

      l_Fnd_Log_message := 'Error while calling delete_reservation API ';
Line: 3034

        SELECT   item_id
               , unit_meas_lookup_code
          INTO   l_item_id
               , l_po_uom
          FROM po_lines_all
         WHERE po_line_id= p_po_line_id;
Line: 3041

        SELECT unit_of_measure
          INTO l_primary_meas
          FROM mtl_units_of_measure
         WHERE uom_code = p_primary_uom;
Line: 3046

        SELECT unit_of_measure
          INTO l_res_meas
          FROM mtl_units_of_measure
         WHERE uom_code = p_res_uom;
Line: 3201

      SELECT requisition_header_id
	, requisition_line_id
	, interface_source_line_id
	, need_by_date
	, item_id
	, destination_organization_id
	, uom_code
	, quantity
	, project_id
	, task_id
	, source_type_code
      FROM   po_requisitions_interface
      WHERE  requisition_header_id = p_header_id
      AND    interface_source_code = 'CTO'
  UNION
   select  prl.requisition_header_id
        , prl.requisition_line_id
        , interface_source_line_id
        , need_by_date
        , item_id
        , destination_organization_id
        , uom_code
        , quantity
        , project_id
        , task_id
        , source_type_code
    from po_requisition_lines_all prl, po_requisition_headers_all prh , po_req_distributions_all prd, mtl_units_of_measure muom
   where prh.requisition_header_id = p_header_id
     and prh.REQUISITION_HEADER_ID = prl.REQUISITION_HEADER_ID
     and prd.requisition_line_id = prl.requisition_line_id
     and nvl(prl.modified_by_agent_flag,'N') <> 'Y'
     AND muom.unit_of_measure= unit_meas_lookup_code
     and not exists (select null
                  FROM po_requisitions_interface pri
                   where pri.requisition_header_id = prh.requisition_header_id
                   and   pri.interface_source_code = 'CTO');
Line: 3247

      SELECT  header_id
            , ordered_quantity
            , order_quantity_uom
        FROM  oe_order_lines_all
       WHERE  line_id = v_demand_line_id
         AND  cancelled_flag = 'N';
Line: 3263

      SELECT sum(nvl(primary_reservation_quantity,0)) sum_pri_res_qty, primary_uom_code
        FROM mtl_reservations
       WHERE demand_source_header_id = v_demand_header_id
         AND demand_source_line_id = v_demand_line_id
         AND demand_source_type_id in (inv_reservation_global.g_source_type_oe,
                                       inv_reservation_global.g_source_type_internal_ord)
       GROUP BY primary_uom_code;
Line: 3280

      SELECT 'Exists'
        FROM mtl_reservations
       WHERE supply_source_header_id = v_requisition_header_id
         AND supply_source_line_id = v_requisition_line_id
         AND Supply_source_type_id=inv_reservation_global.g_source_type_req;
Line: 3287

      SELECT  pll.po_header_id
             ,pll.po_line_id
             ,pll.line_location_id
             ,pll.ship_to_organization_id
             ,pl.item_id
        FROM  po_line_locations_all pll
             ,po_lines_all  pl
       WHERE  pll.po_header_id = v_po_header_id
         AND  pl.po_line_id = pll.po_line_id;
Line: 3299

      SELECT  b.requisition_line_id req_line_id
            , Nvl(b.project_id,-99) project_id
            , Nvl(b.task_id, -99) task_id
           -- , sum(a.quantity_ordered) quantity_ordered
        FROM  po_distributions_all a
            , po_req_distributions_all b
       WHERE  a.line_location_id = v_po_shipment_id
         AND  a.req_distribution_id = b.distribution_id
         AND  a.distribution_type <> 'AGREEMENT' --
    GROUP BY  b.requisition_line_id
            , b.project_id
            , b.task_id;
Line: 3313

      SELECT COUNT(min(po_distribution_id)) count
        FROM  po_distributions_all pd
       WHERE  pd.line_location_id = v_po_shipment_id
	GROUP BY project_id, task_id;
Line: 3319

        SELECT    Nvl(project_id, -99) project_id, Nvl(task_id, -99) task_id
          FROM    po_distributions_all
         WHERE    line_location_id = v_po_shipment_id
      GROUP BY    project_id,task_id;
Line: 3328

   SELECT  reservation_uom_code
         , primary_uom_code
         , sum(nvl(primary_reservation_quantity,0)) primary_reservation_quantity
     FROM  mtl_reservations
    WHERE  supply_source_header_id = v_po_header_id
      AND  supply_source_line_id = v_po_line_location_id
      AND  supply_source_type_id = inv_reservation_global.g_source_type_po
      AND  Nvl(project_id,-99) = nvl(v_project_id, -99)
      AND  Nvl(task_id,-99) = nvl(v_task_id, -99)
 GROUP BY  reservation_uom_code
         , primary_uom_code;
Line: 3342

      SELECT  pll.po_header_id
            , pll.po_line_id
            , pll.line_location_id
            , pll.ship_to_organization_id    --?? is it correct org_id ??
            , pl.item_id
        FROM  po_line_locations_all  pll
             ,po_lines_all pl
       WHERE  pll.po_release_id = v_po_header_id
         AND  pll.po_line_id = pl.po_line_id;
Line: 3357

      SELECT requisition_line_id, source_type_code
        FROM po_requisition_lines_all --
       WHERE requisition_header_id = v_po_req_header_id;
Line: 3366

     SELECT po_header_id
     FROM   po_lines_all --
   WHERE  po_line_id = v_po_line_id;
Line: 3379

     SELECT pll.po_header_id
       , pll.po_line_id
       , pll.line_location_id
       , pll.ship_to_organization_id
       , pl.item_id
       , pll.quantity
       FROM po_line_locations_all pll, po_lines_all pl --
       WHERE pl.po_line_id = v_po_line_id
       AND pl.po_line_id = pll.po_line_id;
Line: 3394

      SELECT   po_header_id
        FROM   po_line_locations_all --
       WHERE   line_location_id = p_line_location_id;
Line: 3407

     SELECT  pll.po_header_id
       , pll.po_line_id
       , pll.line_location_id
       , pll.ship_to_organization_id
       , pl.item_id
       , pll.quantity
       FROM  po_line_locations_all pll, po_lines_all pl--
       WHERE  pll.line_location_id = v_po_line_location_id AND
       pl.po_line_id = pll.po_line_id;
Line: 3424

     SELECT   po_header_id
       FROM   po_releases_all --
       WHERE  po_release_id = v_po_header_id;
Line: 3434

     SELECT  po_header_id
       , po_line_id
       , line_location_id
       , req_distribution_id
       , quantity_ordered
       FROM  po_distributions_all --
       WHERE  po_release_id = v_po_header_id;
Line: 3443

     SELECT source_document_code, organization_id FROM rcv_transactions
       WHERE transaction_id = v_transaction_id;
Line: 3447

     SELECT  decode(a.source_document_code,'PO'
		    , decode(b.asn_line_flag, 'Y', 'ASN', 'PO'), a.source_document_code)  supply_type
       , a.po_header_id, a.po_line_id
       , a.po_line_location_id
       , a.po_distribution_id
       , d.uom_code primary_unit_of_measure
       , a.primary_quantity
       , a.requisition_line_id
       , a.req_distribution_id
       , a.shipment_line_id
       , a.shipment_header_id
       , a.subinventory
       , a.locator_id
       , a.organization_id
       , a.lpn_id
       , b.item_revision
       , b.item_id
       , b.to_organization_id
       , c.project_id
       , c.task_id
       FROM  rcv_transactions a
       , rcv_shipment_lines b
       , po_distributions_all c
       , mtl_units_of_measure d
       WHERE  transaction_id = v_transaction_id
       AND  a.shipment_line_id = b.shipment_line_id
       AND  c.po_distribution_id = a.po_distribution_id
       AND  c.po_header_id = a.po_header_id
       AND  c.po_line_id = a.po_line_id
       AND  c.line_location_id = a.po_line_location_id
       AND d.unit_of_measure = a.primary_unit_of_measure;
Line: 3481

     SELECT  lot_num
       , primary_quantity
       FROM rcv_lot_transactions
       WHERE shipment_line_id = v_shipment_line_id;
Line: 3488

     SELECT  lot_num
       , primary_quantity
       FROM rcv_lot_transactions
       WHERE shipment_line_id = v_shipment_line_id
         AND transaction_id = v_transaction_id;
Line: 3495

     SELECT  a.po_header_id
       , a.po_line_id
       , a.po_line_location_id
       , a.po_distribution_id
       , d.uom_code primary_unit_of_measure
       , a.primary_quantity
       , a.shipment_line_id
       , a.subinventory
       , a.locator_id
       , a.organization_id
       , a.lpn_id
       , b.item_revision
       , b.item_id
       , b.to_organization_id
       , c.project_id
       , c.task_id
       FROM  rcv_transactions a
       , rcv_shipment_lines b
       , po_distributions_all c
       , mtl_units_of_measure d
       WHERE a.transaction_id = v_transaction_id
       AND a.source_document_code = 'PO'
       AND b.shipment_line_id = a.shipment_line_id
	AND b.asn_line_flag = 'Y'
       AND c.po_distribution_id = a.po_distribution_id
       AND c.po_header_id = a.po_header_id
       AND c.po_line_id = a.po_line_id
       AND c.line_location_id = a.po_line_location_id
       AND d.unit_of_measure = a.primary_unit_of_measure;
Line: 3528

     SELECT  a.requisition_line_id
       , e.uom_code primary_unit_of_measure
       , a.primary_quantity
       , a.shipment_line_id
       , a.subinventory
       , a.locator_id
       , a.organization_id
       , a.lpn_id
       , b.item_revision
       , b.item_id
       , b.to_organization_id
       , c.project_id
       , c.task_id
       , d.requisition_header_id
       FROM  rcv_transactions a
       , rcv_shipment_lines b
       , po_req_distributions_all c
       , po_requisition_lines_all d
       , mtl_units_of_measure e
       WHERE a.transaction_id = v_transaction_id
       AND a.source_document_code = 'REQ'
       AND b.shipment_line_id = a.shipment_line_id
       AND c.distribution_id = a.req_distribution_id
       AND c.requisition_line_id = a.requisition_line_id
       AND d.requisition_line_id = c.requisition_line_id
       AND e.unit_of_measure = a.primary_unit_of_measure;
Line: 3624

  l_delete_flag VARCHAR2(1);
Line: 3637

        SELECT  POSTPROCESSING_LEAD_TIME
          FROM  MTL_SYSTEM_ITEMS
         WHERE  INVENTORY_ITEM_ID = v_item_id
           AND  ORGANIZATION_ID = v_org_id;
Line: 3980

			  l_Fnd_Log_Message := 'calling update_res API ';
Line: 3984

		       update_res
			 (p_supply_source_header_id      => l_rsv_rec.supply_source_header_id
			  ,p_supply_source_line_id        => l_rsv_rec.supply_source_line_id
			  ,p_supply_source_type_id        => inv_reservation_global.g_source_type_req
			  ,p_primary_reservation_quantity => l_qty_avail_to_reserve
			  ,p_project_id                   => get_req_line_po_shipment_rec.project_id
			  ,p_task_id                      => get_req_line_po_shipment_rec.task_id
			  ,p_reservation_id               => l_rsv_rec.reservation_id
			  ,x_msg_count                    => x_msg_count
			  ,x_msg_data                     => x_msg_data
			  ,x_return_status                => l_return_status);
Line: 4135

		   -- delete all the reservations for this shipment
		   -- log message
		   IF g_debug= C_Debug_Enabled THEN
		      l_Fnd_Log_Message := 'Organization is wms org. calling delete_res API with IN parameters';
Line: 4141

		   -- Call reduce reservations instead of delete
		   -- reservations
		   -- Call the reduce reservations API by setting the
		   -- delete_flag to yes. delete all reservations for that
		   -- supply line.
		   -- calling reduce_reservation API
		   l_delete_flag := 'Y';
Line: 4168

		       , p_delete_flag            => l_delete_flag
		       , p_sort_by_criteria       => l_sort_by_criteria
		       , x_quantity_modified      => l_quantity_modified);
Line: 4190

		   /***** Call reduce reservations instead of delete reservations
		   DELETE_RES
		     (p_supply_source_header_id => p_header_id
		      ,p_supply_source_line_id   => get_po_shipment_rec.line_location_id
		      ,p_supply_source_type_id   => inv_reservation_global.g_source_type_po
		      ,x_msg_count               => x_msg_count
		      ,x_msg_data                => x_msg_data
		      ,x_return_status           => l_return_status);
Line: 4298

			    , p_delete_flag            => 'N'
			    , p_sort_by_criteria       => l_sort_by_criteria
			    , x_quantity_modified      => l_quantity_modified);
Line: 4415

                           SELECT    max(mir.revision)
                             INTO    l_item_revision
                             FROM    mtl_system_items msi
                                   , mtl_item_revisions mir
                            WHERE    msi.inventory_item_id = get_rcv_transaction_rec.item_id
                              AND    msi.organization_id = get_rcv_transaction_rec.organization_id
                              AND    msi.revision_qty_control_code = 2
                              AND    mir.organization_id = msi.organization_id
                              AND    msi.inventory_item_id = msi.inventory_item_id
                              AND    mir.effectivity_date in
                                      (SELECT   MAX(mir2.effectivity_date)
                                         FROM   mtl_item_revisions mir2
                                        WHERE   mir2.organization_id = get_rcv_transaction_rec.organization_id
                                          AND   mir2.inventory_item_id = get_rcv_transaction_rec.item_id
                                          AND   mir2.effectivity_date <= SYSDATE
                                          AND   mir2.implementation_date is not NULL);
Line: 4449

                      item revision to inventory so that supply gets updated accordingly.
                      */

                      IF g_debug= C_Debug_Enabled THEN
                           l_Fnd_Log_Message := 'get_rcv_transaction_rec.item_revision is NOT NULL ';
Line: 4459

                          SELECT msi.revision_qty_control_code
                            INTO l_revision_control_code
                            FROM mtl_system_items_b msi
                           WHERE msi.inventory_item_id = get_rcv_transaction_rec.item_id
                             AND msi.organization_id = get_rcv_transaction_rec.organization_id;
Line: 4491

                        select nvl(lot_control_code,1)
                          into   l_lot_control_code
                          from   mtl_system_items
                         where  organization_id = get_rcv_transaction_rec.to_organization_id
                           and  inventory_item_id = get_rcv_transaction_rec.item_id ;
Line: 4726

		     SELECT    max(mir.revision)
		       INTO    l_item_revision
		       FROM    mtl_system_items msi
		       , mtl_item_revisions mir
		       WHERE    msi.inventory_item_id = get_rcv_transaction_asn_rec.item_id
		       AND    msi.organization_id = get_rcv_transaction_asn_rec.organization_id
		       AND    msi.revision_qty_control_code = 2
		       AND    mir.organization_id = msi.organization_id
		       AND    msi.inventory_item_id = msi.inventory_item_id
		       AND    mir.effectivity_date in
		       (SELECT   MAX(mir2.effectivity_date)
			FROM   mtl_item_revisions mir2
			WHERE   mir2.organization_id = get_rcv_transaction_asn_rec.organization_id
			AND   mir2.inventory_item_id = get_rcv_transaction_asn_rec.item_id
			AND   mir2.effectivity_date <= SYSDATE
			AND   mir2.implementation_date is not NULL);
Line: 4754

		       item revision to inventory so that supply gets updated accordingly.
		       */
		       BEGIN

			  SELECT msi.revision_qty_control_code
			    INTO l_revision_control_code
			    FROM mtl_system_items_b msi
			    WHERE msi.inventory_item_id = get_rcv_transaction_asn_rec.item_id
                            AND msi.organization_id = get_rcv_transaction_asn_rec.organization_id;
Line: 4786

                    select nvl(lot_control_code,1)
                      into   l_lot_control_code
                      from   mtl_system_items
                     where  organization_id = get_rcv_transaction_rec.to_organization_id
                       and  inventory_item_id = get_rcv_transaction_rec.item_id ;
Line: 4930

		      SELECT    max(mir.revision)
			INTO    l_item_revision
			FROM    mtl_system_items msi
			, mtl_item_revisions mir
			WHERE    msi.inventory_item_id = get_rcv_txn_int_req_rec.item_id
			AND    msi.organization_id = get_rcv_txn_int_req_rec.organization_id
			AND    msi.revision_qty_control_code = 2
			AND    mir.organization_id = msi.organization_id
			AND    msi.inventory_item_id = msi.inventory_item_id
			AND    mir.effectivity_date in
			(SELECT   MAX(mir2.effectivity_date)
			 FROM   mtl_item_revisions mir2
			 WHERE   mir2.organization_id = get_rcv_txn_int_req_rec.organization_id
			 AND   mir2.inventory_item_id = get_rcv_txn_int_req_rec.item_id
			 AND   mir2.effectivity_date <= SYSDATE
			 AND   mir2.implementation_date is not NULL);
Line: 4962

			item revision to inventory so that supply gets updated accordingly.
			*/
			--Bug 5147013: Changed the cursor name to get the
			-- item and org from the correct one.
			BEGIN
			   SELECT msi.revision_qty_control_code
			     INTO l_revision_control_code
			     FROM mtl_system_items_b msi
			     WHERE msi.inventory_item_id = get_rcv_txn_int_req_rec.item_id
                             AND msi.organization_id = get_rcv_txn_int_req_rec.organization_id;
Line: 5000

                    select nvl(lot_control_code,1)
                      into   l_lot_control_code
                      from   mtl_system_items
                     where  organization_id = get_rcv_transaction_rec.to_organization_id
                       and  inventory_item_id = get_rcv_transaction_rec.item_id ;
Line: 5255

			 update_res
			   (p_supply_source_header_id => l_rsv_rec.supply_source_header_id
			    ,p_supply_source_line_id  => l_rsv_rec.supply_source_line_id
			    ,p_supply_source_type_id  => inv_reservation_global.g_source_type_req
			    ,p_primary_reservation_quantity => l_qty_avail_to_reserve
			    ,p_project_id  => get_req_line_po_shipment_rec.project_id
			    ,p_task_id                      => get_req_line_po_shipment_rec.task_id
			    ,p_reservation_id               => l_rsv_rec.reservation_id
			    ,x_msg_count                    => x_msg_count
			    ,x_msg_data                     => x_msg_data
			    ,x_return_status                => l_return_status);
Line: 5340

		    -- delete all the reservations for this shipment
		    -- log message
		    -- Commenting out the delete reservation call.  Call
		    -- reduce reservations instead
		    -- DELETE_RES
		    --   (p_supply_source_header_id  => get_po_shipment_rel_rec.po_header_id
		    -- ,p_supply_source_line_id    => get_po_shipment_rel_rec.line_location_id
		    --,p_supply_source_type_id    => inv_reservation_global.g_source_type_po
		    -- ,x_msg_count                => x_msg_count
		    -- ,x_msg_data                 => x_msg_data
		    -- ,x_return_status            => l_return_status);
Line: 5351

		    -- Call reduce reservations instead of delete
		   -- reservations
		   -- Call the reduce reservations API by setting the
		   -- delete_flag to yes. delete all reservations for that
		   -- supply line.
		   -- calling reduce_reservation API
		    l_delete_flag := 'Y';
Line: 5378

			, p_delete_flag            => l_delete_flag
			, p_sort_by_criteria       => l_sort_by_criteria
			, x_quantity_modified      => l_quantity_modified);
Line: 5490

			    , p_Delete_Flag         => 'N'
			    , p_Sort_By_Criteria    => NULL
			    , x_Quantity_Modified   => l_quantity_modified);
Line: 5547

	        DELETE_RES
		(p_supply_source_header_id  => p_header_id
		 ,p_supply_source_line_id    => get_req_hdr_lines_rec.requisition_line_id
		 ,p_supply_source_type_id    => l_supply_source_type_id
		 ,x_msg_count                => x_msg_count
		 ,x_msg_data                 => x_msg_data
		 ,x_return_status            => l_return_status);
Line: 5558

		 --delete the reservation on the req
		 --
           IF g_debug= C_Debug_Enabled THEN
	      mydebug ('Remove req line supply. req line:'|| p_line_id ,c_api_name,9);
Line: 5565

	      SELECT source_type_code INTO l_source_type_code FROM
		po_requisition_lines_all WHERE requisition_line_id = p_line_id;
Line: 5584

	     DELETE_RES
	     (p_supply_source_line_id   => p_line_id
	      ,p_supply_source_type_id   => l_supply_source_type_id
	      ,x_msg_count               => x_msg_count
	      ,x_msg_data                => x_msg_data
	      ,x_return_status           => l_return_status);
Line: 5594

		 -- If Reservation Exists, then delete them and never transfer back to requistion
		 -- since when PO is cancelled, associated req got
		 -- cancelled too.
	IF g_debug= C_Debug_Enabled THEN
	   mydebug ('Cancel PO supply. Supply header: '|| p_header_id ,c_api_name,9);
Line: 5618

	      l_delete_flag := 'Y';
Line: 5639

		  , p_delete_flag            => l_delete_flag
		  , p_sort_by_criteria       => l_sort_by_criteria
		  , x_quantity_modified      => l_quantity_modified);
Line: 5685

	       --    DELETE_RES (p_supply_source_header_id => l_po_header_id
	       --             ,p_supply_source_line_id   => get_distr_rec.line_location_id
               --           ,p_supply_source_type_id   => inv_reservation_global.g_source_type_po
	       --         ,x_msg_count               => x_msg_count
	       --       ,x_msg_data                => x_msg_data
	       --     ,x_return_status           => l_return_status);
Line: 5695

	       l_delete_flag := 'Y';
Line: 5716

		   , p_delete_flag            => l_delete_flag
		   , p_sort_by_criteria       => l_sort_by_criteria
		   , x_quantity_modified      => l_quantity_modified);
Line: 5761

	--      DELETE_RES (p_supply_source_header_id  => l_po_header_id
	--                 ,p_supply_source_line_id    => get_distr_rec.line_location_id
	--                 ,p_supply_source_type_id    => inv_reservation_global.g_source_type_po--
	--                 ,x_msg_count                => x_msg_count
	----                 ,x_msg_data                 => x_msg_data
	--                 ,x_return_status            => l_return_status);
Line: 5774

	l_delete_flag := 'Y';
Line: 5794

	     , p_delete_flag            => l_delete_flag
	     , p_sort_by_criteria       => l_sort_by_criteria
	     , x_quantity_modified      => l_quantity_modified);
Line: 5834

	  --delete the reservation
	  -- OPEN get_distr_for_po_release(p_header_id);
Line: 5849

	  --reservation should be deleted

	  OPEN get_po_shipment(p_header_id);
Line: 5856

	       --DELETE_RES (p_supply_source_header_id => p_header_id
	       --        ,p_supply_source_line_id   => get_po_shipment_rec.line_location_id
	       --        ,p_supply_source_type_id   => inv_reservation_global.g_source_type_po
	       --           ,x_msg_count               => x_msg_count
	       --           ,x_msg_data                => x_msg_data
	       --           ,x_return_status           => l_return_status);
Line: 5866

	      l_delete_flag := 'Y';
Line: 5887

		  , p_delete_flag            => l_delete_flag
		  , p_sort_by_criteria       => l_sort_by_criteria
		  , x_quantity_modified      => l_quantity_modified);
Line: 5934

	--               DELETE_RES (p_supply_source_header_id  => l_po_header_id
	--                          ,p_supply_source_line_id    => get_distr_rec.line_location_id
	--                          ,p_supply_source_type_id    => inv_reservation_global.g_source_type_po
	--                          ,x_msg_count                => x_msg_count
	--                          ,x_msg_data                 => x_msg_data
	--                          ,x_return_status            => l_return_status);
Line: 5947

	l_delete_flag := 'Y';
Line: 5967

	    , p_delete_flag            => l_delete_flag
	    , p_sort_by_criteria       => l_sort_by_criteria
	    , x_quantity_modified      => l_quantity_modified);
Line: 5994

     ELSIF upper(p_action) = 'UPDATE_SO_QUANTITY' THEN
		 --reduce the reservation on the req by the ordered quantity
	  IF g_debug= C_Debug_Enabled THEN
	     mydebug ('Inside update so qty. req line:'|| p_line_id ,c_api_name,9);
Line: 6004

	     SELECT Nvl(SUM(primary_reservation_quantity),0) INTO
	       l_primary_res_qty FROM mtl_reservations
	       WHERE supply_source_type_id =
	       inv_reservation_global.g_source_type_internal_req AND
	       supply_source_header_id = p_header_id AND
	       supply_source_line_id = p_line_id;
Line: 6022

	      SELECT destination_organization_id, item_id, unit_meas_lookup_code, quantity INTO
		l_organization_id,
		l_inventory_item_id,
		l_req_unit_meas, l_req_qty  FROM
		po_requisition_lines_all WHERE requisition_line_id = p_line_id;
Line: 6035

	      -- delete all reservations for that req line
	      -- calling reduce_reservation API
	      l_delete_flag := 'Y';
Line: 6057

		  , p_delete_flag            => l_delete_flag
		  , p_sort_by_criteria       => l_sort_by_criteria
		  , x_quantity_modified      => l_quantity_modified);
Line: 6107

		  , p_delete_flag            => 'N'
		  , p_sort_by_criteria       => l_sort_by_criteria
		  , x_quantity_modified      => l_quantity_modified);