DBA Data[Home] [Help]

APPS.WMS_DIRECT_SHIP_PVT SQL Statements

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

Line: 99

g_last_update_date DATE;
Line: 100

g_last_updated_by NUMBER;
Line: 101

g_last_update_login NUMBER;
Line: 163

     fnd_msg_pub.delete_msg(p_msg_index=>i);
Line: 164

     debug('Deleted message at position: ' || i,'process_mobile_msg');
Line: 184

      SELECT order_source_id
        INTO l_order_source_id
        FROM oe_order_headers_all
       WHERE header_id = p_order_header_id;
Line: 212

  SELECT         wt.trip_id
                ,wt.name
                ,wt.vehicle_item_id
                ,msi.concatenated_segments
                ,wt.vehicle_num_prefix
                ,wt.vehicle_number
                ,wts.departure_seal_code
                ,WMS_DIRECT_SHIP_PVT.GET_ENFORCE_SHIP
                ,WMS_DIRECT_SHIP_PVT.GET_SHIPMETHOD_MEANING(wt.ship_method_code)
                ,wt.ship_method_code
    FROM  wsh_trips_ob_grp_v wt
        ,wsh_trip_stops_ob_grp_v wts
        ,mtl_system_items_kfv msi
  WHERE wt.trip_id = p_trip_id
  AND   wt.trip_id = wts.trip_id
  AND   (wt.vehicle_item_id = msi.inventory_item_id(+)
          AND      msi.organization_id(+) = p_org_id)
  AND   ROWNUM < 2;
Line: 243

    SELECT wnd.delivery_id
          ,wnd.name
          ,WMS_DIRECT_SHIP_PVT.GET_DELIVERY_LPN(wnd.delivery_id)
          ,nvl(wnd.net_weight, 0)
          ,nvl(wnd.gross_weight, 0)
          ,wnd.weight_uom_code
          ,wnd.waybill
          ,WMS_DIRECT_SHIP_PVT.GET_SHIPMETHOD_MEANING(wnd.ship_method_code)
          ,wnd.ship_method_code
          ,WMS_DIRECT_SHIP_PVT.GET_FOBLOC_CODE_MEANING(wnd.fob_code)
          ,wnd.fob_location_id
          ,WMS_DIRECT_SHIP_PVT.GET_FOB_LOCATION(wnd.fob_location_id)
          ,wnd.freight_terms_code
          ,WMS_DIRECT_SHIP_PVT.GET_FREIGHT_TERM(wnd.freight_terms_code)
          ,WMS_DIRECT_SHIP_PVT.GET_FOB_LOCATION(wnd.INTMED_SHIP_TO_LOCATION_ID)
          ,WMS_DIRECT_SHIP_PVT.GET_BOL(wnd.delivery_id)
          ,nvl(wnd.status_code,'OP')
          ,WMS_DIRECT_SHIP_PVT.GET_ENFORCE_SHIP
          ,wts1.trip_id --2767767
	  ,wnd.fob_code  --Bug#9668537,9668537 and 9399092
FROM wsh_new_deliveries_ob_grp_v wnd,
      -- 2767767
(SELECT wdl.delivery_id,wts.trip_id
        FROM wsh_delivery_legs_ob_grp_v wdl,
             wsh_trip_stops_ob_grp_v wts
        WHERE wdl.delivery_id=p_delivery_id
        AND   wdl.pick_up_stop_id=wts.stop_id
        AND ROWNUM=1) wts1 -- end 2767767
WHERE wnd.delivery_id = p_delivery_id
and   wnd.delivery_id=wts1.delivery_id(+); --2767767
Line: 278

    SELECT wts.trip_id,wt.name
    INTO l_trip_id,l_trip_name
        FROM wsh_delivery_legs_ob_grp_v wdl,
             wsh_trip_stops_ob_grp_v wts,
         wsh_trips_ob_grp_v wt
        WHERE wdl.delivery_id=p_delivery_id
        AND wdl.pick_up_stop_id=wts.stop_id
         AND wt.trip_id=wts.trip_id
        AND ROWNUM=1;
Line: 288

        UPDATE wms_shipping_transaction_temp
        SET trip_id=l_trip_id,trip_name=l_trip_name
        WHERE delivery_id=p_delivery_id and trip_id is null;
Line: 295

    debug('trip_id update on wstt failed','get_delivery_info');
Line: 312

	  SELECT 'Y' INTO l_direct_ship
      FROM  wms_shipping_transaction_temp wstt
      WHERE wstt.outermost_lpn_id = (SELECT wlpn.outermost_lpn_id FROM wms_license_plate_numbers wlpn WHERE wlpn.lpn_id = p_lpn_id)
      and wstt.direct_ship_flag = 'Y'
      and rownum <2;
Line: 344

  SELECT distinct license_plate_number
  FROM  wms_shipping_transaction_temp wstt
       ,wms_license_plate_numbers wlpn
  WHERE wstt.delivery_id = p_delivery_id
  AND   wstt.outermost_lpn_id = wlpn.lpn_id
  AND   wstt.direct_ship_flag = 'Y';
Line: 376

     SELECT meaning
     INTO l_ship_method_meaning
     FROM fnd_lookup_values_vl
     WHERE lookup_type = 'SHIP_METHOD'
     AND   view_application_id = 3
     AND   lookup_code = p_ship_method_code;
Line: 397

     SELECT meaning
         INTO l_fob_loc_meaning
     FROM  ar_lookups
     WHERE lookup_type = 'FOB'
     AND SYSDATE BETWEEN nvl(start_date_active,sysdate) AND nvl(end_date_active,sysdate)
     AND  enabled_flag = 'Y'
     AND  lookup_code = p_fob_code;
Line: 419

    SELECT description
        INTO l_fob_location
        FROM wsh_hr_locations_v
   WHERE location_id = p_fob_location_id;
Line: 438

    SELECT freight_terms
    INTO l_freight_term
    FROM oe_frght_terms_active_v
    WHERE freight_terms_code = p_freight_term_code;
Line: 457

    SELECT wdi.SEQUENCE_NUMBER
    INTO l_BOL
    FROM wsh_document_instances wdi
            ,wsh_delivery_legs_ob_grp_v      wdl
        WHERE wdl.delivery_id = p_delivery_id
        AND   wdi.entity_id   = wdl.delivery_leg_id
        AND   wdi.entity_name = 'WSH_DELIVERY_LEGS'
        AND   rownum < 2;
Line: 537

  SELECT milk.concatenated_segments
       , wstt.outermost_lpn
  FROM mtl_item_locations_kfv milk
      ,wms_shipping_transaction_temp wstt
  WHERE wstt.delivery_id           = p_delivery_id
  AND   wstt.organization_id       = p_org_id
  AND   wstt.dock_appoint_flag     = 'N'
  AND   wstt.direct_ship_flag      = 'Y'
  AND   wstt.dock_door_id          <> p_dock_door_id
  AND   milk.organization_id       = p_org_id
  AND   milk.inventory_location_id =wstt.dock_door_id;
Line: 572

         SELECT name
         INTO l_del_name
         FROM wsh_new_deliveries_ob_grp_v
         WHERE delivery_id =p_delivery_id;
Line: 582

      SELECT 1
      INTO temp_val
      FROM wsh_new_deliveries_ob_grp_v
      WHERE delivery_id = p_delivery_id
      FOR UPDATE NOWAIT;
Line: 710

              SELECT name
                 INTO x_delivery_name
                 FROM wsh_new_deliveries_ob_grp_v
                 WHERE delivery_id = p_delivery_id;
Line: 833

PROCEDURE UPDATE_DELIVERY(
              x_return_status        OUT NOCOPY VARCHAR2
             ,x_msg_count            OUT NOCOPY NUMBER
             ,x_msg_data             OUT NOCOPY VARCHAR2
             ,p_delivery_id             IN  NUMBER
             ,p_net_weight                 IN  NUMBER
             ,p_gross_weight            IN  NUMBER
             ,p_wt_uom_code             IN  VARCHAR2
             ,p_waybill                    IN  VARCHAR2
             ,p_ship_method_code      IN  VARCHAR2
             ,p_fob_code                   IN  VARCHAR2
             ,p_fob_location_id      IN  NUMBER
             ,p_freight_term_code     IN         VARCHAR2
             ,p_freight_term_name     IN  VARCHAR2
             ,p_intmed_shipto_loc_id  IN  NUMBER
                         )IS

l_init_msg_list                  VARCHAR2(1) :=FND_API.G_TRUE;
Line: 870

SELECT  ROWID
        ,FREIGHT_COST_TYPE_ID
        ,CURRENCY_CODE
                  ,FREIGHT_AMOUNT
                  ,CONVERSION_TYPE
        FROM  WMS_FREIGHT_COST_TEMP
        WHERE delivery_id = p_delivery_id
          AND FREIGHT_COST_ID IS NULL
        FOR UPDATE OF FREIGHT_COST_ID;
Line: 884

     SELECT status_code
     INTO l_status_code
     FROM wsh_new_deliveries_ob_grp_v
     WHERE delivery_id = p_delivery_id;
Line: 897

       debug('In Update delivery procedure ','update_Delivery');
Line: 898

       DEBUG('p_delivery_id          : '||p_delivery_id,'update_Delivery');
Line: 899

       DEBUG('p_ship_method_code     : '||p_ship_method_code,'update_Delivery');
Line: 900

       DEBUG('p_FREIGHT_TERM_CODE    : '||p_FREIGHT_TERM_CODE,'update_Delivery');
Line: 901

       DEBUG('p_fob_code             : '||p_fob_code,'update_Delivery');
Line: 902

       DEBUG('p_fob_location_id      : '||p_fob_location_id,'update_Delivery');
Line: 903

       DEBUG('p_waybill              : '||p_waybill,'update_Delivery');
Line: 904

       DEBUG('p_net_weight           : '||p_net_weight,'update_Delivery');
Line: 905

       DEBUG('p_gross_weight         : '||p_gross_weight,'update_Delivery');
Line: 906

       DEBUG('p_wt_uom_code          : '||p_wt_uom_code,'update_Delivery');
Line: 907

       DEBUG('p_intmed_shipto_loc_id : '||p_intmed_shipto_loc_id,'update_Delivery');
Line: 912

          SELECT name
             INTO l_del_name
             FROM wsh_new_deliveries_ob_grp_v
             WHERE delivery_id = p_delivery_id;
Line: 934

  WSH_FREIGHT_COSTS_PUB.Create_Update_Freight_Costs (
                         p_api_version_number     =>1.0
                       , p_init_msg_list          =>l_init_msg_list
                       , p_commit                 => FND_API.G_FALSE
                       , x_return_status          => l_return_status
                       , x_msg_count              => l_msg_count
                       , x_msg_data               => l_msg_data
                       , p_pub_freight_costs      => l_freight_cost_rec
                       , p_action_code            => 'CREATE'
                       , x_freight_cost_id        => l_freight_cost_id
                       );
Line: 953

        debug('Update of Freight Cost for Del is failed ','UPDATE_DELIVERY');
Line: 962

          debug('Update of Freight Cost for Del is succ ','UPDATE_DELIVERY');
Line: 967

  UPDATE WMS_FREIGHT_COST_TEMP
  SET freight_cost_id = l_freight_cost_id,
      last_update_date=  SYSDATE,
      last_updated_by =  FND_GLOBAL.USER_ID
  WHERE rowid = l_row_id;
Line: 996

              SELECT distinct wts.trip_id
              INTO l_trip_id
              FROM wsh_delivery_legs_ob_grp_v wdl,
                   wsh_trip_stops_ob_grp_v wts
              WHERE wdl.delivery_id=p_delivery_id
              AND   wdl.pick_up_stop_id=wts.stop_id
              AND rownum=1;
Line: 1004

                debug('Delivery '||p_delivery_id||' is assigned to trip '||l_trip_id,'Update Delivery');
Line: 1018

                      ||l_trip_id ||' and hence not updating ship method','Update Delivery');
Line: 1030

           WSH_DELIVERIES_PUB.Create_Update_Delivery(
                       p_api_version_number                => 1.0
                      ,p_init_msg_list                     => l_init_msg_list
                      ,x_return_status                     => l_return_status
                      ,x_msg_count                         => l_msg_count
                      ,x_msg_data                          => l_msg_data
                      ,p_action_code                       => 'UPDATE'
                      ,p_delivery_info                     => l_delivery_info
                      ,p_delivery_name                     => l_delivery_name
                      ,x_delivery_id                       => l_delivery_id
                      ,x_name                              => l_name);
Line: 1044

                   debug('Create _Update_Delivery has errored ','UPDATE_DELIVERY');
Line: 1046

                FND_MESSAGE.SET_NAME('WMS','WMS_UPDATE_DELIVERY_FAILED');
Line: 1052

                FND_MESSAGE.SET_NAME('WMS','UPDATE_DELIVERY_FAILED');
Line: 1060

      debug('Update delivery completed successfully');
Line: 1085

         debug('Update of Delivery has failed :Unexpected Error','Update Delivery');
Line: 1098

         debug('Update of Delivery has failed : Unexpected Error '||SQLERRM,'Update_Delivery');
Line: 1103

               debug(SQLCODE,'Update_Delivery');
Line: 1107

END; -- UPDATE_DELIVERY
Line: 1129

       select wnd.name,
              wdd.delivery_detail_id,
              wdd.inventory_item_id,
              wdd.requested_quantity,
              msik.concatenated_segments,
              msik.description
       from wsh_delivery_details_ob_grp_v wdd
           ,wsh_delivery_assignments_v wda
           ,wsh_new_deliveries_ob_grp_v wnd
           ,mtl_system_items_kfv msik
       where wnd.delivery_id = p_delivery_id
       AND   wnd.delivery_id = wda.delivery_id
       AND   wda.delivery_detail_id = wdd.delivery_detail_id
       AND   wdd.lpn_id is null
       AND   wdd.inventory_item_id = msik.inventory_item_id
       AND   wdd.organization_id = msik.organization_id
       AND   ((wda.parent_delivery_detail_id is null
               AND msik.mtl_transactions_enabled_flag <> 'N')
               OR wdd.released_status is null
               OR wdd.released_status NOT IN ('X', 'Y'));
Line: 1161

        open x_missing_item_cur FOR select 1 from dual;
Line: 1233

   select wt.trip_id , wt.carrier_id, wt.ship_method_code, wt.mode_of_transport,
     wt.tp_plan_name -- glog proj
     from wsh_delivery_legs wdl, wsh_trip_stops wts, wsh_trips wt
     where wdl.pick_up_stop_id=wts.stop_id
     and wdl.delivery_id=v_del_id
     and wts.trip_id=wt.trip_id;
Line: 1241

     SELECT status_code,NAME,ignore_for_planning, tms_interface_flag
       FROM wsh_new_deliveries_ob_grp_v
       WHERE delivery_id = p_delivery_id;
Line: 1294

     WMS_DIRECT_SHIP_PVT.UPDATE_DELIVERY(
              x_return_status          => l_return_status
              ,x_msg_count             => l_msg_count
              ,x_msg_data              => l_msg_data
              ,p_delivery_id             => p_delivery_id
              ,p_net_weight              => p_net_weight
              ,p_gross_weight            => p_gross_weight
              ,p_wt_uom_code             => p_wt_uom_code
              ,p_waybill                         => p_waybill
              ,p_ship_method_code      => p_ship_method_code
              ,p_fob_code                   => p_fob_code
              ,p_fob_location_id              => p_fob_location_id
              ,p_freight_term_code     => p_freight_term_code
              ,p_freight_term_name     => p_freight_term_name
              ,p_intmed_shipto_loc_id  => p_intmed_shipto_loc_id
              );
Line: 1312

	   DEBUG('Update Delivery API failed with status E ','SHIP_CONFIRM');
Line: 1317

	   DEBUG('Update Delivery API failed with status U','SHIP_CONFIRM');
Line: 1363

  /* Note: We do not need this update to ignore for planning here again becs things are taken care of during
  the stage_lpn() API. At this time, we will always have the delivery - either existing or created in stage_LPN()
    there is no check on exception severity in stage_lpn().

  -- Glog Changes
  IF WSH_UTIL_CORE.GC3_IS_INSTALLED = 'Y' AND nvl(l_ignore_for_planning, 'N') = 'N' THEN

     l_otm_trip_id  := 0;
Line: 1541

           l_msg_table.delete;
Line: 1632

  SELECT DISTINCT WSTT.delivery_id
  FROM WMS_SHIPPING_TRANSACTION_TEMP wstt
      ,WSH_NEW_DELIVERIES_OB_GRP_V WND
  WHERE wstt.organization_id = p_org_id
  AND   wstt.dock_door_id = p_dock_door_id
  AND   wstt.dock_appoint_flag = 'N'
  AND   nvl(wstt.direct_ship_flag,'N') = 'Y'
  AND   wstt.delivery_id = wnd.delivery_id
  AND   wnd.status_code = 'OP';
Line: 1644

    SELECT DELIVERY_ID FROM WMS_SHIPPING_TRANSACTION_TEMP
    WHERE DELIVERY_ID IS NOT NULL
    AND TRIP_ID IS NULL
    AND ORGANIZATION_ID=P_ORG_ID
    AND DOCK_DOOR_ID=P_DOCK_DOOR_ID
    AND NVL(DIRECT_SHIP_FLAG,'N')='Y';
Line: 1688

    WMS_DIRECT_SHIP_PVT.UPDATE_DELIVERY(
              x_return_status        => l_return_status
              ,x_msg_count           => l_msg_count
              ,x_msg_data            => l_msg_data
              ,p_delivery_id                     => p_delivery_id
              ,p_net_weight                      => p_net_weight
              ,p_gross_weight               => p_gross_weight
              ,p_wt_uom_code                     => p_wt_uom_code
              ,p_waybill                                 => p_waybill
              ,p_ship_method_code        => p_ship_method_code
              ,p_fob_code                      => p_fob_code
              ,p_fob_location_id                 => p_fob_location_id
              ,p_freight_term_code   => p_freight_term_code
              ,p_freight_term_name   => p_freight_term_name
              ,p_intmed_shipto_loc_id => p_intmed_shipto_loc_id
              );
Line: 1705

       debug('Return Status from Update_Delivery: '||l_return_status, ' Confirm_All_Deliveries');
Line: 1709

                 debug('Update Delivery API failed with status E ','Confirm_All_deliveries');
Line: 1714

                 debug('Update Delivery API failed with status U','Confirm_All_Deliveries');
Line: 1726

         SELECT wts.trip_id,wt.name
         INTO l_trip_id,l_trip_name
         FROM wsh_delivery_legs_ob_grp_v wdl,
              wsh_trip_stops_ob_grp_v wts,
              wsh_trips_ob_grp_v wt
        WHERE wdl.delivery_id=l_deliveries.delivery_id
        AND   wdl.pick_up_stop_id=wts.stop_id
        AND   wt.trip_id=wts.trip_id
        AND  ROWNUM=1;
Line: 1736

            UPDATE wms_shipping_transaction_temp
            SET trip_id=l_trip_id,trip_name=l_trip_name
            WHERE delivery_id=l_deliveries.delivery_id AND trip_id IS NULL;
Line: 1742

        debug('trip_id update on wstt failed','CONFIRM_ALL_DELIVERIES');
Line: 1747

         debug('trip_id update on wstt failed','CONFIRM_ALL_DELIVERIES');
Line: 1902

         SELECT wts.trip_id
         INTO l_trip_id
         FROM wsh_delivery_legs_ob_grp_v wdl, wsh_trip_stops_ob_grp_v wts
         WHERE wdl.delivery_id = p_delivery_id --l_delivery_id /* bug 2741857 */
           and wdl.pick_up_stop_id = wts.stop_id;
Line: 1909

           UPDATE wms_shipping_transaction_temp
            SET    trip_id = l_trip_id,
                   last_update_date =  SYSDATE,
                   last_updated_by  =  FND_GLOBAL.USER_ID
            WHERE  delivery_id = p_delivery_id;--l_delivery_id; /* bug 2741857 */
Line: 1929

     SELECT wt.trip_id
     INTO l_chk_trip_id
     FROM WMS_SHIPPING_TRANSACTION_TEMP wstt
         ,WSH_TRIPS_OB_GRP_V wt
     WHERE
          wt.trip_id = wstt.trip_id
      AND  organization_id    = p_organization_id
      AND status_code         = 'OP'
      AND dock_door_id       = p_dock_door_id
      AND dock_appoint_flag  = 'N'
       AND nvl(direct_ship_flag,'N') = 'Y'
           AND nvl(planned_flag,'N') = 'N'  -- bug 7211509, 7216163. If there are prev unplanned trips available, we shoud utilize it
           AND ROWNUM =1;
Line: 1965

               debug('UPDATE WSTT with the trip_id assigned','CREATE_TRIP');
Line: 1967

               UPDATE WMS_SHIPPING_TRANSACTION_TEMP
               SET trip_id   = l_chk_trip_id
               WHERE delivery_id = l_del_tab(i);
Line: 1991

            debug('UPDATE WSTT with the trip created','CREATE_TRIP');
Line: 1994

            UPDATE WMS_SHIPPING_TRANSACTION_TEMP
            SET trip_id   = l_trip_id
            WHERE delivery_id = l_del_tab(k);
Line: 2023

           debug('UPDATE WSTT with the trip for failed assignments','CREATE_TRIP');
Line: 2027

           UPDATE WMS_SHIPPING_TRANSACTION_TEMP
           SET trip_id   = l_trip_id
           WHERE delivery_id = l_auto_trip_del(j);
Line: 2075

PROCEDURE UPDATE_TRIPSTOP(
              x_return_status        OUT NOCOPY VARCHAR2
              ,x_msg_count            OUT NOCOPY NUMBER
              ,x_msg_data             OUT NOCOPY VARCHAR2
              ,p_trip_id              IN  NUMBER
              ,p_vehicle_item_id      IN  NUMBER
              ,p_vehicle_num_prefix   IN  VARCHAR2
              ,p_vehicle_num          IN  VARCHAR2
              ,p_seal_code            IN  VARCHAR2
              ,p_org_id               IN  NUMBER   DEFAULT NULL
              ,p_dock_door_id         IN  NUMBER   DEFAULT NULL
              ,p_ship_method_code     IN VARCHAR2 DEFAULT NULL)
 IS

l_init_msg_list                VARCHAR2(1) :=FND_API.G_TRUE;
Line: 2109

   SELECT  ROWID
          ,FREIGHT_COST_TYPE_ID
          ,CURRENCY_CODE
          ,FREIGHT_AMOUNT
          ,CONVERSION_TYPE
   FROM  WMS_FREIGHT_COST_TEMP
   WHERE TRIP_ID = p_trip_id
   AND   FREIGHT_COST_ID IS NULL
   FOR UPDATE OF FREIGHT_COST_ID NOWAIT;
Line: 2120

 SELECT 'x'
 FROM   wsh_trip_stops_ob_grp_v
 WHERE  trip_id = p_trip_id
 FOR UPDATE  NOWAIT;
Line: 2126

 SELECT 'x'
 FROM   wsh_trips_ob_grp_v
 WHERE trip_id = p_trip_id
 FOR UPDATE NOWAIT;
Line: 2134

      debug('Begin UPDATE_TRIPSTOP ','UPDATE_TRIPSTOP');
Line: 2135

      debug('p_trip_id            : ' || p_trip_id              , 'UPDATE_TRIPSTOP');
Line: 2136

      debug('p_vehicle_item_id    : ' || p_vehicle_item_id      , 'UPDATE_TRIPSTOP');
Line: 2137

      debug('p_vehicle_num_prefix : ' || p_vehicle_num_prefix   , 'UPDATE_TRIPSTOP');
Line: 2138

      debug('p_vehicle_num        : ' || p_vehicle_num          , 'UPDATE_TRIPSTOP');
Line: 2139

      debug('p_seal_code          : ' || p_seal_code            , 'UPDATE_TRIPSTOP');
Line: 2140

      debug('p_org_id             : ' || p_org_id               , 'UPDATE_TRIPSTOP');
Line: 2141

      debug('p_dock_door_id       : ' || p_dock_door_id         , 'UPDATE_TRIPSTOP');
Line: 2142

      debug('p_ship_method_code   : ' || p_ship_method_code     , 'UPDATE_TRIPSTOP');
Line: 2159

      debug('In the procedure update trip_stop','trip_Stop');
Line: 2163

     debug('Update Trip Ship method:'||p_ship_method_code,'Update_tripstop');
Line: 2176

     debug('Update Trip No Trip Id is passed','Update_tripstop');
Line: 2181

      SELECT name
         INTO l_name
         FROM wsh_trips_ob_grp_v
       WHERE trip_id=l_trip_id;
Line: 2205

  WSH_FREIGHT_COSTS_PUB.Create_Update_Freight_Costs
    (p_api_version_number     =>1.0
     , p_init_msg_list          =>l_init_msg_list
     , p_commit                 => FND_API.G_FALSE
     , x_return_status          => l_return_status
     , x_msg_count                      => l_msg_count
     , x_msg_data               => l_msg_DATA
     , p_pub_freight_costs      => l_freight_cost_rec
     , p_action_code            => 'CREATE'
     , x_freight_cost_id        => l_freight_cost_id
     );
Line: 2224

    debug('Create_Update Freight Cost API failed with status E ','Update Trip Stop');
Line: 2231

    debug('Update Freight Cost failed with status U','Update TripStop');
Line: 2237

  UPDATE WMS_FREIGHT_COST_TEMP
  SET freight_cost_id   = l_freight_cost_id
      ,last_update_date  =  SYSDATE
      ,last_updated_by   =  FND_GLOBAL.USER_ID
  WHERE rowid = l_row_id;
Line: 2250

         SELECT stop_id
         INTO   l_stop_id
         FROM   WSH_TRIP_STOPS_OB_GRP_V wts, WSH_DELIVERY_LEGS_OB_GRP_V wdl
        -- WHERE  wts.trip_id = p_trip_id
            WHERE wts.trip_id=l_trip_id
         AND    wts.stop_id = wdl.pick_up_stop_id
       AND ROWNUM <2;
Line: 2263

         debug('Call WSH_TRIP_STOPS_PUB.Create_Update_Stop to Update the Seal Code','Update Trip Stop');
Line: 2268

      WSH_TRIP_STOPS_PUB.Create_Update_Stop(
                         p_api_version_number           => 1.0
                        ,p_init_msg_list            => l_init_msg_list
                        ,x_return_status            => l_return_status
                        ,x_msg_count                => l_msg_count
                        ,x_msg_data                 => l_msg_data
                        ,p_action_code              => 'UPDATE'
                        ,p_stop_info                => l_stop_info
                        ,p_trip_id                  => l_trip_id
                        ,x_stop_id                  => l_stop_id);
Line: 2285

               debug('Create_Update_Stop API failed with status E ','Update Trip Stop');
Line: 2294

               debug('Create_Update_Stop failed with status U','Update TripStop');
Line: 2299

  END IF; -- Update Stop
Line: 2304

       debug('Update Trip also ','Update_Trip_Stop');
Line: 2311

 p_trip_info.last_update_date           := SYSDATE;
Line: 2312

 p_trip_info.last_updated_by            :=FND_GLOBAL.USER_ID;
Line: 2313

 p_trip_info.last_update_login          := FND_GLOBAL.USER_ID;
Line: 2317

    debug('Call to Create_update_Trip','Update_Trip_Stop');
Line: 2320

          WSH_TRIPS_PUB.Create_Update_Trip  (
                        p_api_version_number  => 1.0
                       ,p_init_msg_list       => l_init_msg_list
                       ,x_return_status       => l_return_status
                       ,x_msg_count           => l_msg_count
                       ,x_msg_data            => l_msg_data
                       ,p_action_code         => 'UPDATE'
                       ,p_trip_info           => p_trip_info
                       ,x_trip_id             => l_trip_id
                       ,x_trip_name           => l_trip_name);
Line: 2332

               debug('Create_Update_Trip API failed with status E ','Update Trip Stop');
Line: 2337

               debug('Create_Update_Trip failed with status U','Update TripStop');
Line: 2350

         debug('In exception (E) ','Update_Trip_Stop');
Line: 2364

         debug('Update of Trip Stop has failed :Unexpected Error','Update_Trip_Stop');
Line: 2379

         debug('Update of Trip has failed : Unexpected Error '||SQLERRM,'Update_trip_Stop');
Line: 2386

               debug(SQLCODE,'Update_Trip_Stop');
Line: 2407

    SELECT wdl.pick_up_stop_id pick_up_stop_id
      FROM wsh_delivery_legs_ob_grp_v wdl, wsh_trip_stops_ob_grp_v wts
     WHERE wts.trip_id = p_trip_id
       AND wdl.pick_up_stop_id = wts.stop_id;
Line: 2413

    SELECT delivery_id
      FROM wsh_delivery_legs_ob_grp_v wdl, wsh_trip_stops_ob_grp_v wts
     WHERE wts.trip_id = p_trip_id
       AND wdl.pick_up_stop_id = wts.stop_id;
Line: 2451

  wms_direct_ship_pvt.update_tripstop(
    x_return_status              => l_return_status
  , x_msg_count                  => l_msg_count
  , x_msg_data                   => l_msg_data
  , p_trip_id                    => p_trip_id
  , p_vehicle_item_id            => p_vehicle_item_id
  , p_vehicle_num_prefix         => p_vehicle_num_prefix
  , p_vehicle_num                => p_vehicle_num
  , p_seal_code                  => p_seal_code
  , p_org_id                     => p_org_id
  , p_dock_door_id               => p_dock_door_id
  , p_ship_method_code           => p_ship_method_code
  );
Line: 2467

      DEBUG('Update tripstop API failed with status E ', 'Print_shipping_dcouments');
Line: 2473

      DEBUG('Update tripstop API failed with status U ', 'Print_shipping_dcouments');
Line: 2487

      SELECT delivery_report_set_id
        INTO l_report_set_id
        FROM wsh_shipping_parameters
       WHERE organization_id = p_org_id
         AND ROWNUM < 2;
Line: 2556

        fnd_msg_pub.delete_msg(i);
Line: 2653

    SELECT DISTINCT milk.concatenated_segments
                  , wstt.outermost_lpn
               FROM mtl_item_locations_kfv milk, wms_shipping_transaction_temp wstt
              WHERE wstt.trip_id = p_trip_id
                AND wstt.organization_id = p_org_id
                AND wstt.dock_appoint_flag = 'N'
                AND wstt.direct_ship_flag = 'Y'
                AND wstt.dock_door_id <> p_dock_door_id
                AND milk.organization_id = p_org_id
                AND milk.inventory_location_id = wstt.dock_door_id;
Line: 2665

    SELECT DISTINCT wstt.trip_id
               FROM wms_shipping_transaction_temp wstt, wsh_trips_ob_grp_v wt
              WHERE wstt.organization_id = p_org_id
                AND wstt.dock_door_id = p_dock_door_id
                AND wt.trip_id = wstt.trip_id
                AND wt.status_code IN('CL', 'IT');
Line: 2673

    SELECT DISTINCT wstt.delivery_id
               FROM wms_shipping_transaction_temp wstt
              WHERE wstt.organization_id = p_org_id
                AND wstt.dock_door_id = p_dock_door_id
                AND wstt.trip_id = p_trip_id;
Line: 2714

      SELECT NAME
        INTO l_name
        FROM wsh_trips_ob_grp_v
       WHERE trip_id = p_trip_id;
Line: 2786

      SELECT NAME
        INTO l_trip_name
        FROM wsh_trips_ob_grp_v
       WHERE trip_id = p_trip_id;
Line: 2819

  SELECT stop_id
    INTO l_stop_id
    FROM wsh_trip_stops_ob_grp_v wts, wsh_delivery_legs_ob_grp_v wdl
   WHERE wts.trip_id = p_trip_id
     AND wts.stop_id = wdl.pick_up_stop_id
     AND ROWNUM < 2;
Line: 2872

  SELECT stop_id
    INTO l_stop_id
    FROM wsh_trip_stops_ob_grp_v wts, wsh_delivery_legs_ob_grp_v wdl
   WHERE wts.trip_id = p_trip_id
     AND wts.stop_id = wdl.drop_off_stop_id
     AND ROWNUM < 2;
Line: 3059

    SELECT     delivery_detail_id
          FROM wsh_delivery_assignments_v
    START WITH delivery_detail_id = l_outermost_dd_id
    CONNECT BY PRIOR delivery_detail_id = parent_delivery_detail_id;
Line: 3065

    SELECT   wdd.delivery_detail_id
           , wdd.inventory_item_id
           , wdd.serial_number
           , wdd.source_line_id
           , wdd.requested_quantity
           , wdd.transaction_temp_id
        FROM wsh_delivery_details_ob_grp_v wdd
       WHERE wdd.organization_id = p_org_id
         AND wdd.container_flag <> 'Y'
         AND wdd.delivery_detail_id = p_delivery_detail_id
    ORDER BY wdd.source_line_id;
Line: 3078

     SELECT lpn_id
     FROM wms_license_plate_numbers wlpn
     WHERE wlpn.outermost_lpn_id = p_outermost_lpn_id;
Line: 3131

    select lpn_id, organization_id
    from wms_license_plate_numbers
    where outermost_lpn_id = p_outermost_lpn_id;
Line: 3149

     SELECT wdd.delivery_detail_id, wfc.freight_cost_id
       INTO l_freight_costs.delivery_detail_id,
       l_freight_costs.freight_cost_id
       FROM wsh_delivery_details_ob_grp_v wdd,
       wsh_freight_costs wfc
       WHERE wdd.lpn_id = p_outermost_lpn_id
       AND wdd.released_status = 'X'  -- For LPN reuse ER : 6845650
       AND wdd.delivery_detail_id = wfc.delivery_detail_id;
Line: 3159

    debug('About to call wsh_freight_costs_pub.delete_freight_costs','UNLOAD_TRUCK');
Line: 3163

     wsh_freight_costs_pub.delete_freight_costs
       (p_api_version_number  => 1.0,
         p_init_msg_list       => l_init_msg_list,
         p_commit              => fnd_api.g_false,
         x_return_status       => l_return_status,
         x_msg_count           => l_msg_count,
         x_msg_data            => l_msg_data,
         p_pub_freight_costs   => l_freight_costs);
Line: 3181

    SELECT wstt.delivery_id
         , wnd.status_code
      INTO l_del_id
         , l_status_code
      FROM wms_shipping_transaction_temp wstt, wsh_new_deliveries_ob_grp_v wnd
     WHERE wstt.outermost_lpn_id = p_outermost_lpn_id
       AND wstt.direct_ship_flag = 'Y'
       AND wstt.delivery_id = wnd.delivery_id
       AND ROWNUM = 1;
Line: 3239

  SELECT wdd.delivery_detail_id
    INTO l_outermost_dd_id
    FROM wsh_delivery_details_ob_grp_v wdd
   WHERE lpn_id = p_outermost_lpn_id
   AND released_status = 'X';  -- For LPN reuse ER : 6845650
Line: 3296

      SELECT serial_number_control_code,
             lot_control_code,
             lot_divisible_flag
        INTO l_serial_ctrl_code,
             l_lot_ctrl_code,
             l_lot_divisible_flag
        FROM mtl_system_items
       WHERE inventory_item_id = l_item_id
         AND organization_id = p_org_id;
Line: 3315

          UPDATE mtl_serial_numbers
             SET current_status = 3
               , group_mark_id = NULL -- -1
           WHERE inventory_item_id = l_item_id
             AND current_organization_id = p_org_id
             AND(serial_number = l_serial_number
                 OR group_mark_id = l_transaction_temp_id); --bug#2829514
Line: 3333

          UPDATE mtl_serial_numbers
             SET current_status = 1
               , group_mark_id = NULL -- -1
           WHERE inventory_item_id = l_item_id
             AND current_organization_id = p_org_id
             AND(serial_number = l_serial_number
                 OR group_mark_id = l_transaction_temp_id); --bug#2829514
Line: 3424

        DEBUG('Update LPN Context to Reside in inventory', 'Unload_truck');
Line: 3436

       to update the context and remove the WDD records
       associated with those LPNs  */
  l_lpn_tbl.delete;
Line: 3559

    SELECT DISTINCT outermost_lpn_id
               FROM wms_shipping_transaction_temp
              WHERE organization_id = p_org_id
                AND trip_id = p_trip_id;
Line: 3565

    SELECT DISTINCT delivery_id
               FROM wms_shipping_transaction_temp
              WHERE organization_id = p_org_id
                AND trip_id = p_trip_id;
Line: 3581

        DELETE FROM wms_freight_cost_temp
              WHERE organization_id = p_org_id
                AND lpn_id = l_outermost_lpn_id;
Line: 3585

        DELETE FROM mtl_serial_numbers_temp
              WHERE transaction_temp_id IN(SELECT transaction_temp_id
                                             FROM wms_direct_ship_temp
                                            WHERE lpn_id = p_outermost_lpn_id);
Line: 3590

        DELETE FROM wms_direct_ship_temp
              WHERE organization_id = p_org_id
                --AND    lpn_id = p_outermost_lpn_id;
Line: 3600

        DELETE FROM wms_freight_cost_temp
              WHERE organization_id = p_org_id
                AND delivery_id = l_delivery.delivery_id;
Line: 3606

      DELETE FROM wms_freight_cost_temp
            WHERE organization_id = p_org_id
              AND trip_id = p_trip_id;
Line: 3610

      DELETE FROM wms_shipping_transaction_temp
            WHERE organization_id = p_org_id
              AND trip_id = p_trip_id;
Line: 3615

        DEBUG('Deleted temp recs for the case when trip id is not passed', 'CLEANUP_TEMP_RECS');
Line: 3623

    DELETE FROM wms_shipping_transaction_temp
          WHERE organization_id = p_org_id
            AND outermost_lpn_id = p_outermost_lpn_id;
Line: 3627

    DELETE FROM wms_freight_cost_temp
          WHERE lpn_id = p_outermost_lpn_id;
Line: 3632

      DELETE FROM mtl_serial_numbers_temp
            WHERE transaction_temp_id IN(SELECT transaction_temp_id
                                           FROM wms_direct_ship_temp
                                          WHERE lpn_id = p_outermost_lpn_id);
Line: 3641

    DELETE FROM wms_direct_ship_temp
          WHERE lpn_id = p_outermost_lpn_id;
Line: 3645

      DEBUG('Deleted temp recs for the case when trip id is not passed', 'CLEANUP_TEMP_RECS');
Line: 3714

    SELECT wlpn.lpn_id
         , wlpn.subinventory_code
         , wlpn.locator_id
         , wlc.lot_number
         , wlc.inventory_item_id
         , msn.serial_number
      FROM wms_lpn_contents wlc, wms_license_plate_numbers wlpn, mtl_serial_numbers msn
     WHERE wlpn.lpn_id = wlc.parent_lpn_id
       AND msn.lpn_id(+) = wlc.parent_lpn_id
       AND msn.inventory_item_id(+) = wlc.inventory_item_id
       AND msn.current_organization_id(+) = wlc.organization_id
       /* Bug# 3119461 Without the following joins for lot and rev
       ** we would get a cartesian product */
       AND NVL(msn.lot_number(+),'#NULL#') = NVL(wlc.lot_number,'#NULL#')
       AND NVL(msn.revision(+),'#NULL#') = NVL(wlc.revision,'#NULL#')
       AND wlpn.outermost_lpn_id = p_lpn_id
       AND wlpn.organization_id = p_org_id
       AND wlc.organization_id = p_org_id;
Line: 3743

  SELECT NVL(status_control_flag,2)
    INTO l_trx_status_enabled
    FROM mtl_transaction_types
   WHERE transaction_type_id = p_trx_type_id;
Line: 3796

PROCEDURE update_freight_cost(
  x_return_status OUT NOCOPY    VARCHAR2
, x_msg_count     OUT NOCOPY    NUMBER
, x_msg_data      OUT NOCOPY    VARCHAR2
, p_lpn_id        IN            NUMBER
) IS
  CURSOR lpn_freight IS
    SELECT        ROWID
                , freight_cost_type_id
                , currency_code
                , freight_amount
                , conversion_type
             FROM wms_freight_cost_temp
            WHERE lpn_id = p_lpn_id
              AND freight_cost_id IS NULL
    FOR UPDATE OF freight_cost_id;
Line: 3814

    SELECT wdd.delivery_detail_id
      FROM wsh_delivery_details_ob_grp_v wdd
     WHERE lpn_id = p_lpn_id
     AND released_status = 'X';  -- For LPN reuse ER : 6845650
Line: 3850

    wsh_freight_costs_pub.create_update_freight_costs(
      p_api_version_number         => 1.0
    , p_init_msg_list              => l_init_msg_list
    , p_commit                     => fnd_api.g_false
    , x_return_status              => l_return_status
    , x_msg_count                  => l_msg_count
    , x_msg_data                   => l_msg_data
    , p_pub_freight_costs          => l_freight_cost_rec
    , p_action_code                => 'CREATE'
    , x_freight_cost_id            => l_freight_cost_id
    );
Line: 3864

        DEBUG('Create_Update_Freight_Costs API completed status E ', 'update_freight_cost');
Line: 3870

        DEBUG('Create_Update_Freight_Costs API completed status U ', 'update_freight_cost');
Line: 3876

    UPDATE wms_freight_cost_temp
       SET freight_cost_id = l_freight_cost_id
         , last_update_date = SYSDATE
         , last_updated_by = fnd_global.user_id
     WHERE ROWID = l_lpn_freight.ROWID;
Line: 3886

    DEBUG('Update_Freight cost Update was successful', 'update_freight_cost');
Line: 3891

      DEBUG('Update_Freight cost API failed with status (E)', 'update_freight_cost');
Line: 3917

      DEBUG('Update_Freight cost API failed with status (U)', 'update_freight_cost');
Line: 3934

      DEBUG('Update_Freight cost API failed with status (U)', 'update_freight_cost');
Line: 3940

      fnd_msg_pub.add_exc_msg('WMS_DIRECT_SHIP_PVT', 'update_freight_cost');
Line: 3944

END update_freight_cost;
Line: 3952

* MSNT and inserted into MSN with appropriate values copied from
* MSNT. When delivery lines are split transaction temp ids are changed
* and appropriately updated into MSNT and into MSN as group mark id.
******************************/
PROCEDURE explode_delivery_details(
  x_return_status              OUT NOCOPY    VARCHAR2
, x_msg_count                  OUT NOCOPY    NUMBER
, x_msg_data                   OUT NOCOPY    VARCHAR2
--Bug No 3390432
, x_transaction_temp_id        OUT NOCOPY    NUMBER
, p_organization_id            IN            NUMBER
, p_lpn_id                     IN            NUMBER
, p_serial_number_control_code IN            NUMBER
, p_delivery_detail_id         IN            NUMBER
, p_quantity                   IN            NUMBER
, p_transaction_temp_id        IN            NUMBER DEFAULT NULL
, p_reservation_id             IN            NUMBER DEFAULT NULL
, p_last_action                IN            VARCHAR2 DEFAULT 'U'
) IS
  l_running_quantity       NUMBER;
Line: 3980

    SELECT msnt.ROWID
         , dd.requested_quantity
         , msnt.transaction_temp_id
         , dd.delivery_detail_id
         , msnt.fm_serial_number
         , msnt.to_serial_number
         , msnt.serial_prefix
         , dd.organization_id
         , dd.inventory_item_id
         , msnt.serial_attribute_category
         , msnt.origination_date
         , msnt.c_attribute1
         , msnt.c_attribute2
         , msnt.c_attribute3
         , msnt.c_attribute4
         , msnt.c_attribute5
         , msnt.c_attribute6
         , msnt.c_attribute7
         , msnt.c_attribute8
         , msnt.c_attribute9
         , msnt.c_attribute10
         , msnt.c_attribute11
         , msnt.c_attribute12
         , msnt.c_attribute13
         , msnt.c_attribute14
         , msnt.c_attribute15
         , msnt.c_attribute16
         , msnt.c_attribute17
         , msnt.c_attribute18
         , msnt.c_attribute19
         , msnt.c_attribute20
         , msnt.d_attribute1
         , msnt.d_attribute2
         , msnt.d_attribute3
         , msnt.d_attribute4
         , msnt.d_attribute5
         , msnt.d_attribute6
         , msnt.d_attribute7
         , msnt.d_attribute8
         , msnt.d_attribute9
         , msnt.d_attribute10
         , msnt.n_attribute1
         , msnt.n_attribute2
         , msnt.n_attribute3
         , msnt.n_attribute4
         , msnt.n_attribute5
         , msnt.n_attribute6
         , msnt.n_attribute7
         , msnt.n_attribute8
         , msnt.n_attribute9
         , msnt.n_attribute10
         , msnt.status_id
         , msnt.territory_code
         , msnt.time_since_new
         , msnt.cycles_since_new
         , msnt.time_since_overhaul
         , msnt.cycles_since_overhaul
         , msnt.time_since_repair
         , msnt.cycles_since_repair
         , msnt.time_since_visit
         , msnt.cycles_since_visit
         , msnt.time_since_mark
         , msnt.cycles_since_mark
         , msnt.number_of_repairs
      FROM wsh_delivery_details_ob_grp_v dd
         , mtl_serial_numbers_temp msnt
     WHERE delivery_detail_id = p_delivery_detail_id
       AND msnt.transaction_temp_id = p_transaction_temp_id;
Line: 4059

    SELECT serial_number
      FROM mtl_serial_numbers
     WHERE current_organization_id = p_organization_id
       AND inventory_item_id = p_inventory_item_id
       AND serial_number BETWEEN p_fm_serial_number AND p_to_serial_number
       AND current_status IN(1, 6)
       AND LENGTH(serial_number) = p_serial_length;
Line: 4070

    SELECT serial_number,
           group_mark_id,
           reservation_id
      FROM mtl_serial_numbers a
     WHERE current_organization_id = p_organization_id
       AND inventory_item_id = p_inventory_item_id
       AND lpn_id = p_lpn_id
       AND current_status = 3
       AND (   NVL(group_mark_id, 0) < 1
           OR (NVL(group_mark_id, 0) = p_reservation_id)
           OR (reservation_id = p_reservation_id))
       ORDER BY  a.reservation_id
               , a.serial_number;
Line: 4096

    SELECT serial_number,
           group_mark_id,
           reservation_id
      FROM mtl_serial_numbers a
     WHERE current_organization_id = p_organization_id
       AND inventory_item_id = p_inventory_item_id
       AND lpn_id = p_lpn_id
       AND current_status = 3
       AND NVL(end_item_unit_number, '@@') = NVL(p_eiun, '@@')
       AND (   NVL(group_mark_id, 0) < 1
           OR (NVL(group_mark_id, 0) = p_reservation_id)
           OR (reservation_id = p_reservation_id))
       ORDER BY  a.reservation_id
               , a.serial_number;
Line: 4160

  SELECT SUM(wdd2.requested_quantity)
    INTO l_tot_line_qty
    FROM wsh_delivery_details_ob_grp_v wdd1
       , wsh_delivery_details_ob_grp_v wdd2
   WHERE wdd1.delivery_detail_id = p_delivery_detail_id
     AND wdd2.source_header_id = wdd1.source_header_id
     AND wdd2.source_line_id = wdd1.source_line_id
     AND wdd2.source_code = wdd1.source_code
     AND wdd2.released_status IN('R', 'B', 'X')
     AND wdd2.container_flag = 'N';
Line: 4208

    SELECT mtl_material_transactions_s.NEXTVAL
      INTO x_transaction_temp_id
      FROM DUAL;
Line: 4233

        UPDATE mtl_serial_numbers
           SET serial_attribute_category = l_explode_detail.serial_attribute_category
             , origination_date = l_explode_detail.origination_date
             , c_attribute1 = l_explode_detail.c_attribute1
             , c_attribute2 = l_explode_detail.c_attribute2
             , c_attribute3 = l_explode_detail.c_attribute3
             , c_attribute4 = l_explode_detail.c_attribute4
             , c_attribute5 = l_explode_detail.c_attribute5
             , c_attribute6 = l_explode_detail.c_attribute6
             , c_attribute7 = l_explode_detail.c_attribute7
             , c_attribute8 = l_explode_detail.c_attribute8
             , c_attribute9 = l_explode_detail.c_attribute9
             , c_attribute10 = l_explode_detail.c_attribute10
             , c_attribute11 = l_explode_detail.c_attribute11
             , c_attribute12 = l_explode_detail.c_attribute12
             , c_attribute13 = l_explode_detail.c_attribute13
             , c_attribute14 = l_explode_detail.c_attribute14
             , c_attribute15 = l_explode_detail.c_attribute15
             , c_attribute16 = l_explode_detail.c_attribute16
             , c_attribute17 = l_explode_detail.c_attribute17
             , c_attribute18 = l_explode_detail.c_attribute18
             , c_attribute19 = l_explode_detail.c_attribute19
             , c_attribute20 = l_explode_detail.c_attribute20
             , d_attribute1 = l_explode_detail.d_attribute1
             , d_attribute2 = l_explode_detail.d_attribute2
             , d_attribute3 = l_explode_detail.d_attribute3
             , d_attribute4 = l_explode_detail.d_attribute4
             , d_attribute5 = l_explode_detail.d_attribute5
             , d_attribute6 = l_explode_detail.d_attribute6
             , d_attribute7 = l_explode_detail.d_attribute7
             , d_attribute8 = l_explode_detail.d_attribute8
             , d_attribute9 = l_explode_detail.d_attribute9
             , d_attribute10 = l_explode_detail.d_attribute10
             , n_attribute1 = l_explode_detail.n_attribute1
             , n_attribute2 = l_explode_detail.n_attribute2
             , n_attribute3 = l_explode_detail.n_attribute3
             , n_attribute4 = l_explode_detail.n_attribute4
             , n_attribute5 = l_explode_detail.n_attribute5
             , n_attribute6 = l_explode_detail.n_attribute6
             , n_attribute7 = l_explode_detail.n_attribute7
             , n_attribute8 = l_explode_detail.n_attribute8
             , n_attribute9 = l_explode_detail.n_attribute9
             , n_attribute10 = l_explode_detail.n_attribute10
             , status_id = l_explode_detail.status_id
             , territory_code = l_explode_detail.territory_code
             , time_since_new = l_explode_detail.time_since_new
             , cycles_since_new = l_explode_detail.cycles_since_new
             , time_since_overhaul = l_explode_detail.time_since_overhaul
             , cycles_since_overhaul = l_explode_detail.cycles_since_overhaul
             , time_since_repair = l_explode_detail.time_since_repair
             , cycles_since_repair = l_explode_detail.cycles_since_repair
             , time_since_visit = l_explode_detail.time_since_visit
             , cycles_since_visit = l_explode_detail.cycles_since_visit
             , time_since_mark = l_explode_detail.time_since_mark
             , cycles_since_mark = l_explode_detail.cycles_since_mark
             , number_of_repairs = l_explode_detail.number_of_repairs
             , group_mark_id = l_group_mark_id
         WHERE current_organization_id = l_explode_detail.organization_id
           AND inventory_item_id = l_explode_detail.inventory_item_id
           AND serial_number = l_explode_detail.fm_serial_number;
Line: 4300

            'After update mtl_serial_numbers with the attributes: c_attribute1 ' || l_explode_detail.c_attribute1
          , 'EXPLODE_DELIVERY_DETAILS'
          );
Line: 4327

          UPDATE mtl_serial_numbers_temp
             SET fm_serial_number = l_new_fm_serial
           WHERE ROWID = l_rowid;
Line: 4339

            inv_trx_util_pub.insert_ser_trx(
              p_trx_tmp_id                 => l_explode_detail.transaction_temp_id
            , p_user_id                    => fnd_global.user_id
            , p_fm_ser_num                 => l_explode_detail.fm_serial_number
            , p_to_ser_num                 => l_current_to_serial
            , p_serial_attribute_category  => l_explode_detail.serial_attribute_category
            , p_orgination_date            => l_explode_detail.origination_date
            , p_c_attribute1               => l_explode_detail.c_attribute1
            , p_c_attribute2               => l_explode_detail.c_attribute2
            , p_c_attribute3               => l_explode_detail.c_attribute3
            , p_c_attribute4               => l_explode_detail.c_attribute4
            , p_c_attribute5               => l_explode_detail.c_attribute5
            , p_c_attribute6               => l_explode_detail.c_attribute6
            , p_c_attribute7               => l_explode_detail.c_attribute7
            , p_c_attribute8               => l_explode_detail.c_attribute8
            , p_c_attribute9               => l_explode_detail.c_attribute9
            , p_c_attribute10              => l_explode_detail.c_attribute10
            , p_c_attribute11              => l_explode_detail.c_attribute11
            , p_c_attribute12              => l_explode_detail.c_attribute12
            , p_c_attribute13              => l_explode_detail.c_attribute13
            , p_c_attribute14              => l_explode_detail.c_attribute14
            , p_c_attribute15              => l_explode_detail.c_attribute15
            , p_c_attribute16              => l_explode_detail.c_attribute16
            , p_c_attribute17              => l_explode_detail.c_attribute17
            , p_c_attribute18              => l_explode_detail.c_attribute18
            , p_c_attribute19              => l_explode_detail.c_attribute19
            , p_c_attribute20              => l_explode_detail.c_attribute20
            , p_d_attribute1               => l_explode_detail.d_attribute1
            , p_d_attribute2               => l_explode_detail.d_attribute2
            , p_d_attribute3               => l_explode_detail.d_attribute3
            , p_d_attribute4               => l_explode_detail.d_attribute4
            , p_d_attribute5               => l_explode_detail.d_attribute5
            , p_d_attribute6               => l_explode_detail.d_attribute6
            , p_d_attribute7               => l_explode_detail.d_attribute7
            , p_d_attribute8               => l_explode_detail.d_attribute8
            , p_d_attribute9               => l_explode_detail.d_attribute9
            , p_d_attribute10              => l_explode_detail.d_attribute10
            , p_n_attribute1               => l_explode_detail.n_attribute1
            , p_n_attribute2               => l_explode_detail.n_attribute2
            , p_n_attribute3               => l_explode_detail.n_attribute3
            , p_n_attribute4               => l_explode_detail.n_attribute4
            , p_n_attribute5               => l_explode_detail.n_attribute5
            , p_n_attribute6               => l_explode_detail.n_attribute6
            , p_n_attribute7               => l_explode_detail.n_attribute7
            , p_n_attribute8               => l_explode_detail.n_attribute8
            , p_n_attribute9               => l_explode_detail.n_attribute9
            , p_n_attribute10              => l_explode_detail.n_attribute10
            , p_status_id                  => l_explode_detail.status_id
            , p_territory_code             => l_explode_detail.territory_code
            , p_time_since_new             => l_explode_detail.time_since_new
            , p_cycles_since_new           => l_explode_detail.cycles_since_new
            , p_time_since_overhaul        => l_explode_detail.time_since_overhaul
            , p_cycles_since_overhaul      => l_explode_detail.cycles_since_overhaul
            , p_time_since_repair          => l_explode_detail.time_since_repair
            , p_cycles_since_repair        => l_explode_detail.cycles_since_repair
            , p_time_since_visit           => l_explode_detail.time_since_visit
            , p_cycles_since_visit         => l_explode_detail.cycles_since_visit
            , p_time_since_mark            => l_explode_detail.time_since_mark
            , p_cycles_since_mark          => l_explode_detail.cycles_since_mark
            , p_number_of_repairs          => l_explode_detail.number_of_repairs
            , x_proc_msg                   => l_proc_msg
            );
Line: 4413

               'Before update the mtl_serial_numbers with org '
            || TO_CHAR(l_explode_detail.organization_id)
            || ' item '
            || TO_CHAR(l_explode_detail.inventory_item_id)
            || ' serial '
            || l_explode_detail.fm_serial_number
          , 'EXPLODE_DELIVERY_DETAILS'
          );
Line: 4441

          UPDATE mtl_serial_numbers
             SET serial_attribute_category = l_explode_detail.serial_attribute_category
               , origination_date = l_explode_detail.origination_date
               , c_attribute1 = l_explode_detail.c_attribute1
               , c_attribute2 = l_explode_detail.c_attribute2
               , c_attribute3 = l_explode_detail.c_attribute3
               , c_attribute4 = l_explode_detail.c_attribute4
               , c_attribute5 = l_explode_detail.c_attribute5
               , c_attribute6 = l_explode_detail.c_attribute6
               , c_attribute7 = l_explode_detail.c_attribute7
               , c_attribute8 = l_explode_detail.c_attribute8
               , c_attribute9 = l_explode_detail.c_attribute9
               , c_attribute10 = l_explode_detail.c_attribute10
               , c_attribute11 = l_explode_detail.c_attribute11
               , c_attribute12 = l_explode_detail.c_attribute12
               , c_attribute13 = l_explode_detail.c_attribute13
               , c_attribute14 = l_explode_detail.c_attribute14
               , c_attribute15 = l_explode_detail.c_attribute15
               , c_attribute16 = l_explode_detail.c_attribute16
               , c_attribute17 = l_explode_detail.c_attribute17
               , c_attribute18 = l_explode_detail.c_attribute18
               , c_attribute19 = l_explode_detail.c_attribute19
               , c_attribute20 = l_explode_detail.c_attribute20
               , d_attribute1 = l_explode_detail.d_attribute1
               , d_attribute2 = l_explode_detail.d_attribute2
               , d_attribute3 = l_explode_detail.d_attribute3
               , d_attribute4 = l_explode_detail.d_attribute4
               , d_attribute5 = l_explode_detail.d_attribute5
               , d_attribute6 = l_explode_detail.d_attribute6
               , d_attribute7 = l_explode_detail.d_attribute7
               , d_attribute8 = l_explode_detail.d_attribute8
               , d_attribute9 = l_explode_detail.d_attribute9
               , d_attribute10 = l_explode_detail.d_attribute10
               , n_attribute1 = l_explode_detail.n_attribute1
               , n_attribute2 = l_explode_detail.n_attribute2
               , n_attribute3 = l_explode_detail.n_attribute3
               , n_attribute4 = l_explode_detail.n_attribute4
               , n_attribute5 = l_explode_detail.n_attribute5
               , n_attribute6 = l_explode_detail.n_attribute6
               , n_attribute7 = l_explode_detail.n_attribute7
               , n_attribute8 = l_explode_detail.n_attribute8
               , n_attribute9 = l_explode_detail.n_attribute9
               , n_attribute10 = l_explode_detail.n_attribute10
               , status_id = l_explode_detail.status_id
               , territory_code = l_explode_detail.territory_code
               , time_since_new = l_explode_detail.time_since_new
               , cycles_since_new = l_explode_detail.cycles_since_new
               , time_since_overhaul = l_explode_detail.time_since_overhaul
               , cycles_since_overhaul = l_explode_detail.cycles_since_overhaul
               , time_since_repair = l_explode_detail.time_since_repair
               , cycles_since_repair = l_explode_detail.cycles_since_repair
               , time_since_visit = l_explode_detail.time_since_visit
               , cycles_since_visit = l_explode_detail.cycles_since_visit
               , time_since_mark = l_explode_detail.time_since_mark
               , cycles_since_mark = l_explode_detail.cycles_since_mark
               , number_of_repairs = l_explode_detail.number_of_repairs
               , group_mark_id = l_group_mark_id
           WHERE current_organization_id = l_explode_detail.organization_id
             AND inventory_item_id = l_explode_detail.inventory_item_id
             AND serial_number = l_serial_number;
Line: 4544

    * Update all the Processed serial numbers
    * with the new already generated transaction
    * temp id
    ****************************/
    l_running_quantity  := l_serial_numbers_table.COUNT;
Line: 4551

      UPDATE mtl_serial_numbers_temp
         SET transaction_temp_id = x_transaction_temp_id
       WHERE transaction_temp_id = p_transaction_temp_id
         AND fm_serial_number = l_serial_numbers_table(j);
Line: 4571

    SELECT inventory_item_id
      INTO l_inventory_item_id
      FROM mtl_reservations
     WHERE reservation_id = p_reservation_id;
Line: 4583

          SELECT oel.end_item_unit_number
            INTO l_end_item_unit_number
            FROM oe_order_lines_all oel, wsh_delivery_details_ob_grp_v wdd
           WHERE wdd.delivery_detail_id = p_delivery_detail_id
             AND wdd.source_header_id = oel.header_id
             AND wdd.source_line_id = oel.line_id;
Line: 4708

      /* 5506223: Because of the above, using direct update to MSN to set the
       *          group_mark_id */

      BEGIN
         UPDATE mtl_serial_numbers
            SET group_mark_id     = l_group_mark_id
          WHERE inventory_item_id = l_inventory_item_id
            AND serial_number     = l_serial_numbers_table(n)
            AND current_organization_id = p_organization_id;
Line: 4732

        DEBUG( 'inserting serials ' || l_serial_numbers_table(n) || ' into msnt WITH temp_id ='
              || p_transaction_temp_id , 'EXPLODE_DELIVERY_DETAILS');
Line: 4737

        inv_trx_util_pub.insert_ser_trx(
          p_trx_tmp_id                 => p_transaction_temp_id
        , p_user_id                    => fnd_global.user_id
        , p_fm_ser_num                 => l_serial_numbers_table(n)
        , p_to_ser_num                 => l_serial_numbers_table(n)
        , x_proc_msg                   => l_proc_msg
        );
Line: 4747

          DEBUG('insert_ser_trx ended with errors ' || l_proc_msg, 'EXPLODE_DELIVERY_DETAILS');
Line: 4821

SELECT lpn_id
  FROM wms_license_plate_numbers
 WHERE outermost_lpn_id = p_outermost_lpn_id
 ORDER BY lpn_id;
Line: 4853

      l_mtl_reservation_tbl.DELETE;
Line: 4928

          SELECT  wdd.delivery_detail_id
                , wdd.picked_quantity
                , wdd.picked_quantity2
                , wdd.shipped_quantity
                , wdd.shipped_quantity2
          INTO    l_delivery_detail_id
                , l_picked_qty
                , l_sec_picked_qty
                , l_shipped_qty
                , l_sec_shipped_qty
          FROM wms_direct_ship_temp  wds,
               wsh_delivery_details_ob_grp_v  wdd
          WHERE wds.organization_id = p_organization_id
            AND wds.lpn_id = p_lpn_id
            AND wds.order_header_id = p_source_header_id
            AND wds.order_line_id = p_source_line_id
            AND wdd.organization_id = p_organization_id
            AND wdd.source_header_id = wds.order_header_id
            AND wdd.source_line_id = wds.order_line_id
            AND wdd.released_status = 'Y'
            AND wdd.container_flag = 'N'
            AND rownum =1;
Line: 4951

     /* Now we have the delivery_Detail to split so first update the quantity from
        Reservation on the wdd and then split from it*/

      IF (l_debug = 1) THEN
         DEBUG('l_picked_qty: '||l_picked_qty, 'Overship Staged Lines');
Line: 4960

         DEBUG('Before calling Update_shipping_attributes to update qty', 'Overship Staged Lines');
Line: 4962

      l_shipping_attr_tab.DELETE;  --Added delete to prevent usage from previous loop bug4128854
Line: 4967

      wsh_interface.update_shipping_attributes(p_source_code => 'INV',
       p_changed_attributes         => l_shipping_attr_tab
      ,x_return_status              => l_return_status);
Line: 4971

      l_shipping_attr_tab.DELETE;
Line: 4992

         DEBUG('Before calling Update_shipping_attributes to update qty', 'Overship Staged Lines');
Line: 4995

      wsh_interface.update_shipping_attributes(p_source_code => 'INV',
       p_changed_attributes         => l_shipping_attr_tab
      ,x_return_status              => l_return_status);
Line: 5000

         DEBUG('After calling Update_shipping_attributes', 'Overship Staged Lines');
Line: 5005

            DEBUG('Return error from update shipping attributes 2', 'Overship Staged Lines');
Line: 5011

            DEBUG('Return unexpected error from update shipping attributes', 'Overship Staged Lines');
Line: 5017

            DEBUG('Shipping attributes updated successfully','Overship Staged Lines');
Line: 5075

      /*Now update the new delivery_Detail with correct attributes*/
      l_shipping_attr_tab.DELETE;
Line: 5125

      wsh_interface.update_shipping_attributes(
        p_source_code                => 'INV',
        p_changed_attributes         => l_shipping_attr_tab,
        x_return_status              => l_return_status);
Line: 5131

         DEBUG('After update shipping attributes', 'Overship Staged Lines');
Line: 5136

            DEBUG('Return error from update shipping attributes', 'Overship Staged Lines');
Line: 5142

            DEBUG('Return unexpected error from update shipping attributes','Overship Staged Lines');
Line: 5148

      SELECT wds.ORGANIZATION_ID
         ,WDS.DOCK_DOOR_ID
         ,WDS.LPN_ID
         ,WDS.ORDER_HEADER_ID
         ,WDS.ORDER_LINE_ID
         ,WDS.LINE_ITEM_ID
         ,WDS.TRANSACTION_TEMP_ID
         ,WDD.DELIVERY_DETAIL_ID
         ,DECODE(WDD.REQUESTED_QUANTITY_UOM,MSI.PRIMARY_UOM_CODE
                                            ,WDD.REQUESTED_QUANTITY
                                            ,GREATEST(INV_CONVERT.INV_UM_CONVERT(
                                                             null
                                                            ,null
                                                            ,WDD.REQUESTED_QUANTITY
                                                            ,WDD.REQUESTED_QUANTITY_UOM
                                                            ,MSI.PRIMARY_UOM_CODE
                                                            ,null
                                                           ,null),0)) REQUESTED_QUANTITY
        ,MSI.PRIMARY_UOM_CODE
        ,WDD.REQUESTED_QUANTITY2
        ,MSI.SECONDARY_UOM_CODE
        ,MSI.LOT_CONTROL_CODE
        ,MSI.SERIAL_NUMBER_CONTROL_CODE
    INTO l_delivery_detail_tab(i).ORGANIZATION_ID
         ,l_delivery_detail_tab(i).DOCK_DOOR_ID
         ,l_delivery_detail_tab(i).LPN_ID
         ,l_delivery_detail_tab(i).ORDER_HEADER_ID
         ,l_delivery_detail_tab(i).ORDER_LINE_ID
         ,l_delivery_detail_tab(i).LINE_ITEM_ID
         ,l_delivery_detail_tab(i).TRANSACTION_TEMP_ID
         ,l_delivery_detail_tab(i).DELIVERY_DETAIL_ID
         ,l_delivery_detail_tab(i).REQUESTED_QUANTITY
         ,l_delivery_detail_tab(i).PRIMARY_UOM_CODE
         ,l_delivery_detail_tab(i).REQUESTED_QUANTITY2
         ,l_delivery_detail_tab(i).REQUESTED_QUANTITY_UOM2
         ,l_delivery_detail_tab(i).LOT_CONTROL_CODE
         ,l_delivery_detail_tab(i).SERIAL_NUMBER_CONTROL_CODE
    FROM WMS_DIRECT_SHIP_TEMP WDS,
         WSH_DELIVERY_DETAILS WDD,
         MTL_SYSTEM_ITEMS MSI
    WHERE WDS.ORGANIZATION_ID           = p_organization_id
       AND WDS.lpn_id                   = p_lpn_id
       AND WDS.ORDER_HEADER_ID          = p_source_header_id
       AND WDS.ORDER_LINE_ID            = p_source_line_id
       AND WDD.ORGANIZATION_ID          = p_organization_id
       AND WDD.SOURCE_HEADER_ID         = WDS.ORDER_HEADER_ID
       AND WDD.SOURCE_LINE_ID           = WDS.ORDER_LINE_ID
       AND MSI.ORGANIZATION_ID          = p_organization_id
       AND MSI.INVENTORY_ITEM_ID        = WDD.INVENTORY_ITEM_ID
       AND WDD.delivery_detail_id       = l_new_delivery_detail_id
       AND rownum = 1
    ORDER BY WDS.LINE_ITEM_ID;
Line: 5213

    SELECT DISTINCT lpn_id
               FROM wms_direct_ship_temp
              WHERE GROUP_ID = p_group_id
                AND organization_id = p_organization_id
                AND dock_door_id = p_dock_door_id;
Line: 5220

    SELECT lpn_id
      FROM wms_license_plate_numbers
     WHERE outermost_lpn_id = p_lpn_id;
Line: 5225

    SELECT wds.order_header_id
         , wds.order_line_id
         , sub.reservable_type
         , msi.inventory_item_id
         , msi.reservable_type
         , msi.lot_control_code
         , msi.serial_number_control_code
      FROM wms_direct_ship_temp wds
         , wms_license_plate_numbers wlpn
         , mtl_secondary_inventories sub
         , mtl_system_items msi
     WHERE wds.GROUP_ID = p_group_id
       AND wds.organization_id = p_organization_id
       AND wds.dock_door_id = p_dock_door_id
       AND wds.lpn_id = p_lpn_id
       AND wlpn.lpn_id = wds.lpn_id
       AND sub.organization_id = wds.organization_id
       AND wlpn.subinventory_code = sub.secondary_inventory_name
       AND msi.organization_id = wds.organization_id
       AND msi.inventory_item_id = wds.line_item_id;
Line: 5247

    SELECT DISTINCT trip_id
               FROM wms_shipping_transaction_temp
              WHERE organization_id = p_organization_id
                AND dock_door_id = p_dock_door_id
                AND dock_appoint_flag = 'N'
                AND direct_ship_flag = 'Y';
Line: 5255

    SELECT DISTINCT delivery_id
               FROM wms_shipping_transaction_temp
              WHERE organization_id = p_organization_id
                AND dock_door_id = p_dock_door_id
                AND NVL(trip_id, 0) = 0
                AND direct_ship_flag = 'Y';
Line: 5263

    SELECT wdd.delivery_detail_id
      FROM wsh_delivery_details_ob_grp_v wdd
         , wms_direct_ship_temp wds
     WHERE wds.organization_id = p_organization_id
       AND wds.lpn_id = p_lpn_id
       AND wdd.source_header_id = wds.order_header_id
       AND wdd.source_line_id = wds.order_line_id
       AND wdd.released_status IN('R', 'B')
       AND wdd.picked_quantity > 0;
Line: 5274

  CURSOR delete_details(p_outermost_lpn_id NUMBER) IS
    SELECT delivery_detail_id
      FROM wsh_delivery_details_ob_grp_v wdd
         , wms_license_plate_numbers lpn
     WHERE lpn.outermost_lpn_id = p_outermost_lpn_id
       AND lpn.lpn_id = wdd.lpn_id
       AND wdd.released_status = 'X'; -- For LPN reuse ER : 6845650
Line: 5284

     SELECT lpn_id
       FROM wms_license_plate_numbers
       WHERE outermost_lpn_id = p_outermost_lpn_id
       ORDER BY lpn_id;
Line: 5291

     SELECT ignore_for_planning, tms_interface_flag
       FROM wsh_new_deliveries_ob_grp_v
       WHERE delivery_id = v_del_id ;
Line: 5302

        SELECT 1 FROM dual
        WHERE EXISTS
        (SELECT 1
           FROM wms_ds_ct_wt_gtemp
          WHERE org_id = p_organization_id
            AND inventory_item_id = p_item_id
            AND NVL(inner_lpn_id, lpn_id) = p_lpn_id
            AND NVL(lot_number,'#NULL#') = NVL(p_lot_number,'#NULL#')
            AND NVL(revision,'#NULL#') = NVL(p_revision,'#NULL#')
        );
Line: 5419

    wms_direct_ship_pvt.create_update_containers(
      x_return_status              => l_return_status
    , x_msg_count                  => l_msg_count
    , x_msg_data                   => l_msg_data
    , p_org_id                     => p_organization_id
    , p_outermost_lpn_id           => l_outer_lpn.lpn_id
    );
Line: 5429

        DEBUG('create_update_containers API failed with status E ', 'STAGE_LPN');
Line: 5435

        DEBUG('create_update_containers failed with status U', 'STAGE_LPN');
Line: 5441

    SELECT delivery_detail_id
      INTO l_cont_instance_id
      FROM wsh_delivery_details_ob_grp_v
     WHERE lpn_id = l_outer_lpn.lpn_id
     AND released_status = 'X';   -- For LPN reuse ER : 6845650
Line: 5447

    SELECT wdd.delivery_detail_id
      INTO l_delivery_detail_id
      FROM wsh_delivery_details_ob_grp_v wdd, wms_direct_ship_temp wds
     WHERE wds.organization_id = p_organization_id
       AND wds.lpn_id = l_outer_lpn.lpn_id
       AND wdd.source_header_id = wds.order_header_id
       AND wdd.source_line_id = wds.order_line_id
       AND wdd.released_status IN('R', 'B', 'Y') --Added 'Y' bug4128854
       AND ROWNUM = 1;
Line: 5489

    wsh_container_actions.update_cont_hierarchy(
      p_del_detail_id              => l_delivery_detail_id
    , p_delivery_id                => NULL
    , p_container_instance_id      => l_cont_instance_id
    , x_return_status              => l_return_status
    );
Line: 5503

      DEBUG('The Update container_Hierarchy was successful for outer-lpn ' || l_outer_lpn.lpn_id, 'STAGE_LPN');
Line: 5568

        l_mtl_reservation_tbl.DELETE;
Line: 5625

        '    SELECT   wds.organization_id ' ||
        '           , wds.dock_door_id ' ||
        '           , wds.lpn_id ' ||
        '           , wds.order_header_id ' ||
        '           , wds.order_line_id ' ||
        '           , wds.line_item_id ' ||
        '           , wds.transaction_temp_id ' ||
        '           , wdd.delivery_detail_id ' ||
        '           , DECODE( ' ||
        '               wdd.requested_quantity_uom ' ||
        '             , msi.primary_uom_code, wdd.requested_quantity ' ||
        '             , GREATEST( ' ||
        '                        inv_convert.inv_um_convert(NULL, ' ||
        '                        NULL, wdd.requested_quantity, wdd.requested_quantity_uom, ' ||
        '                        msi.primary_uom_code, NULL , NULL) ' ||
        '                     , 0 )) requested_quantity ' ||
        '           , msi.primary_uom_code ' ||
        '           , wdd.requested_quantity2 ' ||
        '           , msi.secondary_uom_code ' ||
        '           , msi.lot_control_code ' ||
        '           , msi.serial_number_control_code ' ||
        '           , msi.inventory_item_id ';
Line: 5729

          l_shipping_attr.DELETE;
Line: 5734

                SELECT outermost_lpn_id
                  INTO l_outermost_lpn_id
                  FROM wms_license_plate_numbers
                  WHERE lpn_id = l_mtl_reservation_tbl(j).lpn_id;
Line: 5780

              DEBUG('Call the select statement for rsv lpn_id  ' || l_mtl_reservation_tbl(j).lpn_id, 'Stage_LPNs');
Line: 5783

            SELECT outermost_lpn_id
              INTO l_outermost_lpn_id
              FROM wms_license_plate_numbers
             WHERE lpn_id = l_mtl_reservation_tbl(j).lpn_id;
Line: 5972

                        SELECT mtl_material_transactions_s.NEXTVAL
                          INTO l_delivery_detail_tab(i).transaction_temp_id
                          FROM DUAL;
Line: 5977

                        UPDATE wms_direct_ship_temp
                           SET transaction_temp_id = l_delivery_detail_tab(i).transaction_temp_id
                         WHERE organization_id = l_delivery_detail_tab(i).organization_id
                           AND lpn_id = l_delivery_detail_tab(i).lpn_id
                           AND dock_door_id = l_delivery_detail_tab(i).dock_door_id
                           AND order_header_id = l_delivery_detail_tab(i).order_header_id
                           AND order_line_id = l_delivery_detail_tab(i).order_line_id;
Line: 6065

                  * Use the new Transaction Temp Id to update WDD
                  **************************************/
                  IF (l_serial_number_control_code = 6) THEN
                     l_invpcinrectype.transaction_temp_id         := l_out_transaction_temp_id;
Line: 6124

                           SELECT fm_serial_number
                             INTO l_shipping_attr(1).serial_number
                             FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id
                              AND ROWNUM < 2;
Line: 6139

                           DELETE FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id;
Line: 6211

                    DEBUG('Before call to update shipping attributes l_shipping_attr(1).picked_quantity2 :=' || l_shipping_attr(1).picked_quantity2, 'STAGE_LPNS');
Line: 6213

                  wsh_interface.update_shipping_attributes(
                      p_source_code        => 'INV'
                    , p_changed_attributes => l_shipping_attr
                    , x_return_status      => l_return_status);
Line: 6219

                     DEBUG('after update shipping attributes', 'stage_lpns');
Line: 6224

                        DEBUG('return error from update shipping attributes 3', 'STAGE_LPN');
Line: 6230

                        DEBUG('return unexpected error from update shipping attributes', 'STAGE_LPN');
Line: 6317

                        SELECT mtl_material_transactions_s.NEXTVAL
                          INTO l_delivery_detail_tab(i).transaction_temp_id
                          FROM DUAL;
Line: 6324

                        UPDATE wms_direct_ship_temp
                           SET transaction_temp_id = l_delivery_detail_tab(i).transaction_temp_id
                         WHERE organization_id = l_delivery_detail_tab(i).organization_id
                           AND lpn_id = l_delivery_detail_tab(i).lpn_id
                           AND dock_door_id = l_delivery_detail_tab(i).dock_door_id
                           AND order_header_id = l_delivery_detail_tab(i).order_header_id
                           AND order_line_id = l_delivery_detail_tab(i).order_line_id;
Line: 6360

                           DEBUG('return error from update shipping attributes 3', 'stage_lpns');
Line: 6366

                           DEBUG('return unexpected error from update shipping attributes', 'stage_lpns');
Line: 6413

                  * Update WDD with the  newly created Transaction_temp_id
                  ********************************************/
                  l_invpcinrectype.transaction_temp_id := l_out_transaction_temp_id;
Line: 6466

                           SELECT fm_serial_number
                             INTO l_shipping_attr(1).serial_number
                             FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id
                              AND ROWNUM < 2;
Line: 6477

                           DELETE FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id;
Line: 6528

                           SELECT fm_serial_number
                             INTO l_shipping_attr(1).serial_number
                             FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id
                              AND ROWNUM < 2;
Line: 6543

                           DELETE FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id;
Line: 6615

                     DEBUG('Call  update shipping attributes', 'stage_lpns');
Line: 6617

                  wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr
                  , x_return_status              => l_return_status);
Line: 6621

                     DEBUG('after update shipping attributes', 'stage_lpns');
Line: 6626

                        DEBUG('return error from update shipping attributes 2', 'stage_lpns');
Line: 6632

                        DEBUG('return unexpected error from update shipping attributes', 'stage_lpns');
Line: 6772

                        SELECT mtl_material_transactions_s.NEXTVAL
                          INTO l_delivery_detail_tab(i).transaction_temp_id
                          FROM DUAL;
Line: 6777

                        UPDATE wms_direct_ship_temp
                           SET transaction_temp_id = l_delivery_detail_tab(i).transaction_temp_id
                         WHERE organization_id = l_delivery_detail_tab(i).organization_id
                           AND lpn_id = l_delivery_detail_tab(i).lpn_id
                           AND dock_door_id = l_delivery_detail_tab(i).dock_door_id
                           AND order_header_id = l_delivery_detail_tab(i).order_header_id
                           AND order_line_id = l_delivery_detail_tab(i).order_line_id;
Line: 6865

                  * Use the new Transaction Temp Id to update WDD
                  **************************************/
                  IF (l_serial_number_control_code = 6) THEN
                     l_invpcinrectype.transaction_temp_id         := l_out_transaction_temp_id;
Line: 6924

                           SELECT fm_serial_number
                             INTO l_shipping_attr(1).serial_number
                             FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id
                              AND ROWNUM < 2;
Line: 6939

                           DELETE FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id;
Line: 6951

                  wsh_interface.update_shipping_attributes(
                      p_source_code        => 'INV'
                    , p_changed_attributes => l_shipping_attr
                    , x_return_status      => l_return_status);
Line: 6957

                     DEBUG('after update shipping attributes', 'stage_lpns');
Line: 6962

                        DEBUG('return error from update shipping attributes 3', 'STAGE_LPN');
Line: 6968

                        DEBUG('return unexpected error from update shipping attributes', 'STAGE_LPN');
Line: 7042

                        SELECT mtl_material_transactions_s.NEXTVAL
                          INTO l_delivery_detail_tab(i).transaction_temp_id
                          FROM DUAL;
Line: 7049

                        UPDATE wms_direct_ship_temp
                           SET transaction_temp_id = l_delivery_detail_tab(i).transaction_temp_id
                         WHERE organization_id = l_delivery_detail_tab(i).organization_id
                           AND lpn_id = l_delivery_detail_tab(i).lpn_id
                           AND dock_door_id = l_delivery_detail_tab(i).dock_door_id
                           AND order_header_id = l_delivery_detail_tab(i).order_header_id
                           AND order_line_id = l_delivery_detail_tab(i).order_line_id;
Line: 7085

                           DEBUG('return error from update shipping attributes 3', 'stage_lpns');
Line: 7091

                           DEBUG('return unexpected error from update shipping attributes', 'stage_lpns');
Line: 7138

                  * Update WDD with the  newly created Transaction_temp_id
                  ********************************************/
                  l_invpcinrectype.transaction_temp_id := l_out_transaction_temp_id;
Line: 7191

                           SELECT fm_serial_number
                             INTO l_shipping_attr(1).serial_number
                             FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id
                              AND ROWNUM < 2;
Line: 7202

                           DELETE FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id;
Line: 7250

                           SELECT fm_serial_number
                             INTO l_shipping_attr(1).serial_number
                             FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id
                              AND ROWNUM < 2;
Line: 7265

                           DELETE FROM mtl_serial_numbers_temp
                            WHERE transaction_temp_id = l_invpcinrectype.transaction_temp_id;
Line: 7278

                     DEBUG('Call  update shipping attributes', 'stage_lpns');
Line: 7280

                  wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr
                  , x_return_status              => l_return_status);
Line: 7284

                     DEBUG('after update shipping attributes', 'stage_lpns');
Line: 7289

                        DEBUG('return error from update shipping attributes 2', 'stage_lpns');
Line: 7295

                        DEBUG('return unexpected error from update shipping attributes', 'stage_lpns');
Line: 7338

          l_shipping_attr.DELETE;
Line: 7341

          wsh_interface.update_shipping_attributes(p_source_code => 'INV', p_changed_attributes => l_shipping_attr
          , x_return_status              => l_return_status);
Line: 7346

              DEBUG('Non-Reservable: return error from update shipping attributes', 'stage_lpns');
Line: 7352

              DEBUG('Non-Reservable: return unexpected error from update shipping attributes', 'stage_lpns');
Line: 7392

      SELECT COUNT(*)
        INTO l_trip_id
        FROM wms_shipping_transaction_temp
       WHERE outermost_lpn_id = l_outer_lpn.lpn_id;
Line: 7405

	    UPDATE wms_license_plate_numbers
	      SET lpn_context = 9
	      WHERE outermost_lpn_id = l_outer_lpn.lpn_id;
Line: 7410

	       DEBUG('Update LPN Context to Loaded to Dock, LPN :' || TO_CHAR(l_outer_lpn.lpn_id), 'Stage_LPNs');
Line: 7544

  END;        -- Populate WSTT and Update the LPN context
Line: 7605

    SELECT DISTINCT trip_id
               FROM wms_shipping_transaction_temp
              WHERE dock_door_id = p_dock_door_id
                AND organization_id = p_org_id
                AND direct_ship_flag = 'Y';
Line: 7713

      SELECT ship_method_code
           , NAME
        INTO l_ship_method_code
           , l_trip_name
        FROM wsh_trips_ob_grp_v
       WHERE trip_id = l_trip_cursor.trip_id;
Line: 7731

        SELECT vehicle_item_id
            INTO l_vehicle_item_id
            FROM wsh_trips_ob_grp_v
            WHERE trip_id = l_trip_cursor.trip_id;
Line: 7825

    SELECT lpn_id
         , subinventory_code
         , locator_id
      FROM wms_license_plate_numbers
     WHERE outermost_lpn_id = p_lpn;
Line: 7858

  SELECT revision_qty_control_code
       , lot_control_code
       , serial_number_control_code
    INTO l_revision_control
       , l_lot_control
       , l_serial_control
    FROM mtl_system_items
   WHERE organization_id = p_organization_id
     AND inventory_item_id = p_inventory_item_id;
Line: 7955

PROCEDURE create_update_containers(
  x_return_status    OUT NOCOPY    VARCHAR2
, x_msg_count        OUT NOCOPY    NUMBER
, x_msg_data         OUT nocopy    VARCHAR2
, p_org_id           IN            NUMBER
, p_outermost_lpn_id IN NUMBER
, p_delivery_id      IN  NUMBER DEFAULT NULL
) IS
  CURSOR lpn_details IS
    SELECT lpn_id
         , license_plate_number
         , subinventory_code
         , locator_id
         , inventory_item_id
         , revision
         , lot_number
         , serial_number
         , gross_weight_uom_code
         , gross_weight
         , tare_weight_uom_code
         , tare_weight
         , content_volume_uom_code
         , content_volume
      -- Release 12 (K): LPN Synchronization
      -- Add following new columns
         , container_volume
         , container_volume_uom
         , organization_id
      FROM wms_license_plate_numbers
     WHERE organization_id = p_org_id
       AND outermost_lpn_id = p_outermost_lpn_id;
Line: 8011

  wsh_update_tbl  WSH_GLBL_VAR_STRCT_GRP.delivery_details_Attr_tbl_Type;
Line: 8044

        DEBUG('No more LPNs found from lpn_details to process', 'create_update_containers');
Line: 8049

        DEBUG('Found from lpn_details lpn '||l_lpn_cur.license_plate_number||', lpn_id='||l_lpn_cur.lpn_id, 'create_update_containers');
Line: 8063

      SELECT wdd.released_status
           , wdd.delivery_detail_id
        INTO l_status_code
           , l_delivery_detail_id
        FROM wsh_delivery_details_ob_grp_v wdd
       WHERE wdd.container_name = l_lpn_cur.license_plate_number
       AND wdd.released_status = 'X';  --Bug#6878521 Made change bt need to chk this
Line: 8076

           2. Replace API call to wsh_container_grp.update_container
              with new API call WSH_WMS_LPN_GRP.Create_Update_Containers
           */
/*
        IF (l_debug = 1) THEN
          DEBUG('Release status is C, Updating delivery detail to NULL out LPN_ID', 'create_update_containers');
Line: 8082

          DEBUG(' Calling Create_Update_Containers with caller WMS, action code UPDATE_NULL', 'create_update_containers');
Line: 8089

        wsh_update_tbl(1) := l_wsh_dd_upd_rec;
Line: 8092

        l_IN_rec.action_code := 'UPDATE_NULL';
Line: 8094

        WSH_WMS_LPN_GRP.Create_Update_Containers (
          p_api_version     => 1.0
        , p_init_msg_list   => fnd_api.g_false
        , p_commit          => fnd_api.g_false
        , x_return_status   => x_return_status
        , x_msg_count       => x_msg_count
        , x_msg_data        => x_msg_data
        , p_detail_info_tab => wsh_update_tbl
        , p_IN_rec          => l_IN_rec
        , x_OUT_rec         => l_OUT_rec );
Line: 8108

            DEBUG('WSH_WMS_LPN_GRP.Create_Update_Containers returns error', 'create_update_containers');
Line: 8114

            DEBUG('WSH_WMS_LPN_GRP.Create_Update_Containers returns unexpected error', 'create_update_containers');
Line: 8121

            DEBUG('WSH_WMS_LPN_GRP.Create_Update_Containers returns success, AF Container exists, set lpn_id to NULL', 'create_update_containers');
Line: 8140

      DEBUG('LPN EXISTS: ' || l_count, 'create_update_containers');
Line: 8148

         with new API call to WSH_WMS_LPN_GRP.Create_Update_Containers

         The pre-R12 code was doing in two steps, create_container then update_container
         With the new API call, it replaces both previous API calls */

      /* Call function to create wsh delivery detail record */
      l_wsh_dd_rec := WMS_CONTAINER_PVT.To_DeliveryDetailsRecType(l_lpn_cur);
Line: 8165

    DEBUG('End of Loop of lpn_details, found '||wsh_create_tbl.count||' records in wsh_create_tbl to process', 'create_update_containers');
Line: 8166

    DEBUG('Calling WSH_WMS_LPN_GRP.Create_Update_Containers with caller as WMS and CREATE', 'create_update_containers');
Line: 8172

  WSH_WMS_LPN_GRP.Create_Update_Containers (
    p_api_version     => 1.0
  , p_init_msg_list   => fnd_api.g_false
  , p_commit          => fnd_api.g_false
  , x_return_status   => x_return_status
  , x_msg_count       => x_msg_count
  , x_msg_data        => x_msg_data
  , p_detail_info_tab => wsh_create_tbl
  , p_IN_rec          => l_IN_rec
  , x_OUT_rec         => l_OUT_rec );
Line: 8186

      DEBUG('WSH_WMS_LPN_GRP.Create_Update_Containers returns error', 'create_update_containers');
Line: 8192

      DEBUG('WSH_WMS_LPN_GRP.Create_Update_Containers returns unexpected error', 'create_update_containers');
Line: 8198

      DEBUG('WSH_WMS_LPN_GRP.Create_Update_Containers returns success', 'create_update_containers');
Line: 8204

    DEBUG('The API return status is ' || x_return_status, 'create_update_containers');
Line: 8213

      DEBUG('Execution Error in Create_Update_Container:' || SUBSTR(SQLERRM, 1, 240), 9);
Line: 8220

      DEBUG('Unexpected Error in Create_Update_Container:' || SUBSTR(SQLERRM, 1, 240), 'create_update_containers');
Line: 8225

    debug('Others exception raised: ' ||  SUBSTR(SQLERRM, 1, 240),'create_update_containers');
Line: 8231

      fnd_msg_pub.add_exc_msg('WMS_DIRECT_SHIP_PVT', 'create_update_containers');
Line: 8235

END create_update_containers;
Line: 8237

PROCEDURE update_shipped_quantity(
  x_return_status OUT NOCOPY    VARCHAR2
, x_msg_count     OUT NOCOPY    NUMBER
, x_msg_data      OUT NOCOPY    VARCHAR2
, p_delivery_id   IN            NUMBER
, p_org_id        IN            NUMBER DEFAULT NULL
) IS
  -- Cursor to get the delivery qty (sum of all the delivery_details )
  -- for the given delivery_id

  CURSOR delivery_item_qty IS
    SELECT   wdd.inventory_item_id
           , wdd.revision
           , wdd.lot_number
           , SUM(wdd.picked_quantity)
        FROM wms_shipping_transaction_temp wstt, wsh_delivery_details_ob_grp_v wdd
       WHERE wstt.delivery_id = p_delivery_id
         AND wdd.delivery_detail_id = wstt.delivery_detail_id
         AND wdd.released_status = 'Y'
    GROUP BY wdd.inventory_item_id, wdd.revision, wdd.lot_number
    ORDER BY wdd.inventory_item_id, wdd.revision, wdd.lot_number;
Line: 8262

    SELECT SUM(wlc.quantity)
      FROM wms_lpn_contents wlc, wms_license_plate_numbers lpn,
      wms_shipping_transaction_temp wstt
      WHERE wlc.parent_lpn_id = lpn.lpn_id
      and wstt.delivery_id = p_delivery_id
      and lpn.outermost_lpn_id = wstt.outermost_lpn_id
      and wstt.inventory_item_id = p_item_id
      AND wstt.inventory_item_id = wlc.inventory_item_id
      AND NVL(wlc.revision, '#') = NVL(p_revision, '#')
      AND NVL(wlc.lot_number, '#') = NVL(p_lot_number, '#');
Line: 8298

    SELECT   COUNT(COUNT(*))
        INTO l_lpn_item_count
        FROM wms_license_plate_numbers wlpn, wms_lpn_contents wlc, wms_shipping_transaction_temp wstt
       WHERE wstt.delivery_id = p_delivery_id
         AND wstt.outermost_lpn_id = wlpn.outermost_lpn_id
         AND wlpn.lpn_id = wlc.parent_lpn_id
    GROUP BY wlc.inventory_item_id, wlc.revision;
Line: 8308

    SELECT   COUNT(COUNT(*))
        INTO l_delivery_item_count
        FROM wms_shipping_transaction_temp wstt, wsh_delivery_details_ob_grp_v wdd
       WHERE wstt.delivery_id = p_delivery_id
         AND wdd.delivery_detail_id = wstt.delivery_detail_id
         AND wdd.released_status = 'Y'
    GROUP BY wdd.inventory_item_id, wdd.revision;
Line: 8320

        DEBUG('LPN contains items not belonging to the delivery.', 'Update_shipped_Quantity');
Line: 8321

        DEBUG('Cannot ship', 'Update_shipped_Quantity');
Line: 8333

        DEBUG('LPN has more items than Delivery Details', 'Update_Shipped_Quantity');
Line: 8334

        DEBUG('Some Items are not assigned to delivery details', 'Update_Shipped_Quantity');
Line: 8356

        SELECT wdd.delivery_detail_id
             , wdd.picked_quantity
          INTO l_delivery_detail_id
             , l_picked_qty
          FROM wms_shipping_transaction_temp wstt, wsh_delivery_details_ob_grp_v wdd
         WHERE wstt.delivery_id = p_delivery_id
           AND wstt.inventory_item_id = l_item_id
           AND wdd.delivery_detail_id = wstt.delivery_detail_id
           AND wdd.inventory_item_id = wstt.inventory_item_id
           AND NVL(wdd.revision, '#') = NVL(l_revision, '#')
           AND NVL(wdd.lot_number, '#') = NVL(l_lot_number, '#')
           AND ROWNUM = 1;
Line: 8376

      wsh_delivery_details_pub.update_shipping_attributes(
        p_api_version_number         => 1.0
      , p_source_code                => 'OE'
      , p_init_msg_list              => l_init_msg_list
      , p_commit                     => l_commit
      , p_changed_attributes         => l_shipping_attr
      , x_return_status              => l_return_status
      , x_msg_count                  => l_msg_count
      , x_msg_data                   => l_msg_data
      );
Line: 8388

        DEBUG('after calling Update_shipping_attributes', 'Update_shipped_Quantity');
Line: 8393

          DEBUG('return error from update shipping attributes 2', 'Update_shipped_Quantity');
Line: 8399

          DEBUG('return unexpected error from update shipping attributes', 'Update_shipped_Quantity');
Line: 8405

          DEBUG('Shipping attributes updated successfully');
Line: 8422

      DEBUG('Execution Error in Update_shipped_Quantity', 'Update_shipped_Quantity');
Line: 8423

      DEBUG('Could not update shipping attributes', 'Update_shipped_Quantity');
Line: 8431

      DEBUG('Unexpected Error in Update_shipped_Quantity:', 'Update_shipped_Quantity');
Line: 8432

      DEBUG('Could not update shipping attributes', 'Update_shipped_Quantity');
Line: 8441

      DEBUG('Could not update shipping attributes', 'Update_shipped_Quantity');
Line: 8443

END update_shipped_quantity;
Line: 8455

    SELECT DISTINCT NVL(parent_lpn_id, outermost_lpn_id)
               FROM wms_license_plate_numbers
              WHERE organization_id = p_organization_id
              AND outermost_lpn_id = p_outermost_lpn_id
              AND outermost_lpn_id <> lpn_id;
Line: 8462

    SELECT lpn_id
      FROM wms_license_plate_numbers
     WHERE organization_id = p_organization_id
       AND parent_lpn_id = l_parent_lpn_id;
Line: 8468

    SELECT delivery_detail_id
      FROM wsh_delivery_details_ob_grp_v
     WHERE organization_id = p_organization_id
       AND lpn_id = l_lpn_id
       AND released_status = 'X';  -- For LPN reuse ER : 6845650
Line: 8545

       SELECT 1
     INTO l_dummy_number
     FROM wms_shipping_transaction_temp
     WHERE parent_lpn_id = l_parent_lpn_id
     AND ROWNUM = 1;
Line: 8574

    l_wsh_lpn_id_tbl.DELETE;
Line: 8664

      SELECT wda.delivery_id
        INTO l_delivery_id
        FROM wsh_delivery_assignments_v wda
        WHERE wda.delivery_detail_id = l_par_del_det_tab(1)
        AND wda.delivery_id IS NOT NULL;
Line: 8672

      SELECT wnd.planned_flag
        INTO l_delivery_planned_flag
        FROM wsh_new_deliveries_ob_grp_v wnd
        WHERE wnd.delivery_id = l_delivery_id;
Line: 8718

        SELECT DISTINCT trip_id
          INTO l_trip_id_tab(1)
          FROM wms_shipping_transaction_temp
          WHERE delivery_id = l_delivery_id;
Line: 8898

    SELECT   parent_lpn_id
           , COUNT(parent_lpn_id) cnt
        FROM wms_shipping_transaction_temp
       WHERE delivery_id = p_delivery_id
    GROUP BY parent_lpn_id;
Line: 8918

    SELECT delivery_detail_id
      INTO l_par_del_det_id
      FROM wsh_delivery_details_ob_grp_v
     WHERE lpn_id = l_lpn_cur.parent_lpn_id
     AND released_status = 'X'; -- For LPN reuse ER : 6845650
Line: 8924

    SELECT COUNT(*)
      INTO l_count_del_assign
      FROM wsh_delivery_assignments_v wda, wsh_delivery_details_ob_grp_v wdd
     WHERE wda.parent_delivery_detail_id = l_par_del_det_id
       AND wda.delivery_detail_id = wdd.delivery_detail_id
       AND NVL(wdd.container_flag, 'N') = 'N';
Line: 8932

      SELECT license_plate_number
        INTO lpn_name
        FROM wms_license_plate_numbers
       WHERE lpn_id = l_lpn_cur.parent_lpn_id;
Line: 9003

  SELECT COUNT(*)
    INTO l_count
    FROM wsh_delivery_details_ob_grp_v wdd, wsh_delivery_assignments_v wda, mtl_system_items_kfv msik
   WHERE wda.delivery_detail_id = wdd.delivery_detail_id
     AND NVL(wdd.container_flag, 'N') = 'N'
     AND wda.delivery_id = p_delivery_id
     AND wdd.inventory_item_id = msik.inventory_item_id
     AND wdd.organization_id = msik.organization_id
     AND(
         (wda.parent_delivery_detail_id IS NULL
          AND msik.mtl_transactions_enabled_flag <> 'N')
         OR wdd.released_status IS NULL
         OR wdd.released_status NOT IN('X', 'Y')
        );
Line: 9047

    SELECT delivery_detail_id
      FROM wsh_delivery_details_ob_grp_v
     WHERE lpn_id IN(SELECT parent_lpn_id
                       FROM wms_shipping_transaction_temp
                      WHERE delivery_id = p_delivery_id
                        AND direct_ship_flag = 'Y');
Line: 9055

    SELECT parent_delivery_detail_id
      FROM wsh_delivery_assignments_v
     WHERE delivery_id = p_delivery_id
       AND delivery_detail_id NOT IN(SELECT delivery_detail_id
                                       FROM wsh_delivery_details_ob_grp_v
                                      WHERE lpn_id IN(SELECT parent_lpn_id
                                                        FROM wms_shipping_transaction_temp
                                                       WHERE delivery_id = p_delivery_id
                                                         AND direct_ship_flag = 'Y'));
Line: 9070

    SELECT NVL(SUM(DECODE(direct_ship_flag, 'N', 1)), 0) l_flag_n
      INTO l_flag_n
      FROM wms_shipping_transaction_temp wstt
     WHERE wstt.delivery_id = p_delivery_id
       AND dock_appoint_flag = 'N';
Line: 9093

        SELECT 1
          INTO l_num
          FROM DUAL
         WHERE EXISTS(
                 SELECT 1
                   FROM wsh_delivery_assignments_v wda, wsh_delivery_details_ob_grp_v wdd
                  WHERE wdd.delivery_detail_id = wda.delivery_detail_id
                    AND wda.delivery_id = p_delivery_id
                    AND wdd.released_status = 'Y'
                    AND NVL(container_flag, 'N') = 'N'
                    AND NOT EXISTS(
                         SELECT 1
                           FROM wms_shipping_transaction_temp wstt
                          WHERE wstt.delivery_detail_id = wdd.delivery_detail_id
                            AND wstt.delivery_id = p_delivery_id
                            AND wstt.direct_ship_flag = 'Y'
                            AND wstt.dock_appoint_flag = 'N'));
Line: 9120

        l_parent_del_detail_ids.DELETE;
Line: 9226

         SELECT nvl(wdd.source_line_set_id,wdd.source_line_id) into l_line_set_id
         FROM wsh_delivery_details_ob_grp_v  wdd
	 WHERE wdd.source_header_id = p_order_header_id
         AND wdd.source_line_id= p_order_line_id
	 AND rownum<2;
Line: 9237

          SELECT NVL(SUM(NVL(picked_quantity,0)),0)
               , NVL(SUM(NVL(picked_quantity2,0)),0)
            INTO l_staged_qty
               , l_staged_sec_qty
	  FROM wsh_delivery_details_ob_grp_v  wdd
	  WHERE source_header_id = p_order_header_id
	  AND released_status='Y'
	  AND nvl(source_line_set_id,source_line_id) =  l_line_set_id;
Line: 9252

	  SELECT NVL(SUM(NVL(primary_reservation_quantity,0)),0)
	       , NVL(SUM(NVL(secondary_reservation_quantity,0)),0)
            INTO l_total_resvd_qty
               , l_total_resvd_sec_qty
          FROM mtl_reservations
          WHERE organization_id= p_org_id
	  AND nvl(staged_flag,'N') = 'Y'
	  AND demand_source_line_id in ( SELECT source_line_id
                                         FROM wsh_delivery_details_ob_grp_v  wdd
	                                 WHERE source_header_id = p_order_header_id
	                                 AND released_status='Y'
	                                 AND nvl(source_line_set_id,source_line_id) =  l_line_set_id );
Line: 9424

  g_lpn_contents_tab.DELETE;
Line: 9425

  g_lpn_contents_lookup_tab.DELETE;
Line: 9428

  g_checked_delivery_tab.DELETE;
Line: 9431

  l_processed_lines_tab.DELETE;
Line: 9434

  g_del_grp_rls_flags.DELETE;
Line: 9435

  g_del_grp_rls_fld_value.DELETE;
Line: 9436

  g_del_grp_rls_fld_temp.DELETE;
Line: 9437

  g_checked_deliveries.DELETE;
Line: 9438

  l_skipped_line_tab.DELETE;
Line: 9442

  g_last_updated_by     := g_created_by;
Line: 9443

  g_last_update_login   := fnd_global.login_id;
Line: 9444

  g_last_update_date    := g_creation_date;
Line: 9455

    SELECT sub.reservable_type
      INTO l_sub_reservable_type
      FROM mtl_secondary_inventories sub
     WHERE sub.secondary_inventory_name = (SELECT subinventory_code
                                             FROM wms_license_plate_numbers
                                            WHERE lpn_id = p_lpn_id)
       AND organization_id = p_org_id;
Line: 9491

        '    SELECT   wlpn.lpn_id ' ||
        '           , wlpn.subinventory_code ' ||
        '           , wlpn.locator_id ' ||
        '           , wlc.inventory_item_id ' ||
        '           , wlc.revision   ' ||
        '           , wlc.lot_number ' ||
        '           , SUM(wlc.primary_quantity) quantity ' ||
        '           , SUM(NVL(wlc.secondary_quantity,0)) ' ||
        '           , DECODE(msi.revision_qty_control_code, 2, ''TRUE'', ''FALSE'') revision_control ' ||
        '           , DECODE(msi.lot_control_code, 2, ''TRUE'', ''FALSE'') lot_control ' ||
        '           , DECODE(msi.serial_number_control_code, 1, ''FALSE'', ''TRUE'') serial_control ' ||
        '           , msi.serial_number_control_code serial_control_code ' ||
        '           , msi.reservable_type ' ||
        '           , NULL ' ||
        '           , msi.ont_pricing_qty_source ' ||
        '        FROM wms_lpn_contents wlc   ' ||
        '           , wms_license_plate_numbers wlpn ' ||
        '           , mtl_system_items_b msi ' ||
        '       WHERE msi.inventory_item_id = wlc.inventory_item_id ' ||
        '         AND wlpn.lpn_id = wlc.parent_lpn_id   ' ||
        '         AND wlpn.outermost_lpn_id = :p_lpn_id ' ||
        '         AND wlpn.organization_id = :p_org_id  ' ||
        '         AND msi.organization_id = :p_org_id   ' ||
        '    GROUP BY wlpn.lpn_id ' ||
        '           , wlpn.subinventory_code ' ||
        '           , wlpn.locator_id ' ||
        '           , wlc.inventory_item_id ' ||
        '           , wlc.revision   ' ||
        '           , wlc.lot_number ' ||
        '           , DECODE(msi.revision_qty_control_code, 2, ''TRUE'', ''FALSE'') ' ||
        '           , DECODE(msi.lot_control_code, 2, ''TRUE'', ''FALSE'')  ' ||
        '           , DECODE(msi.serial_number_control_code, 1, ''FALSE'', ''TRUE'')  ' ||
        '           , msi.serial_number_control_code ' ||
        '           , msi.reservable_type ' ||
        '           , msi.ont_pricing_qty_source ' ||
        '    ORDER BY wlc.inventory_item_id ';
Line: 9530

        '    SELECT   wlpn.lpn_id ' ||
        '           , wlpn.subinventory_code ' ||
        '           , wlpn.locator_id ' ||
        '           , wlc.inventory_item_id ' ||
        '           , wlc.revision ' ||
        '           , wlc.lot_number ' ||
        '           , NVL(msn.quantity, wlc.primary_quantity) quantity ' ||
        '           , NVL(wlc.secondary_quantity,0) ' ||
        '           , DECODE(msi.revision_qty_control_code, 2, ''TRUE'', ''FALSE'') revision_control ' ||
        '           , DECODE(msi.lot_control_code, 2, ''TRUE'', ''FALSE'') lot_control ' ||
        '           , DECODE(msi.serial_number_control_code, 1, ''FALSE'', ''TRUE'') serial_control ' ||
        '           , msi.serial_number_control_code serial_control_code ' ||
        '           , msi.reservable_type ' ||
        '           , msn.end_item_unit_number ' ||
        '           , msi.ont_pricing_qty_source ' ||
        '        FROM wms_lpn_contents wlc ' ||
        '           , wms_license_plate_numbers wlpn ' ||
        '           , mtl_system_items_b msi ' ||
        '           , (SELECT   lpn_id ' ||
        '                     , revision ' ||
        '                     , lot_number ' ||
        '                     , inventory_item_id ' ||
        '                     , end_item_unit_number ' ||
        '                     , COUNT(1) quantity ' ||
        '                  FROM mtl_serial_numbers ' ||
        '                 WHERE lpn_id IN(SELECT lpn_id ' ||
        '                                   FROM wms_license_plate_numbers ' ||
        '                                  WHERE organization_id = :p_org_id ' ||
        '                                    AND outermost_lpn_id = :p_lpn_id) ' ||
        '              GROUP BY lpn_id, revision, lot_number, inventory_item_id, end_item_unit_number) msn ' ||
        '       WHERE msi.inventory_item_id = wlc.inventory_item_id ' ||
        '         AND wlpn.lpn_id = wlc.parent_lpn_id ' ||
        '         AND wlpn.outermost_lpn_id = :p_lpn_id ' ||
        '         AND wlpn.organization_id = :p_org_id ' ||
        '         AND msi.organization_id = :p_org_id ' ||
        '         AND msn.lpn_id(+) = wlc.parent_lpn_id ' ||
        '         AND msn.inventory_item_id(+) = wlc.inventory_item_id ' ||
        '         AND NVL(msn.lot_number(+),''#NULL#'') = NVL(wlc.lot_number,''#NULL#'') ' ||
        '         AND NVL(msn.revision(+),''#NULL#'') = NVL(wlc.revision,''#NULL#'') ' ||
        '    ORDER BY wlc.inventory_item_id ';
Line: 9705

      SELECT allow_cross_proj_issues
           , allow_cross_unitnum_issues
        INTO g_cross_project_allowed
           , g_cross_unit_allowed
        FROM pjm_org_parameters
       WHERE organization_id = p_org_id;
Line: 9739

        SELECT project_id
             , task_id
          INTO g_project_id
             , g_task_id
          FROM mtl_item_locations
         WHERE inventory_location_id = g_lpn_contents_tab(1).locator_id;
Line: 9765

      SELECT group_by_customer_flag
           , group_by_fob_flag
           , group_by_freight_terms_flag
           , group_by_intmed_ship_to_flag
           , group_by_ship_method_flag
        INTO x_group_by_customer_flag
           , x_group_by_fob_flag
           , x_group_by_freight_terms_flag
           , x_group_by_intmed_ship_flag
           , x_group_by_ship_method_flag
        FROM wsh_shipping_parameters
       WHERE organization_id = p_org_id;
Line: 9820

				SELECT count(1) INTO  l_rsv_count FROM mtl_reservations mr
				WHERE mr.organization_id=p_org_id
				AND mr.inventory_item_id = g_lpn_contents_tab(c_index).inventory_item_id
				AND mr.supply_source_type_id =inv_reservation_global.g_source_type_inv;
Line: 9837

			l_mtl_reservation_tab.DELETE;
Line: 9918

            SELECT oel.header_id
                 , oel.line_id
                 , oel.inventory_item_id
                 , oel.item_revision
                 , DECODE(
                     oel.order_quantity_uom
                   , msi.primary_uom_code, oel.ordered_quantity
                   , GREATEST(
                       inv_convert.inv_um_convert(oel.inventory_item_id, NULL,
                        msi.organization_id, 5,
                        oel.ordered_quantity, oel.order_quantity_uom, msi.primary_uom_code, NULL
                       , NULL), 0)
                   ) ordered_quantity
                 , oel.ordered_quantity2
                 , oel.project_id
                 , oel.task_id
                 , msi.serial_number_control_code
                 , oel.end_item_unit_number
                 , oel.flow_status_code
              INTO l_order_line_rec
              FROM oe_order_lines_all oel, mtl_system_items msi
             WHERE msi.organization_id = p_org_id
               AND oel.inventory_item_id = msi.inventory_item_id
               AND line_id = l_mtl_reservation_tab(resv_index).demand_source_line_id;
Line: 9979

            SELECT 1
              INTO l_order_line_status
              FROM DUAL
             WHERE EXISTS(SELECT delivery_detail_id
                            FROM wsh_delivery_details_ob_grp_v
                           WHERE released_status IN('R','B')
                             AND source_line_id = l_order_line_rec.line_id)
                -- bug 4232713 - Need to consider staged WDD lines for overpicking scenarios
                OR EXISTS(SELECT wdd.delivery_detail_id
                            FROM wsh_delivery_details_ob_grp_v wdd, wms_direct_ship_temp wds
                           WHERE wdd.released_status = 'Y'
                             AND wdd.source_line_id = wds.order_line_id
                             AND wds.order_line_id = l_order_line_rec.line_id);
Line: 10037

              l_skipped_line_tab.DELETE(l_order_line_rec.line_id);
Line: 10217

             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                  => l_msg_count
               , x_msg_data                   => l_msg_data
               , p_original_rsv_rec           => l_old_upd_resv_rec
               , p_to_rsv_rec                 => l_new_upd_resv_rec
               , p_original_serial_number     => l_upd_dummy_sn
               , p_to_serial_number           => l_upd_dummy_sn
               , p_validation_flag            => fnd_api.g_true
               );
Line: 10249

                    DEBUG('The sec qty to pick in LPN is same as sec res qty but pri res qty >= LPN pri qty so update res with pri qty ' || l_mtl_reservation_tab(resv_index).primary_reservation_quantity, 'Process_LPN');
Line: 10280

                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                  => l_msg_count
                  , x_msg_data                   => l_msg_data
                  , p_original_rsv_rec           => l_old_upd_resv_rec
                  , p_to_rsv_rec                 => l_new_upd_resv_rec
                  , p_original_serial_number     => l_upd_dummy_sn
                  , p_to_serial_number           => l_upd_dummy_sn
                  , p_validation_flag            => fnd_api.g_true
                  );
Line: 10296

             inv_staged_reservation_util.update_staged_flag(
                 x_return_status              => l_return_status,
                 x_msg_count                  => l_msg_count ,
                 x_msg_data                   => l_msg_data,
                 p_reservation_id             => l_mtl_reservation_tab(resv_index).reservation_id ,
                 p_staged_flag                => 'Y'
                 );
Line: 10309

                DEBUG('Update reservation failed for reservation_id ' || l_old_upd_resv_rec.reservation_id, 'Process_LPN');
Line: 10314

                DEBUG('Update reservation failed for reservation_id with status U' ||l_old_upd_resv_rec.reservation_id, 'Process_LPN');
Line: 10430

      SELECT mtl_material_transactions_s.NEXTVAL
        INTO g_group_id
        FROM DUAL;
Line: 10445

           DEBUG('Inserting records into WDS', 'Process_LPN');
Line: 10507

                SELECT mtl_material_transactions_s.NEXTVAL
                  INTO l_trx_temp_id
                  FROM DUAL;
Line: 10523

          INSERT INTO wms_direct_ship_temp(
                      group_id
                    , organization_id
                    , dock_door_id
                    , lpn_id
                    , order_header_id
                    , order_line_id
                    , line_item_id
                    , processed_quantity
                    , secondary_processed_qty
                    , processed_flag
                    , serial_required_flag
                    , transaction_temp_id
                    , creation_date
                    , created_by
                    , last_update_date
                    , last_updated_by
                    , last_update_login
                    )
             VALUES ( g_group_id
                    , p_org_id
                    , p_dock_door_id
                    , p_lpn_id
                    , l_processed_lines_tab(l_temp_index).header_id
                    , l_processed_lines_tab(l_temp_index).line_id
                    , l_processed_lines_tab(l_temp_index).inventory_item_id
                    , l_processed_lines_tab(l_temp_index).processed_quantity
                    , NVL(l_processed_lines_tab(l_temp_index).sec_processed_qty,0)
                    , l_processed_lines_tab(l_temp_index).processed_flag
                    , l_processed_lines_tab(l_temp_index).serial_required_flag
                    , l_trx_temp_id
                    , g_creation_date
                    , g_created_by
                    , g_last_update_date
                    , g_last_updated_by
                    , g_last_update_login
                    );
Line: 10581

   inserts processed line record into WDS.
*/

PROCEDURE process_line(
  p_lpn_id                 IN            NUMBER
, p_org_id                 IN            NUMBER
, p_dock_door_id           IN            NUMBER
, p_order_header_id        IN            NUMBER
, p_order_line_id          IN            NUMBER
, p_inventory_item_id      IN            NUMBER
, p_revision               IN            VARCHAR2
, p_end_item_unit_number   IN            VARCHAR2
, p_ordered_quantity       IN            NUMBER
, p_sec_ordered_qty        IN            NUMBER
, p_processed_quantity     IN            NUMBER
, p_sec_processed_qty      IN            NUMBER
, p_date_requested         IN            DATE
, x_remaining_quantity     OUT NOCOPY    NUMBER
, x_sec_remaining_qty      OUT NOCOPY    NUMBER
, x_return_status          OUT NOCOPY    VARCHAR2
, x_msg_count              OUT NOCOPY    NUMBER
, x_msg_data               OUT NOCOPY    VARCHAR2
) IS
  -- for query reservation
  l_qry_reservation_record    inv_reservation_global.mtl_reservation_rec_type;
Line: 10695

     SELECT 1 FROM dual
      WHERE EXISTS
          ( SELECT 1
              FROM mtl_lot_uom_class_conversions
             WHERE organization_id   = p_organization_id
               AND inventory_item_id = p_item_id
               AND lot_number        = p_lot_number
               AND (disable_date IS NULL or disable_date > SYSDATE)
          );
Line: 11101

						SELECT grade_code
						INTO l_grade_code
						FROM mtl_lot_numbers
						WHERE lot_number         =  l_lpn_cont_rec.lot_number
						AND   inventory_item_id  =  l_lpn_cont_rec.inventory_item_id
						AND   organization_id    =  p_org_id;
Line: 11271

                                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                  => l_msg_count
                                , x_msg_data                   => l_msg_data
                                , p_original_rsv_rec           => l_old_upd_resv_rec
                                , p_to_rsv_rec                 => l_upd_resv_rec
                                , p_original_serial_number     => l_upd_dummy_sn
                                , p_to_serial_number           => l_upd_dummy_sn
                                , p_validation_flag            => fnd_api.g_true
                                , p_over_reservation_flag      => 3
                                );
Line: 11824

			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_count
            , x_msg_data                   => l_msg_data
            , p_organization_id            => p_org_id
            , p_inventory_item_id          => p_inventory_item_id
            , p_tree_mode                  => inv_quantity_tree_pub.g_reservation_mode
            , p_is_revision_control        => l_lpn_cont_rec.revision_control
            , p_is_lot_control             => l_lpn_cont_rec.lot_control
            , p_is_serial_control          => l_lpn_cont_rec.serial_control
            , p_demand_source_type_id      => l_demand_source_type_id
            , p_demand_source_header_id    => l_demand_source_header_id
            , p_demand_source_line_id      => p_order_line_id
            , p_revision                   => l_lpn_cont_rec.revision
            , p_lot_number                 => l_lpn_cont_rec.lot_number
            , p_subinventory_code          => l_lpn_cont_rec.subinventory_code
            , p_locator_id                 => l_lpn_cont_rec.locator_id
            , p_primary_quantity           => -1*l_reservation_record.primary_reservation_quantity
            , p_secondary_quantity         => NVL(-1*l_reservation_record.secondary_reservation_quantity,0)
            , p_quantity_type              => inv_quantity_tree_pvt.g_qr_same_demand
            , x_qoh                        => l_qoh
            , x_rqoh                       => l_rqoh
            , x_qr                         => l_qr
            , x_qs                         => l_qs
            , x_att                        => l_att
            , x_atr                        => l_atr
			, x_sqoh                       => l_sqoh
            , x_srqoh                      => l_srqoh
            , x_sqr                        => l_sqr
            , x_sqs                        => l_sqs
            , x_satt                       => l_satt
            , x_satr                       => l_satr
            , p_lpn_id                     => l_lpn_cont_rec.lpn_id
            );
Line: 11893

        DEBUG('Inserting data into WDS', 'Process_Line');
Line: 11898

        SELECT order_line_id
          INTO l_temp_var
          FROM wms_direct_ship_temp
         WHERE organization_id = p_org_id
           AND dock_door_id = p_dock_door_id
           AND lpn_id = p_lpn_id
           AND order_header_id = p_order_header_id
           AND order_line_id = p_order_line_id;
Line: 11908

        UPDATE wms_direct_ship_temp
           SET processed_flag = 'Y'
             , processed_quantity = l_processed_quantity
             , secondary_processed_qty = l_processed_sec_qty
         WHERE organization_id = p_org_id
           AND dock_door_id = p_dock_door_id
           AND lpn_id = p_lpn_id
           AND order_header_id = p_order_header_id
           AND order_line_id = p_order_line_id;
Line: 11922

                 SELECT mtl_material_transactions_s.NEXTVAL
                   INTO l_trx_temp_id
                   FROM DUAL;
Line: 11937

           INSERT INTO wms_direct_ship_temp(
                       group_id
                     , organization_id
                     , dock_door_id
                     , lpn_id
                     , order_header_id
                     , order_line_id
                     , line_item_id
                     , processed_quantity
                     , secondary_processed_qty
                     , processed_flag
                     , serial_required_flag
                     , transaction_temp_id
                     , creation_date
                     , created_by
                     , last_update_date
                     , last_updated_by
                     , last_update_login
                     )
              VALUES ( g_group_id
                     , p_org_id
                     , p_dock_door_id
                     , p_lpn_id
                     , p_order_header_id
                     , p_order_line_id
                     , p_inventory_item_id
                     , l_processed_quantity
                     , l_processed_sec_qty
                     , 'Y'
                     , l_serial_required_flag
                     , l_trx_temp_id
                     , g_creation_date
                     , g_created_by
                     , g_last_update_date
                     , g_last_updated_by
                     , g_last_update_login
                     );
Line: 11974

     END; --} update / insert
Line: 12009

    SELECT ship_from_location_id
         , ship_to_location_id
         , customer_id
         , intmed_ship_to_location_id
         , ship_method_code
         , fob_code
         , freight_terms_code
      FROM wsh_delivery_details_ob_grp_v
     WHERE source_header_id = p_header_id
       AND source_line_id = p_line_id;
Line: 12123

    SELECT wda.delivery_id
      FROM wsh_delivery_assignments_v wda, wsh_delivery_details_ob_grp_v wdd, wms_direct_ship_temp wds
     WHERE wds.organization_id = p_org_id
       AND wds.dock_door_id = p_dock_door_id
       AND wds.lpn_id = p_lpn_id
       AND wds.order_header_id = p_header_id
       AND wds.order_line_id = p_line_id
       AND wds.order_line_id = wdd.source_line_id
       AND wds.order_header_id = wdd.source_header_id
       AND wdd.delivery_detail_id = wda.delivery_detail_id;
Line: 12228

  1. Update staged flag of all reservations for all the lines packed into LPN.
  2. Stage LPN
  3. Update Freight Cost for LPN
 */

 /* bug#2798970 */
 /*
  jaysingh : The initail code of this procedure was doing wrong reservation staging.
             If two different LPNs was reserved against one line and we try to ship
       one LPN through DS, reservations for both the LPNs was staged. We should
       stage reservations only for LPNs which are inner LPNs of the outer LPN
       and the outermost LPN itself.
*/

   PROCEDURE load_lpn(
		      x_return_status OUT NOCOPY    VARCHAR2
		      , x_msg_count     OUT NOCOPY    NUMBER
		      , x_msg_data      OUT NOCOPY    VARCHAR2
		      , p_lpn_id        IN            NUMBER
		      , p_org_id        IN            NUMBER
		      , p_dock_door_id  IN            NUMBER
		      ) IS
 --
  TYPE number_table IS TABLE OF NUMBER
    INDEX BY BINARY_INTEGER;
Line: 12256

    SELECT wds.order_header_id
         , wds.order_line_id
      FROM wms_direct_ship_temp wds
     WHERE wds.organization_id = p_org_id
       AND wds.dock_door_id = p_dock_door_id
       AND wds.lpn_id = p_lpn_id;
Line: 12265

    SELECT lpn_id
      FROM wms_license_plate_numbers
     WHERE outermost_lpn_id = p_lpn_id
       AND organization_id = p_org_id;
Line: 12295

    l_lpn_ids_tab.DELETE;
Line: 12348

        inv_staged_reservation_util.update_staged_flag(
          x_return_status              => l_return_status
        , x_msg_count                  => l_msg_count
        , x_msg_data                   => l_msg_data
        , p_reservation_id             => l_mtl_reservation_tab(l_rec).reservation_id
        , p_staged_flag                => 'Y'
        );
Line: 12358

            DEBUG('Update_staged_flag failed with error', 'Load_LPN');
Line: 12364

            DEBUG('Update_staged_flag failed with exception', 'Load_LPN');
Line: 12428

  wms_direct_ship_pvt.update_freight_cost(x_return_status => l_return_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data
  , p_lpn_id                     => p_lpn_id);
Line: 12433

      DEBUG('Update Freight Cost API failed with status E ', 'Load_LPN');
Line: 12439

      DEBUG('Update Freight Cost failed with status U', 'Load_LPN');
Line: 12446

    DEBUG('Update freight cost completed', 'Load_LPN');
Line: 12468

  update the existing reservation else create new reservation.
 */

PROCEDURE perform_overship_distribution(
  p_lpn_id        IN            NUMBER
, p_org_id        IN            NUMBER
, p_dock_door_id  IN            NUMBER
, x_return_status OUT NOCOPY    VARCHAR2
, x_msg_count     OUT NOCOPY    NUMBER
, x_msg_data      OUT NOCOPY    VARCHAR2
) IS
  CURSOR loaded_lines(p_item_id IN NUMBER) IS
    SELECT wds.order_header_id
         , wds.order_line_id
         , oel.item_revision revision
         , oel.end_item_unit_number
         , oel.request_date
         , msi.primary_uom_code
         , msi.secondary_uom_code
      FROM wms_direct_ship_temp wds, oe_order_lines_all oel, mtl_system_items_kfv msi
     WHERE wds.organization_id = p_org_id
       AND wds.GROUP_ID = g_group_id
       AND wds.dock_door_id = p_dock_door_id
       AND wds.lpn_id = p_lpn_id
       AND wds.line_item_id = p_item_id
       AND oel.header_id = wds.order_header_id
       AND oel.line_id = wds.order_line_id
       AND msi.organization_id = wds.organization_id
       AND msi.inventory_item_id = wds.line_item_id;
Line: 12583

  l_lpn_cont_qty_used.DELETE;
Line: 12584

  l_lpn_sec_qty_used.DELETE;
Line: 12691

                   SELECT end_item_unit_number
                     INTO l_end_item_unit_number
                     FROM oe_order_lines_all
                    WHERE line_id = l_order_line_id;
Line: 12770

                   SELECT NVL(SUM(primary_reservation_quantity),0)
                        , NVL(SUM(secondary_reservation_quantity),0)
                     INTO l_total_resvd_qty
                        , l_total_resvd_sec_qty
                     FROM mtl_reservations
                    WHERE demand_source_header_id = l_mtl_reservation_tab(l_index_r).demand_source_header_id
                      AND demand_source_line_id = l_order_line_id
                      AND demand_source_type_id = l_demand_source_type_id
                      AND demand_source_line_detail IS NULL
                      AND NVL(staged_flag,'N') = 'Y'; --Bug#5262108
Line: 12865

                   SELECT NVL(SUM(picked_quantity),0)
                        , NVL(SUM(picked_quantity2),0)
                     INTO l_staged_qty
                        , l_staged_sec_qty
                     FROM wsh_delivery_details_ob_grp_v
                    WHERE source_header_id = l_order_header_id
                      AND source_line_id = l_order_line_id
                      AND released_status = 'Y';
Line: 12989

                         DEBUG('The reservation_id to update = ' || l_old_upd_resv_rec.reservation_id, 'Perform_Overship_Distribution');
Line: 12990

                         DEBUG('Before call to update reservation', 'Perform_Overship_Distribution');
Line: 12993

                      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                  => l_msg_count
                      , x_msg_data                   => l_msg_data
                      , p_original_rsv_rec           => l_old_upd_resv_rec
                      , p_to_rsv_rec                 => l_upd_resv_rec
                      , p_original_serial_number     => l_upd_dummy_sn
                      , p_to_serial_number           => l_upd_dummy_sn
                      , p_validation_flag            => fnd_api.g_true
                      , p_over_reservation_flag      => 3
                      );
Line: 13009

                            DEBUG('Update reservation failed ', 'Perform_Overship_Distribution');
Line: 13015

                            DEBUG('Update reservation failed', 'Perform_Overship_Distribution');
Line: 13022

                         DEBUG('Update reservation is successful ', 'Perform_Overship_Distribution');
Line: 13023

                         DEBUG('After call to update reservation', 'Perform_Overship_Distribution');
Line: 13057

                         UPDATE wms_direct_ship_temp
                            SET processed_quantity = (processed_quantity + l_qty_overship)
                              , secondary_processed_qty = (NVL(secondary_processed_qty,0) + NVL(l_sec_qty_overship,0))
                          WHERE organization_id = p_org_id
                            AND group_id = g_group_id
                            AND lpn_id = p_lpn_id
                            AND order_line_id = l_order_line_id;
Line: 13086

            DEBUG('Reservation update completed', 'Perform_Overship_Distribution');
Line: 13124

                     SELECT NVL(SUM(primary_reservation_quantity),0)
                          , NVL(SUM(secondary_reservation_quantity),0)
                       INTO l_total_resvd_qty
                          , l_total_resvd_sec_qty
                       FROM mtl_reservations
                      WHERE demand_source_header_id = l_demand_source_header_id
                        AND demand_source_line_id = l_order_line_id
                        AND demand_source_type_id = l_demand_source_type_id
                        AND demand_source_line_detail IS NULL
                        AND NVL(staged_flag,'N') = 'Y' ;
Line: 13264

                     SELECT NVL(SUM(picked_quantity),0)
                          , NVL(SUM(picked_quantity2),0)
                       INTO l_staged_qty
                          , l_staged_sec_qty
                       FROM wsh_delivery_details_ob_grp_v
                      WHERE source_header_id = l_order_header_id
                        AND source_line_id = l_order_line_id
                        AND released_status = 'Y';
Line: 13467

                           UPDATE wms_direct_ship_temp
                              SET processed_quantity = (processed_quantity + l_qty_overship)
                                , secondary_processed_qty = (NVL(secondary_processed_qty,0) + NVL(l_sec_qty_overship,0))
                            WHERE organization_id = p_org_id
                              AND group_id = g_group_id
                              AND lpn_id = p_lpn_id
                              AND order_line_id = l_order_line_id;
Line: 13585

  SELECT delivery_detail_id
    INTO l_delivery_detail_id
    FROM wsh_delivery_details_ob_grp_v
   WHERE source_header_id = p_order_header_id
     AND source_line_id = p_order_line_id
     AND ROWNUM = 1;
Line: 13645

  SELECT DISTINCT wstt.outermost_lpn_id, wstt.delivery_id, wstt.trip_id
    FROM wms_shipping_transaction_temp  wstt
       , wsh_new_deliveries_ob_grp_v    wnd
   WHERE wstt.organization_id = p_org_id
     AND wnd.delivery_id = wstt.delivery_id
     AND wnd.status_code IN ('CL','IT');
Line: 13671

        DELETE wms_direct_ship_temp
         WHERE lpn_id = l_lpn_tab(i);
Line: 13675

        DELETE wms_freight_cost_temp
         WHERE lpn_id = l_lpn_tab(i);
Line: 13679

        DELETE wms_freight_cost_temp
         WHERE delivery_id = l_del_tab(i);
Line: 13683

        DELETE wms_freight_cost_temp
         WHERE trip_id IN l_trip_tab(i);
Line: 13687

        DELETE wms_shipping_transaction_temp
         WHERE outermost_lpn_id = l_lpn_tab(i);
Line: 13825

      SELECT 1
      INTO   l_ct_wt_enabled
      FROM   wms_license_plate_numbers wlpn
      WHERE  wlpn.organization_id = p_org_id
      AND    wlpn.lpn_id = p_lpn_id
      AND    EXISTS ( SELECT 'x'
                        FROM wms_license_plate_numbers  wlpn2
                           , wms_lpn_contents           wlc
                           , mtl_system_items           msi
                       WHERE wlpn2.outermost_lpn_id = wlpn.outermost_lpn_id
                         AND wlc.parent_lpn_id      = wlpn2.lpn_id
                         AND msi.inventory_item_id  = wlc.inventory_item_id
                         AND msi.organization_id    = wlc.organization_id
                         AND (  (msi.tracking_quantity_ind = 'PS' AND msi.secondary_default_ind <> 'F')
                             OR (msi.tracking_quantity_ind = 'P'  AND msi.ont_pricing_qty_source = 'S')
                             ));
Line: 13877

        SELECT
                t.ORG_ID
                ,t.LPN_ID
                ,t.INNER_LPN_ID
                ,t.INVENTORY_ITEM_ID
                ,t.REVISION
                ,t.LOT_NUMBER
                ,DECODE(t.PICKED_UOM_CODE, msi.primary_uom_code, t.PICKED_QUANTITY
                ,GREATEST(inv_convert.inv_um_convert(NULL, NULL,
                  t.PICKED_QUANTITY, t.PICKED_UOM_CODE, msi.primary_uom_code,
                  NULL, NULL), 0)) PICKED_QUANTITY_IN_PRI_UOM
                ,t.SECONDARY_UOM_CODE
                ,t.SECONDARY_QUANTITY
        FROM mtl_system_items msi, WMS_DS_CT_WT_GTEMP t
        WHERE t.INVENTORY_ITEM_ID = C_INVENTORY_ITEM_ID /* THIS HAS INDEX */
        AND t.ORG_ID = C_ORG_ID
        AND msi.INVENTORY_ITEM_ID = t.INVENTORY_ITEM_ID
        AND msi.ORGANIZATION_ID = t.ORG_ID
        AND NVL(t.INNER_LPN_ID, t.LPN_ID) = C_LPN_ID
        AND NVL(t.REVISION,'#NULL#') = NVL(C_REVISION,'#NULL#')
        AND NVL(t.LOT_NUMBER,'#NULL#') = NVL(C_LOT_NUMBER,'#NULL#')
        AND t.SECONDARY_QUANTITY IS NOT NULL;