DBA Data[Home] [Help]

APPS.OE_SCHEDULE_UTIL SQL Statements

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

Line: 87

  SELECT mrp_atp_schedule_temp_s.nextval
  INTO   MRP_SESSION_ID
  from dual;
Line: 154

        SELECT count(*)
        INTO   l_count
        FROM   wsh_carrier_services wsh,
               wsh_org_carrier_services wsh_org
        WHERE  wsh_org.organization_id    = p_ship_from_org_id
        AND  wsh.carrier_service_id       = wsh_org.carrier_service_id
        AND  wsh.ship_method_code         = p_new_ship_method
        AND  wsh_org.enabled_flag         = 'Y';
Line: 165

        SELECT count(*)
        INTO l_count
        FROM    wsh_carrier_ship_methods
        WHERE   ship_method_code = p_new_ship_method
        AND   organization_id = p_ship_from_org_id;
Line: 266

Procedure Name : Insert_Mandatory_Components
Description    : This procedure is called from the form side, when the user
                 clicks on global availability button and the item to check
                 global availability is an ATO Model. We insert the mandatory
                 components in MRP_ATP_SCHEDULE_TEMP for global availability.
--------------------------------------------------------------------------*/
Procedure Insert_Mandatory_Components
(p_order_number           IN  NUMBER,
p_ato_line_id             IN  NUMBER,
p_customer_name           IN  VARCHAR2,
p_customer_location       IN  VARCHAR2,
p_arrival_set_name        IN  VARCHAR2,
p_ship_set_name           IN  VARCHAR2,
p_ship_set_id             IN  NUMBER,
p_requested_ship_date     IN  DATE,
p_requested_arrival_date  IN  DATE,
p_session_id              IN  NUMBER,
p_instance_id             IN  NUMBER,
p_insert_code             IN  NUMBER,
x_return_status OUT NOCOPY VARCHAR2

)
IS
l_model_line_rec          OE_ORDER_PUB.line_rec_type;
Line: 335

      SAVEPOINT insert_mand_comp;
Line: 430

      l_model_rec.Insert_Flag := MRP_ATP_PUB.number_arr
                            (null);
Line: 516

                  SELECT concatenated_segments
                  INTO  l_ordered_item
                  FROM  mtl_system_items_vl
                  WHERE inventory_item_id = l_inventory_item_id
                  AND organization_id = l_ship_from_org_id;
Line: 530

            INSERT INTO MRP_ATP_SCHEDULE_TEMP
            (INVENTORY_ITEM_ID,
          SR_INSTANCE_ID,
             SOURCE_ORGANIZATION_ID,
             CUSTOMER_ID,
             CUSTOMER_SITE_ID,
             DESTINATION_TIME_ZONE,
             QUANTITY_ORDERED,
             UOM_CODE,
             REQUESTED_SHIP_DATE,
             REQUESTED_ARRIVAL_DATE,
             LATEST_ACCEPTABLE_DATE,
             DELIVERY_LEAD_TIME,
             FREIGHT_CARRIER,
             INSERT_FLAG,
             SHIP_METHOD,
             DEMAND_CLASS,
             SHIP_SET_NAME,
             SHIP_SET_ID,
             ARRIVAL_SET_NAME,
             ARRIVAL_SET_ID,
             ATP_LEAD_TIME,
             OVERRIDE_FLAG,
             SESSION_ID,
             ORDER_HEADER_ID,
             ORDER_LINE_ID,
             INVENTORY_ITEM_NAME,
             SOURCE_ORGANIZATION_CODE,
             ORDER_LINE_NUMBER,
             SHIPMENT_NUMBER,
             OPTION_NUMBER,
             PROMISE_DATE,
             CUSTOMER_NAME,
             CUSTOMER_LOCATION,
             OLD_LINE_SCHEDULE_DATE,
             OLD_SOURCE_ORGANIZATION_CODE,
             CALLING_MODULE,
             ACTION,
             STATUS_FLAG,
             SCENARIO_ID,
             ORDER_NUMBER,
             OLD_SOURCE_ORGANIZATION_ID,
             OLD_DEMAND_CLASS,
             PROJECT_ID,
             TASK_ID,
             PROJECT_NUMBER,
             TASK_NUMBER,
             SHIP_METHOD_TEXT
             )
            VALUES
            (l_inventory_item_id,
             p_instance_id,
             null,
             l_sold_to_org_id, -- CUSTOMER_ID
             l_ship_to_org_id, -- CUSTOMER_SITE_ID
             null,  -- DESTINATION_TIME_ZONE
             l_quantity_ordered,
             l_uom_code,
             p_requested_ship_date,
             p_requested_arrival_date,
             l_latest_acceptable_date,
             l_delivery_lead_time,
             null, -- FREIGHT_CARRIER,
             p_insert_code,
             l_ship_method,
             l_demand_class,
             p_ship_set_name,
             p_ship_set_id,
             p_arrival_set_name,
             l_arrival_set_id,
             l_st_atp_lead_time,
             null, -- OVERRIDE_FLAG
             p_session_id,
             l_header_id,
             l_line_id,
             l_ordered_item, -- l_INVENTORY_ITEM_NAME,
             null, -- l_SOURCE_ORGANIZATION_CODE,
             l_line_number,
             l_shipment_number,
             l_option_number,
             l_promise_date,
             p_customer_name,
             p_customer_location,
             null, -- l_OLD_LINE_SCHEDULE_DATE,
             null, -- l_OLD_SOURCE_ORGANIZATION_CODE,
             null, -- l_CALLING_MODULE,
             100,
             4, -- l_STATUS_FLAG,
             l_scenario_id,
             p_order_number,
             l_ship_from_org_id,
             l_demand_class,
             l_project_id,
             l_task_id,
             l_project_number,
             l_task_number,
             l_ship_method_text
             );
Line: 637

        ROLLBACK TO SAVEPOINT insert_mand_comp;
Line: 640

END Insert_Mandatory_Components;
Line: 643

Procedure Name : Update_PO
Description    : This procedure is called whenever there is a change to
                 schedule_ship_date on an internal order. PO has a callback
                 we need to call to notify them of this change.
--------------------------------------------------------------------------*/

Procedure Update_PO(p_schedule_ship_date       IN DATE,
                    p_source_document_id       IN VARCHAR2,
                    p_source_document_line_id  IN VARCHAR2)
IS
po_result    BOOLEAN;
Line: 660

      oe_debug_pub.add(  'ENTERING OE_SCHEDULE_UTIL.UPDATE_PO' , 2 ) ;
Line: 675

                       p_action        => 'Update_Req_Line_Date',
                       p_recreate_flag => FALSE,
                       p_qty           => null,
                       p_receipt_date  => p_schedule_ship_date);
Line: 682

      oe_debug_pub.add(  'EXITING OE_SCHEDULE_UTIL.UPDATE_PO' , 1 ) ;
Line: 688

             oe_debug_pub.add(  'EXCEPTION IN UPDATE_PO' , 2 ) ;
Line: 690

END Update_PO;
Line: 773

   SELECT 'Y'
   INTO   l_overridden
   FROM   oe_order_lines_all
   WHERE  top_model_line_id = p_top_model_line_id
   AND    open_flag = 'Y'
   AND    override_atp_date_code = 'Y'
   AND    rownum < 2;
Line: 808

   SELECT 'Y'
   INTO   l_overridden
   FROM   oe_order_lines_all
   WHERE  header_id = p_header_id
   AND    (ship_set_id = p_ship_set_id
   OR     arrival_set_id = p_arrival_set_id)
   AND    override_atp_date_code = 'Y'
   AND    rownum < 2;
Line: 837

 ,p_rsv_update            IN  BOOLEAN DEFAULT FALSE
,x_return_status OUT NOCOPY VARCHAR2)

IS
l_msg_count           NUMBER;
Line: 868

   SELECT RESERVABLE_TYPE
   INTO   l_reservable_type
   FROM   MTL_SYSTEM_ITEMS
   WHERE  INVENTORY_ITEM_ID = p_line_rec.inventory_item_id
   AND    ORGANIZATION_ID = p_line_rec.ship_from_org_id;
Line: 883

              SELECT revision_qty_control_code, lot_control_code,
                     serial_number_control_code
              INTO   l_revision_code, l_lot_code,
                     l_serial_code
              FROM   mtl_system_items
              WHERE  inventory_item_id = p_line_rec.inventory_item_id
              AND    organization_id   = p_line_rec.ship_from_org_id;
Line: 974

      , p_partial_rsv_exists        => p_rsv_update
      , p_substitute_flag           => l_substitute_flag  -- Added for ER 6110708
      );
Line: 1066

                 delete_reservations until the p_quantity_to_unreserve
                 is satisfied.
--------------------------------------------------------------------- */

Procedure Unreserve_Line
( p_line_rec              IN  OE_ORDER_PUB.Line_Rec_Type
 ,p_old_ship_from_org_id IN NUMBER DEFAULT NULL -- 6628134
 ,p_quantity_to_unreserve IN  NUMBER
 ,p_quantity2_to_unreserve IN  NUMBER  DEFAULT NULL -- INVCONV
,x_return_status OUT NOCOPY VARCHAR2)

IS
  l_rsv_rec               inv_reservation_global.mtl_reservation_rec_type;
Line: 1185

     SELECT count(a.line_id)
     INTO   l_count
     FROM oe_order_lines_all a,
          oe_order_lines_all b
     WHERE a.top_model_line_id = p_top_model_line_id
     AND a.top_model_line_id = b.top_model_line_id
     AND a.override_atp_date_code = 'Y'
     AND b.override_atp_date_code = 'Y'
     AND a.schedule_ship_date <> b.schedule_ship_date;
Line: 1197

     SELECT count(a.line_id)
     INTO   l_count
     FROM oe_order_lines_all a,
          oe_order_lines_all b
     WHERE a.top_model_line_id = p_top_model_line_id
     AND a.top_model_line_id = b.top_model_line_id
     AND a.override_atp_date_code = 'Y'
     AND b.override_atp_date_code = 'Y'
     AND a.schedule_arrival_date <> b.schedule_arrival_date;
Line: 1310

Procedure Log_Delete_Set_Request
Set_id will be deleted
1. When the line gets removed from the set.
2. When the line gets deleted, which is part of the set.
3. When line gets cancelled.
-------------------------------------------------------------------------*/
Procedure Log_Delete_Set_Request
(p_header_id IN NUMBER,
 p_line_id   IN NUMBER,
 p_set_id    IN NUMBER,
 x_return_status OUT NOCOPY VARCHAR2)

IS
l_set_type   VARCHAR2(30);
Line: 1330

     oe_debug_pub.add(  'ENTERING LOG DELETE SET REQUEST' || P_SET_ID , 1 );
Line: 1333

   SELECT set_type
   INTO l_set_type
   FROM oe_sets
   WHERE  set_id = p_set_id;
Line: 1343

   p_request_type           => OE_GLOBALS.G_DELETE_SET,
   p_param1                 => p_set_id,
   p_param2                 => p_header_id,
   p_param3                 => l_set_type,
   x_return_status          => x_return_status);
Line: 1349

      oe_debug_pub.add(  'EXITING LOG DELETE SET REQUEST '||x_return_status , 1 ) ;
Line: 1365

              'Log_Delete_Set_Request');
Line: 1367

END Log_Delete_Set_Request;
Line: 1442

/* Removed ship_method_code from the following select , to fix the bug 2916814 */

  Select schedule_ship_date,ship_to_org_id,ship_from_org_id,
         schedule_arrival_date,shipping_method_code,
         set_status, set_type
  Into   l_schedule_ship_date,l_ship_to_org_id,l_ship_from_org_id,
         l_schedule_arrival_date,l_shipping_method_code,
         l_set_status, l_set_type
  From   oe_sets
  Where  set_id = nvl(p_line_rec.ship_set_id,p_line_rec.arrival_set_id);
Line: 1937

                Update oe_order_lines_all
                Set shipping_method_code = l_shipping_method_code
                where header_id = p_line_rec.header_id
                and line_id = p_line_rec.line_id;
Line: 2338

       IF NOT OE_Internal_Requisition_Pvt.G_Update_ISO_From_Req
         AND NOT OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL THEN

         IF FND_PROFILE.VALUE('POR_SYNC_NEEDBYDATE_OM') = 'YES' THEN

           IF l_debug_level > 0 THEN
             oe_debug_pub.add(' Logging G_UPDATE_REQUISITION delayed request for date change');
Line: 2368

           , p_request_type           => OE_GLOBALS.G_UPDATE_REQUISITION
           , x_return_status          => l_return_status
           );
Line: 2377

           IF NOT OE_Schedule_GRP.G_ISO_Planning_Update THEN
             IF l_debug_level > 0 THEN
               oe_debug_pub.add(' Need By Date is not allowed to update. Updating MTL_Supply only',5);
Line: 2382

             OE_SCHEDULE_UTIL.Update_PO(p_x_line_rec.schedule_arrival_date,
                p_x_line_rec.source_document_id,
                p_x_line_rec.source_document_line_id);
Line: 2464

  p_x_atp_rec.Insert_Flag.extend(l_count);
Line: 2471

  p_x_atp_rec.ato_delete_flag.extend(l_count);
Line: 2531

  l_insert_flag       NUMBER;
Line: 2576

      l_insert_flag   := 1;
Line: 2578

      l_insert_flag   := 0;
Line: 2699

       IF  (p_line_rec.operation = OE_GLOBALS.G_OPR_DELETE)
       AND (p_line_rec.ato_line_id IS NOT NULL AND
       NOT (p_line_rec.ato_line_id = p_line_rec.line_id AND
            p_line_rec.item_type_code IN (OE_GLOBALS.G_ITEM_STANDARD,
                                          OE_GLOBALS.G_ITEM_OPTION))) THEN
          x_atp_rec.ato_delete_flag(I) := 'Y';
Line: 2706

             oe_debug_pub.add(  'ATO DELETE FLAG : '
                             || x_atp_rec.ato_delete_flag(I) , 1 ) ;
Line: 2916

    x_atp_rec.Insert_Flag(I)            := l_insert_flag;
Line: 2918

        oe_debug_pub.add(  'INSERT FLAG IN ATP_REC : '||X_ATP_REC.INSERT_FLAG ( I ) , 3 ) ;
Line: 3008

     /*  IF INV_GMI_RSV_BRANCH.Process_Branch   -- INVCONV - delete this
         (p_organization_id => p_old_line_rec.ship_from_org_id)
      THEN
        Update oe_order_lines_all
        Set ordered_quantity = 0,
            ordered_quantity2 = 0
        Where line_id=p_old_line_rec.line_id;
Line: 3111

        OE_Item_Tbl.DELETE(p_line_rec.line_id);
Line: 3344

        l_model_rec.Insert_Flag := MRP_ATP_PUB.number_arr
                            (x_atp_rec.Insert_Flag(I));
Line: 3470

            x_atp_rec.Insert_Flag(I)            :=
                                       l_smc_rec.Insert_Flag(J);
Line: 3749

            Select line_id
            Into   l_config_line_id
            From   oe_order_lines_all
            Where  ato_line_id = p_line_tbl(cnt).ato_line_id
            And    item_type_code = 'CONFIG';
Line: 3917

              SELECT SET_NAME
              INTO l_ship_set_name
              FROM OE_SETS
              WHERE set_id = p_x_line_rec.ship_set_id;
Line: 3928

              SELECT SET_NAME
              INTO l_arrival_set_name
              FROM OE_SETS
              WHERE set_id = p_x_line_rec.arrival_set_id;
Line: 4046

            select meaning
            into l_explanation
            from mfg_lookups where
            lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
            and lookup_code = p_atp_rec.error_code(J) ;
Line: 4142

                 select meaning
                 into l_explanation
                 from mfg_lookups where
                 lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
                 and lookup_code = p_atp_rec.error_code(J) ;
Line: 4202

                SELECT SET_NAME
                INTO l_ship_set_name
                FROM OE_SETS
                WHERE set_id = p_x_line_rec.ship_set_id;
Line: 4214

                SELECT SET_NAME
                INTO l_arrival_set_name
                FROM OE_SETS
                WHERE set_id = p_x_line_rec.arrival_set_id;
Line: 4843

       IF NOT OE_Internal_Requisition_Pvt.G_Update_ISO_From_Req
         AND NOT OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL THEN
         IF FND_PROFILE.VALUE('POR_SYNC_NEEDBYDATE_OM') = 'YES' THEN
         -- Modified for IR ISO Tracking bug 7667702

         IF l_debug_level > 0 THEN
           oe_debug_pub.add(' Logging G_UPDATE_REQUISITION delayed request for date change',5);
Line: 4873

         , p_request_type           => OE_GLOBALS.G_UPDATE_REQUISITION
         , x_return_status          => l_return_status
         );
Line: 4884

           IF NOT OE_Schedule_GRP.G_ISO_Planning_Update THEN
             IF l_debug_level > 0 THEN
               oe_debug_pub.add(' Need By Date is not allowed to update. Updating MTL_Supply only',5);
Line: 4889

             OE_SCHEDULE_UTIL.Update_PO(p_x_line_rec.schedule_arrival_date,
                p_x_line_rec.source_document_id,
                p_x_line_rec.source_document_line_id);
Line: 4982

  g_atp_tbl.delete;
Line: 4997

        OE_inactive_demand_tbl.DELETE(p_x_line_tbl(I).line_id);
Line: 5097

          Select 'Y'
          Into   l_config_exists
          From   oe_order_lines_all
          Where  header_id = p_x_line_tbl(I).header_id
          And    ato_line_id = p_x_line_tbl(I).ato_line_id
          And    item_type_code = OE_GLOBALS.G_ITEM_CONFIG;
Line: 5250

       IF NOT OE_Internal_Requisition_Pvt.G_Update_ISO_From_Req
         AND NOT OE_SALES_CAN_UTIL.G_IR_ISO_HDR_CANCEL THEN
         -- AND FND_PROFILE.VALUE('POR_SYNC_NEEDBYDATE_OM') = 'YES' THEN
         IF FND_PROFILE.VALUE('POR_SYNC_NEEDBYDATE_OM') = 'YES' THEN
         -- Modified for IR ISO Tracking bug 7667702

         IF l_debug_level > 0 THEN
           oe_debug_pub.add(' Logging G_UPDATE_REQUISITION delayed request for date change');
Line: 5281

         , p_request_type           => OE_GLOBALS.G_UPDATE_REQUISITION
         , x_return_status          => l_return_status
         );
Line: 5292

           IF NOT OE_Schedule_GRP.G_ISO_Planning_Update THEN
             IF l_debug_level > 0 THEN
               oe_debug_pub.add(' Need By Date is not allowed to update. Updating MTL_Supply only',5);
Line: 5297

             OE_SCHEDULE_UTIL.Update_PO(p_x_line_tbl(i).schedule_arrival_date,
                p_x_line_tbl(i).source_document_id,
                p_x_line_tbl(i).source_document_line_id);
Line: 5382

       select order_source_id, orig_sys_document_ref, orig_sys_line_ref,
              orig_sys_shipment_ref, change_sequence, source_document_id,
              source_document_line_id, source_document_type_id, header_id
       into l_order_source_id, l_orig_sys_document_ref, l_orig_sys_line_ref,
            l_orig_sys_shipment_ref, l_change_sequence, l_source_document_id,
            l_source_document_line_id, l_source_document_type_id, l_header_id
       from oe_order_lines
       where line_id = p_line_id;
Line: 5414

        select meaning
        into l_explanation
        from mfg_lookups where
        lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
        and lookup_code = p_atp_rec.error_code(J) ;
Line: 5483

            select meaning
            into l_explanation
            from mfg_lookups where
            lookup_type = 'MTL_DEMAND_INTERFACE_ERRORS'
            and lookup_code = p_atp_rec.error_code(J) ;
Line: 5605

       oe_debug_pub.add(  '6378240 : inserted the line_id into temp table '||p_x_line_rec.line_id ||'  ' ||p_x_line_rec.schedule_action_code);
Line: 5607

       insert into oe_schedule_lines_temp
                   (LINE_ID ,
                    SCHEDULE_ACTION_CODE)
              values(p_x_line_rec.line_id,p_x_line_rec.schedule_action_code);
Line: 5613

                  oe_debug_pub.add(  '6378240 : INSERT ERROR ');
Line: 5693

       UPDATE OE_ORDER_LINES_ALL
       SET    override_atp_date_code = Null
       WHERE  header_id = p_line_rec.header_id
       AND    ato_line_id = p_line_rec.ato_line_id;
Line: 5703

       UPDATE OE_ORDER_LINES_ALL
       SET    override_atp_date_code = Null
       WHERE  header_id = p_line_rec.header_id
       AND    link_to_line_id  = p_line_rec.line_id
       AND    item_type_code = 'INCLUDED';
Line: 5833

    SELECT msi.lot_control_code
    INTO   l_lot_control_code
    FROM   mtl_system_items msi
    WHERE  msi.inventory_item_id = p_item_id
    AND    msi.organization_id   = nvl(p_org_id,l_org_id);
Line: 6934

          , p_rsv_update           => TRUE  -- Going to increase reservation
          , x_return_Status        => x_return_status);
Line: 7005

l_rsv_update           BOOLEAN :=FALSE;
Line: 7226

              oe_debug_pub.add(  'RSCH: CALLING INVS UPDATE RESERVATION ' , 1 ) ;
Line: 7228

          inv_reservation_pub.update_reservation
            ( p_api_version_number        => 1.0
            , p_init_msg_lst              => fnd_api.g_true
            , x_return_status             => x_return_status
            , x_msg_count                 => l_msg_count
            , x_msg_data                  => l_msg_data
            , p_original_rsv_rec          => l_rsv_tbl(k)
            , p_to_rsv_rec                => l_reservation_rec
            , p_original_serial_number    => l_dummy_sn -- no serial contorl
            , p_to_serial_number          => l_dummy_sn -- no serial control
            , p_validation_flag           => fnd_api.g_true
            , p_over_reservation_flag     => 2 -- 4715544
            );
Line: 7243

                                    oe_debug_pub.add(  'AFTER CALLING INVS UPDATE_RESERVATION: ' || X_RETURN_STATUS , 1 ) ;
Line: 7420

                    l_rsv_update := TRUE;
Line: 7426

                  , p_rsv_update            => l_rsv_update
                  , x_return_status         => x_return_status);
Line: 7455

              , p_rsv_update           => TRUE
              , x_return_Status        => x_return_status);
Line: 7481

              , p_rsv_update           => TRUE
              , x_return_Status        => x_return_status);
Line: 7562

                    l_rsv_update := TRUE;
Line: 7576

                  , p_rsv_update            => l_rsv_update
                  , x_return_status         => x_return_status);
Line: 7822

   SELECT name, scheduling_level_code
   INTO   l_line_type,l_scheduling_level_code
   FROM   oe_transaction_types
   WHERE  transaction_type_id = p_line_type_id AND
            transaction_type_code = 'LINE';
Line: 7846

  SELECT /* MOAC_SQL_CHANGE*/ name, scheduling_level_code
  INTO   l_order_type,l_scheduling_level_code
  FROM   oe_order_types_v ot, oe_order_headers_all h
  WHERE  h.header_id     = p_header_id AND
         h.order_type_id =  ot.order_type_id;
Line: 7888

  SELECT line_id
  FROM   oe_order_lines
  WHERE  top_model_line_id = p_x_line_rec.top_model_line_id
  AND    ato_line_id       = p_x_line_rec.ato_line_id
  AND    open_flag = 'Y'
  AND    source_type_code = 'EXTERNAL';
Line: 7901

      oe_debug_pub.add(  'UPDATE SHIP DATE , EXTERNAL '|| P_X_LINE_REC.LINE_ID , 1 ) ;
Line: 7919

  l_line_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 8338

         oe_debug_pub.add(  'AFTER Inserting data in OE_SETS_HISTORY table ' || x_return_status , 1 ) ;
Line: 8341

      Log_Delete_Set_Request
         (p_header_id   => p_x_line_rec.header_id,
          p_line_id     => p_x_line_rec.line_id,
          p_set_id      => nvl(l_old_line_rec.ship_set_id,l_old_line_rec.arrival_set_id),
          x_return_status => x_return_status);
Line: 8347

         oe_debug_pub.add(  'AFTER LOGGING DELETE SETS DELAYED REQUEST IN SCHEDULE LINE' || X_RETURN_STATUS , 1 ) ;
Line: 8354

      AND  p_x_line_rec.operation = 'UPDATE' THEN

      IF p_x_line_rec.ship_model_complete_flag = 'Y'
      THEN
         Update oe_order_lines_all
            Set firm_demand_flag = p_x_line_rec.firm_demand_flag
            Where top_model_line_id = p_x_line_rec.top_model_line_id;
Line: 8369

         Update oe_order_lines_all
            Set firm_demand_flag = p_x_line_rec.firm_demand_flag
            Where ato_line_id = p_x_line_rec.ato_line_id;
Line: 8461

               OE_ORDER_UTIL.Update_Global_Picture
                  (p_Upd_New_Rec_If_Exists => False,
                   p_old_line_rec  => p_old_line_rec,
                   p_line_rec      => p_x_line_rec,
                   p_line_id       => p_x_line_rec.line_id,
                   x_index         => l_index,
                   x_return_status => x_return_status);
Line: 8471

                     oe_debug_pub.add(  'After update global pic: UNEXP ERRORED OUT' , 1 ) ;
Line: 8476

                     oe_debug_pub.add(  'After update global pic : ERRORED OUT' , 1 ) ;
Line: 8492

               Update oe_order_lines_all
                  Set arrival_set_id = Null,
                  ship_set_id    = Null
                  Where Line_id = p_x_line_rec.line_id;
Line: 8785

      (p_line_rec.operation = OE_GLOBALS.G_OPR_DELETE OR
       p_line_rec.operation = OE_GLOBALS.G_OPR_CREATE )
   THEN
      RETURN FALSE;
Line: 8792

       oe_debug_pub.add(  'N3 NOT CONFIG WITH DELETE AND CREATE OPR' , 1 ) ;
Line: 8817

           (p_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE)
       THEN
           IF l_debug_level  > 0 THEN
               oe_debug_pub.add(  'THIS LINE IS BEING SPLIT' , 1 ) ;
Line: 9141

        select order_date_type_code
        into l_order_date_type_code
        from oe_order_headers_all
        where header_id =  p_line_rec.header_id;
Line: 10009

            SELECT planning_make_buy_code
            INTO   l_make_buy
            FROM   mtl_system_items
            WHERE  inventory_item_id = p_line_rec.inventory_item_id
            AND    ORGANIZATION_ID = nvl(p_line_rec.ship_from_org_id,
                                            l_org_id);
Line: 10028

               SELECT BILL_SEQUENCE_ID
               INTO   l_bill_seq_id
               FROM   BOM_BILL_OF_MATERIALS
               WHERE  ORGANIZATION_ID = nvl(p_line_rec.ship_from_org_id,
                                            l_org_id)
               AND    ASSEMBLY_ITEM_ID = p_line_rec.inventory_item_id
               AND    ALTERNATE_BOM_DESIGNATOR IS NULL;
Line: 10048

                  Select ORGANIZATION_CODE
                  Into   l_org_code
                  From   Inv_Organization_Info_v   --ORG_ORGANIZATION_DEFINITIONS
                  Where  ORGANIZATION_ID = NVL(p_line_rec.ship_from_org_id,l_org_id);
Line: 10097

        SELECT line_Id
        INTO   l_config_id
        FROM   OE_ORDER_LINES_ALL
        WHERE  header_id = p_line_rec.header_id
        AND   (ato_line_id =p_line_rec.ato_line_id OR
              (top_model_line_id = p_line_rec.top_model_line_id AND
               Ship_model_complete_flag = 'Y'))
        AND    item_type_code = 'CONFIG';
Line: 10223

                      oe_debug_pub.add(  'E23 USER DOES NOT HAVE AUTHORITY TO UPDATE SCHEDULE ATTRIBUTES' , 1 ) ;
Line: 10249

                      SELECT  'Y' INTO l_found
                      FROM   oe_order_lines
                      WHERE  top_model_line_id = p_line_rec.top_model_line_id
                      AND override_atp_date_code = 'Y'
                      AND rownum <2;
Line: 10277

             SELECT count('x')
             INTO   l_override
             FROM   oe_order_lines_all
             WHERE  header_id = p_line_rec.header_id
             AND    (ship_set_id = p_line_rec.ship_set_id
             OR     arrival_set_id = p_line_rec.arrival_set_id)
             AND    override_atp_date_code = 'Y';
Line: 10292

                   oe_debug_pub.add(  'E25 USER DOES NOT HAVE AUTHORITY TO UPDATE SCHEDULE ATTRIBUTES ON A SET WITH AN OVERRIDDEN LINE' , 1 ) ;
Line: 10343

              SELECT 'Y'
              INTO   l_overridden
              FROM   oe_order_lines_all
              WHERE  header_id = p_line_rec.header_id
              AND    line_id <> p_line_rec.line_id
              AND    ship_set_id = p_line_rec.ship_set_id
              AND    override_atp_date_code = 'Y'
              AND    schedule_ship_date <> p_line_rec.schedule_ship_date
              AND    rownum < 2;
Line: 10360

              SELECT 'Y'
              INTO   l_overridden
              FROM   oe_order_lines_all
              WHERE  header_id = p_line_rec.header_id
              AND    line_id <> p_line_rec.line_id
              AND    arrival_set_id = p_line_rec.arrival_set_id
              AND    override_atp_date_code = 'Y'
              AND    schedule_arrival_date <> p_line_rec.schedule_arrival_date
              AND    rownum < 2;
Line: 10501

         SELECT 'Y'
         INTO   l_found
         FROM   WSH_DELIVERY_DETAILS
         WHERE  SOURCE_LINE_ID = p_line_rec.line_id
         AND    SOURCE_CODE = 'OE'
         AND    RELEASED_STATUS IN ('Y', 'C');
Line: 10566

l_update_flag    VARCHAR2(1):= FND_API.G_TRUE;
Line: 10657

            l_update_flag     := FND_API.G_FALSE;
Line: 10721

        l_update_flag := FND_API.G_FALSE;
Line: 10740

    l_update_flag := FND_API.G_FALSE;
Line: 10764

       l_update_flag := FND_API.G_FALSE;
Line: 10788

       l_update_flag := FND_API.G_FALSE;
Line: 10810

  IF l_update_flag = FND_API.G_TRUE
  THEN
/*
     Call_Process_Order(p_old_line_rec    => p_old_line_rec,
                        p_x_line_rec      => p_x_line_rec,
                        p_write_to_db     => p_write_to_db,
                        p_caller          => p_caller,
                        x_return_status   => x_return_status);
Line: 10880

  END IF; -- update flag
Line: 10893

     Update_PO(p_x_line_rec.schedule_arrival_date,
               p_x_line_rec.source_document_id,
               p_x_line_rec.source_document_line_id);
Line: 10969

  SELECT     NVL ( MSI.FULL_LEAD_TIME , 0 )
             , NVL ( MSI.FIXED_LEAD_TIME , 0 )
             , NVL ( MSI.VARIABLE_LEAD_TIME , 0 )
             , MSI.PRIMARY_UOM_CODE
             , NVL ( OL.INVENTORY_ITEM_ID , 0 )
             , OL.order_quantity_uom
             , OL.ordered_quantity
  INTO       db_full_lead_time
             , db_fixed_lead_time
             , db_variable_lead_time
             , db_primary_uom_code
             , db_model_item_id
             , db_line_unit_code
             , primary_model_qty
  FROM    MTL_SYSTEM_ITEMS MSI
          , OE_ORDER_LINES OL
  WHERE   MSI.INVENTORY_ITEM_ID  = OL.INVENTORY_ITEM_ID
  AND     MSI.ORGANIZATION_ID    = p_ship_from_org_id
  AND     OL.LINE_ID             = p_ato_line_id ;
Line: 11029

          SELECT order_date_type_code
          INTO   l_order_date_type_code
          FROM   oe_order_headers
          WHERE  header_id = p_header_id;
Line: 11072

        select order_number
        into l_order_number
        from oe_order_headers
        where header_id = p_header_id;
Line: 11137

            SELECT order_type_id
            INTO   l_order_type_id
            FROM   oe_order_headers_all
            WHERE  header_id = p_header_id;
Line: 11163

         SELECT NAME
         INTO   l_order_type_name
         FROM   OE_TRANSACTION_TYPES_TL
         WHERE  TRANSACTION_TYPE_ID = l_order_type_id
         AND    language = (select language_code
                            from fnd_languages
                            where installed_flag = 'B');
Line: 11197

      SELECT S.SALES_ORDER_ID
      INTO l_sales_order_id
      FROM MTL_SALES_ORDERS S,
           OE_ORDER_HEADERS_ALL H
      WHERE S.SEGMENT1 = TO_CHAR(H.ORDER_NUMBER)
      AND S.SEGMENT2 = l_order_type_name
      AND S.SEGMENT3 = l_source_code
      AND H.HEADER_ID = p_header_id;
Line: 11230

Procedure Name : Insert_Into_Mtl_Sales_Orders
Description    : This API creates a record in MTL_SALES_ORDERS for a given
                 order header.
                 Every header in oe_order_headers_all will have a record
                 in MTL_SALES_ORDERS. The unique key to get the sales_order_id
                 from mtl_sales_orders is
                 Order_Number
                 Order_Type (in base language)
                 OM:Source Code profile option (stored as ont_source_code).

                 The above values are stored in a flex in MTL_SALES_ORDERS.
                 SEGMENT1 : stores the order number
                 SEGMENT2 : stores the order type
                 SEGMENT3 : stores the ont_source_code value

-------------------------------------------------------------------------- */
Procedure Insert_Into_Mtl_Sales_Orders
( p_header_rec       IN  OE_ORDER_PUB.header_rec_type)
IS
l_order_type_name          VARCHAR2(80);
Line: 11261

      oe_debug_pub.add(  'ENTERING INSERT_INTO_MTL_SALES_ORDERS' , 1 ) ;
Line: 11267

     SELECT NAME
     INTO l_order_type_name
     FROM OE_TRANSACTION_TYPES_TL
     WHERE TRANSACTION_TYPE_ID = p_header_rec.order_type_id
     AND language = (select language_code
                     from fnd_languages
                     where installed_flag = 'B');
Line: 11335

      oe_debug_pub.add(  'EXITING INSERT_INTO_MTL_SALES_ORDERS' , 1 ) ;
Line: 11346

            ,   'Insert_Into_Mtl_Sales_Orders'
            );
Line: 11352

END Insert_Into_Mtl_Sales_Orders;
Line: 11359

                 updated to the database.
--------------------------------------------------------------------- */
Procedure call_process_order
( p_x_old_line_tbl      IN  OUT NOCOPY OE_ORDER_PUB.line_tbl_type
, p_x_line_tbl          IN  OUT NOCOPY OE_ORDER_PUB.line_tbl_type
, p_control_rec         IN  OE_GLOBALS.control_rec_type
, p_caller              IN  VARCHAR2
, x_return_status OUT NOCOPY VARCHAR2)

IS
is_set_recursion        VARCHAR2(1) := 'Y';
Line: 11473

                 updated to the database.
--------------------------------------------------------------------- */
Procedure Process_Group_of_Lines
( p_x_old_line_tbl      IN  OUT NOCOPY OE_ORDER_PUB.line_tbl_type
, p_x_line_tbl          IN  OUT NOCOPY OE_ORDER_PUB.line_tbl_type
, p_caller              IN  VARCHAR2
, x_return_status OUT NOCOPY VARCHAR2)

IS
l_process_requests BOOLEAN;
Line: 11536

             oe_debug_pub.add(  'BEFORE DOING DIRECT UPDATE IN GROUP' , 1 ) ;
Line: 11539

         p_x_line_tbl(I).last_update_date := SYSDATE;
Line: 11540

         p_x_line_tbl(I).last_updated_by := FND_GLOBAL.USER_ID;
Line: 11541

         p_x_line_tbl(I).last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 11548

        OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists =>False,
                    p_old_line_rec => p_x_old_line_tbl(I),
                    p_line_rec =>p_x_line_tbl(I),
                    p_line_id => p_x_line_tbl(I).line_id,
                    x_index => l_index,
                    x_return_status => x_return_status);
Line: 11555

              oe_debug_pub.add(  'UPDATE_GLOBAL RETURN STATUS FROM OE_SCHEDULE_UTIL.PROCESS_GROUP_OF_LINE IS: ' || X_RETURN_STATUS ) ;
Line: 11583

           OE_ORDER_UTIL.g_line_tbl(l_index).last_update_date       := p_x_line_tbl(I).last_update_date;
Line: 11584

           OE_ORDER_UTIL.g_line_tbl(l_index).last_updated_by        := p_x_line_tbl(I).last_updated_by;
Line: 11585

           OE_ORDER_UTIL.g_line_tbl(l_index).last_update_login      := p_x_line_tbl(I).last_update_login;
Line: 11593

         UPDATE OE_ORDER_LINES
         SET
          ship_from_org_id           = p_x_line_tbl(I).ship_from_org_id
         ,schedule_ship_date         = p_x_line_tbl(I).schedule_ship_date
         ,schedule_arrival_date      = p_x_line_tbl(I).schedule_arrival_date
         ,delivery_lead_time         = p_x_line_tbl(I).delivery_lead_time
         ,mfg_lead_time              = p_x_line_tbl(I).mfg_lead_time
         ,shipping_method_code       = p_x_line_tbl(I).shipping_method_code
         ,schedule_status_code       = p_x_line_tbl(I).schedule_status_code
         ,visible_demand_flag        = p_x_line_tbl(I).visible_demand_flag
         ,latest_acceptable_date     = p_x_line_tbl(I).latest_acceptable_date
         ,Original_Inventory_Item_Id
                              = p_x_line_tbl(I).Original_Inventory_Item_Id
         ,Original_item_identifier_Type
                              = p_x_line_tbl(I).Original_item_identifier_Type
         ,Original_ordered_item_id   = p_x_line_tbl(I).Original_ordered_item_id
         ,Original_ordered_item      = p_x_line_tbl(I).Original_ordered_item
         ,last_update_date           = p_x_line_tbl(I).last_update_date
         ,last_updated_by            = p_x_line_tbl(I).last_updated_by
         ,last_update_login          = p_x_line_tbl(I).last_update_login
         ,lock_control               = p_x_line_tbl(I).lock_control
         WHERE LINE_ID = p_x_line_tbl(I).line_id;
Line: 11617

             oe_debug_pub.add(  'AFTER DOING DIRECT UPDATE' , 1 ) ;
Line: 11743

                 updated to the database.

New code :  If the warehouse is changed on the line due to scheduling
            we will follow older approch. If warehouse is not changed ont
            the line then call security based on the operation. Call new API
            for clear-dep and defaulting. Based on  the output from the new api
            either call process order or do a direct update.
            p_call_prn is call process_request and notify.
--------------------------------------------------------------------- */
Procedure Process_Line
( p_old_line_rec        IN  OE_ORDER_PUB.line_rec_type
, p_x_line_rec          IN  OUT NOCOPY OE_ORDER_PUB.line_rec_type
, p_caller              IN  VARCHAR2
, p_call_prn            IN  BOOLEAN := TRUE
, x_return_status OUT NOCOPY VARCHAR2)

IS
l_process_requests      BOOLEAN;
Line: 11795

                                       oe_debug_pub.add(  'DIRECT UPDATE FOR A CANCELLED LINE' || P_X_LINE_REC.LINE_ID , 1 ) ;
Line: 11798

         p_x_line_rec.last_update_date := SYSDATE;
Line: 11799

         p_x_line_rec.last_updated_by := FND_GLOBAL.USER_ID;
Line: 11800

         p_x_line_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 11803

         UPDATE OE_ORDER_LINES
         SET
          ship_from_org_id           = p_x_line_rec.ship_from_org_id
         ,schedule_ship_date         = p_x_line_rec.schedule_ship_date
         ,schedule_arrival_date      = p_x_line_rec.schedule_arrival_date
         ,delivery_lead_time         = p_x_line_rec.delivery_lead_time
         ,mfg_lead_time              = p_x_line_rec.mfg_lead_time
         ,shipping_method_code       = p_x_line_rec.shipping_method_code
         ,schedule_status_code       = p_x_line_rec.schedule_status_code
         ,visible_demand_flag        = p_x_line_rec.visible_demand_flag
         ,Original_Inventory_Item_Id = p_x_line_rec.Original_Inventory_Item_Id
         ,Original_item_identifier_Type
                                 = p_x_line_rec.Original_item_identifier_Type
         ,Original_ordered_item_id   = p_x_line_rec.Original_ordered_item_id
         ,Original_ordered_item      = p_x_line_rec.Original_ordered_item
         ,latest_acceptable_date     = p_x_line_rec.latest_acceptable_date
         ,override_atp_date_code     = p_x_line_rec.override_atp_date_code
         ,firm_demand_flag           = p_x_line_rec.firm_demand_flag
         ,earliest_ship_date         = p_x_line_rec.earliest_ship_date
         ,last_update_date           = p_x_line_rec.last_update_date
         ,last_updated_by            = p_x_line_rec.last_updated_by
         ,last_update_login          = p_x_line_rec.last_update_login
         ,lock_control               = p_x_line_rec.lock_control
         WHERE LINE_ID = p_x_line_rec.line_id;
Line: 11829

             oe_debug_pub.add(  'AFTER DOING DIRECT UPDATE ON A CANCELLED LINE' , 1 ) ;
Line: 11865

    l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 11881

      IF p_x_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN

        IF l_debug_level  > 0 THEN
            oe_debug_pub.add(  'IT IS UPDATE , CALL SECURITY' ) ;
Line: 11920

      END IF; -- operation update.
Line: 11924

      OE_GLOBALS.G_ATTR_UPDATED_BY_DEF := 'N';
Line: 11953

          oe_debug_pub.add(  'DIRECT/PO ' || OE_GLOBALS.G_ATTR_UPDATED_BY_DEF , 1 ) ;
Line: 11955

      IF OE_GLOBALS.G_ATTR_UPDATED_BY_DEF = 'Y' THEN


         l_control_rec.controlled_operation := TRUE;
Line: 11979

         l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 12033

             oe_debug_pub.add(  'BEFORE DOING DIRECT UPDATE' , 1 ) ;
Line: 12056

         p_x_line_rec.last_update_date := SYSDATE;
Line: 12057

         p_x_line_rec.last_updated_by := FND_GLOBAL.USER_ID;
Line: 12058

         p_x_line_rec.last_update_login := FND_GLOBAL.LOGIN_ID;
Line: 12062

         UPDATE OE_ORDER_LINES
         SET
          ship_from_org_id           = p_x_line_rec.ship_from_org_id
         ,schedule_ship_date         = p_x_line_rec.schedule_ship_date
         ,schedule_arrival_date      = p_x_line_rec.schedule_arrival_date
         ,delivery_lead_time         = p_x_line_rec.delivery_lead_time
         ,mfg_lead_time              = p_x_line_rec.mfg_lead_time
         ,shipping_method_code       = p_x_line_rec.shipping_method_code
         ,schedule_status_code       = p_x_line_rec.schedule_status_code
         ,visible_demand_flag        = p_x_line_rec.visible_demand_flag
         ,Original_Inventory_Item_Id = p_x_line_rec.Original_Inventory_Item_Id
         ,Original_item_identifier_Type
                                  = p_x_line_rec.Original_item_identifier_Type
         ,Original_ordered_item_id   = p_x_line_rec.Original_ordered_item_id
         ,Original_ordered_item      = p_x_line_rec.Original_ordered_item
         ,latest_acceptable_date     = p_x_line_rec.latest_acceptable_date
         ,override_atp_date_code     = p_x_line_rec.override_atp_date_code
         ,freight_carrier_code       = p_x_line_rec.freight_carrier_code
         ,firm_demand_flag           = p_x_line_rec.firm_demand_flag
         ,earliest_ship_date         = p_x_line_rec.earliest_ship_date
         ,promise_date               = p_x_line_rec.promise_date
         ,last_update_date           = p_x_line_rec.last_update_date
         ,last_updated_by            = p_x_line_rec.last_updated_by
         ,last_update_login          = p_x_line_rec.last_update_login
         ,lock_control               = p_x_line_rec.lock_control
         WHERE LINE_ID = p_x_line_rec.line_id;  --2806483 Added Fright_carrier_code
Line: 12090

             oe_debug_pub.add(  'AFTER DOING DIRECT UPDATE' , 1 ) ;
Line: 12093

      END IF; -- OE_GLOBALS.G_ATTR_UPDATED_BY_DEF.
Line: 12115

      l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 12126

        OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists =>False,
                    p_old_line_rec => p_old_line_rec,
                    p_line_rec =>p_x_line_rec,
                    p_line_id => p_x_line_rec.line_id,
                    x_index => l_index,
                    x_return_status => x_return_status);
Line: 12133

                               oe_debug_pub.add(  'UPDATE_GLOBAL RETURN STATUS FROM OE_SCHEDULE_UTIL.PROCESS_LINE IS: ' || X_RETURN_STATUS ) ;
Line: 12162

          OE_ORDER_UTIL.g_line_tbl(l_index).last_update_date       := p_x_line_rec.last_update_date;
Line: 12163

          OE_ORDER_UTIL.g_line_tbl(l_index).last_updated_by        := p_x_line_rec.last_updated_by;
Line: 12164

          OE_ORDER_UTIL.g_line_tbl(l_index).last_update_login      := p_x_line_rec.last_update_login;
Line: 12312

   g_atp_tbl.Delete;
Line: 12439

   g_atp_tbl.Delete;
Line: 12631

Procedure Delete_Row(p_line_id      IN NUMBER)
IS
l_line_rec               OE_ORDER_PUB.line_rec_type;
Line: 12644

      oe_debug_pub.add(  'ENTERING OE_SCHEDULE_UTIL.DELETE_ROW' , 1 ) ;
Line: 12708

     Log_Delete_Set_Request
       (p_header_id   => l_line_rec.header_id,
        p_line_id     => l_line_rec.line_id,
        p_set_id      => nvl(l_line_rec.ship_set_id,l_line_rec.arrival_set_id),
        x_return_status => l_return_status);
Line: 12714

        oe_debug_pub.add(  'AFTER LOGGING DELETE SETS DELAYED REQUEST ' || L_RETURN_STATUS , 1 ) ;
Line: 12720

	OE_AUDIT_HISTORY_PVT.DELETE_SET_HISTORY( p_line_id     => l_line_rec.line_id, x_return_status => l_return_status);
Line: 12723

		 oe_debug_pub.add(  'AFTER DELETE_SET_HISTORY ' || l_return_status , 1 ) ;
Line: 12742

     Select 'Y'
       Into l_ato_exists
     From oe_order_lines_all
     Where line_id = l_line_rec.ato_line_id;
Line: 12788

        p_param12                => 'DELETE',
        p_param14                => l_line_rec.ship_set_id,
        p_param13                => l_line_rec.arrival_set_id,
        p_param15              => l_line_rec.ship_model_complete_flag,
        p_param25                => l_line_rec.header_id,
        x_return_status          => l_return_status);
Line: 12801

     l_line_rec.operation := OE_GLOBALS.G_OPR_DELETE;
Line: 12815

      oe_debug_pub.add(  'EXITING OE_SCHEDULE_UTIL.DELETE_ROW' , 1 ) ;
Line: 12825

            ,   'Delete_row'
            );
Line: 12829

END Delete_Row;
Line: 13095

           l_local_line_tbl.delete;
Line: 13115

           l_local_line_tbl.delete;
Line: 13136

           l_local_line_tbl.delete;
Line: 13144

               Select ato_line_id
               Into   l_ato_line_id
               From   oe_order_lines_all
               Where  line_id = p_x_line_tbl(I).line_id;
Line: 13172

           l_local_line_tbl.delete;
Line: 13278

                 There is an update line (the line which is getting split)
                 and multiple insert lines (new lines created due to the split).
                 We need to do the following:

                 For scheduling
                 -------------
                 On the updated line: Reschedule the line.
                 On the inserted lines: Schedule the lines.

                 For reservation
                 ---------------
                 If the split is due to shipping, we need to update the
                 reservations (whichever exist) to the new line which
                 got created.

                 If the split is due to the user splitting, there could be
                 multiple records created due to the split. We should update
                 the old reservation to reflect the change in qty for the
                 original line, and create new reservations for the new lines
                 which got created.


---------------------------------------------------------------------- */


Procedure SPLIT_SCHEDULING
( p_x_line_tbl         IN OUT NOCOPY OE_ORDER_PUB.line_tbl_type
, x_return_status OUT NOCOPY VARCHAR2)

IS
l_rsv_qty               NUMBER := 0;
Line: 13378

       IF p_x_line_tbl(I).operation = OE_GLOBALS.G_OPR_UPDATE AND
          p_x_line_tbl(I).schedule_status_code is not null AND
          p_x_line_tbl(I).split_action_code = 'SPLIT' THEN

          IF l_debug_level  > 0 THEN
              oe_debug_pub.add(  'SPLITTING SCHEDULING' , 1 ) ;
Line: 13578

                          oe_debug_pub.add(  'BEFORE DELETE ' || K || '/' || L_RSV_TBL ( K ) .RESERVATION_QUANTITY , 1 ) ;
Line: 13579

                          oe_debug_pub.add(  'BEFORE DELETE Primary ' || K || '/' || L_RSV_TBL ( K ) .PRIMARY_RESERVATION_QUANTITY , 1 ) ;
Line: 13582

                       l_rsv_tbl.delete(K);
Line: 13814

    END IF; -- If operation on the line was UPDATE
Line: 13950

Procedure Name : Update_Results_from_backlog_wb
Description    : This procedure is called from the backlog's scheduler's
                 workbenck and the Supply Chain ATP form, after the user
                 has performed some scheduling in their form. They call
                 this API to update the results of scheduling on the order
                 lines table.
                 For the purpose of this call, we have created a new table type
                 mrp_line_tbl_type, which is table of mrp_line_rec_type.
                 This record is created with only those fields whose values
                 we can get back from MRP's form. We take the field values
                 from this record and update the lines information in
                 oe_order_lines table.
-------------------------------------------------------------------------- */
Procedure Update_Results_from_backlog_wb
( p_mrp_line_tbl  IN  mrp_line_tbl_type
, x_msg_count OUT NOCOPY NUMBER

, x_msg_data OUT NOCOPY VARCHAR2

, x_return_status OUT NOCOPY VARCHAR2)

IS
/*
l_line_rec                  OE_ORDER_PUB.line_rec_type;
Line: 13996

        oe_debug_pub.add(  'ENTERING UPDATE_RESULTS_FROM_BACKLOG_WB' , 1 ) ;
Line: 14045

        l_line_rec.operation             := OE_GLOBALS.G_OPR_UPDATE;
Line: 14106

         Update_PO(l_line_tbl(I).schedule_arrival_date,
                   l_line_tbl(I).source_document_id,
                   l_line_tbl(I).source_document_line_id);
Line: 14123

        oe_debug_pub.add(  'EXITING UPDATE_RESULTS_FROM_BACKLOG_WB' , 1 ) ;
Line: 14158

END Update_Results_from_backlog_wb;
Line: 14340

 SELECT sum(s.onhand_order_qty), sum(s.COMMITTEDSALES_QTY), sum(s.COMMITTEDPROD_QTY)
 FROM ic_summ_inv s
 WHERE s.item_id = p_itemid AND
 s.whse_code = (Select wh.whse_code
                from ic_whse_mst wh
                where wh.MTL_ORGANIZATION_ID = p_organisation_id);
Line: 14349

 SELECT s.onhand_order_qty, s.COMMITTEDSALES_QTY, s.COMMITTEDPROD_QTY
 FROM ic_summ_inv s
 WHERE s.item_id = p_itemid AND
 s.whse_code = (Select wh.whse_code
                from ic_whse_mst wh
                where wh.MTL_ORGANIZATION_ID = p_organisation_id) AND
 s.qc_grade =  (SELECT preferred_grade
               FROM oe_order_lines
               WHERE line_id = p_line_id);
Line: 14362

 SELECT grade_ctl
 FROM ic_item_mst
 WHERE item_id = p_item_id;
Line: 14367

 SELECT preferred_grade
 FROM oe_order_lines
 WHERE line_id = p_line_id;
Line: 14461

   SELECT  '1'
   INTO  l_Pick_status
   FROM  WSH_DELIVERY_DETAILS
   WHERE  SOURCE_CODE = 'OE'
   AND  SOURCE_LINE_ID = p_line_id
   AND  RELEASED_STATUS IN ('S','Y','C');
Line: 14598

        gets updated, but reservation is still for the original UOM (non-primary). So unreservation in this case
        will be done using primary reservation quantity
     */
     IF l_rsv_tbl(1).primary_reservation_quantity > p_quantity_to_unreserve
        AND NOT oe_globals.equal(p_line_rec.order_quantity_uom,l_rsv_tbl(1).reservation_uom_code)
     THEN
        l_qty_to_unreserve      := l_rsv_tbl(1).primary_reservation_quantity ;
Line: 14634

          oe_debug_pub.add(  'CALLING INVS DELETE_RESERVATION' , 3 ) ;
Line: 14636

      inv_reservation_pub.delete_reservation
      ( p_api_version_number      => 1.0
      , p_init_msg_lst            => fnd_api.g_true
      , x_return_status           => x_return_status
      , x_msg_count               => l_msg_count
      , x_msg_data                => l_msg_data
      , p_rsv_rec                 => l_rsv_rec
      , p_serial_number           => l_dummy_sn
      );
Line: 14647

         oe_debug_pub.add(  'AFTER CALLING INVS DELETE_RESERVATION: ' || X_RETURN_STATUS , 1 ) ;
Line: 14720

          oe_debug_pub.add(  'CALLING INVS UPDATE_RESERVATION: ' , 3 ) ;
Line: 14722

      inv_reservation_pub.update_reservation
      ( p_api_version_number        => 1.0
      , p_init_msg_lst              => fnd_api.g_true
      , p_original_rsv_rec          => l_rsv_rec
      , p_to_rsv_rec                => l_rsv_new_rec
      , p_original_serial_number    => l_dummy_sn -- no serial contorl
      , p_to_serial_number          => l_dummy_sn -- no serial control
      , p_validation_flag           => fnd_api.g_true
      , x_return_status             => x_return_status
      , x_msg_count                 => l_msg_count
      , x_msg_data                  => l_msg_data);
Line: 14735

          oe_debug_pub.add(  'AFTER INVS UPDATE_RESERVATION: ' || X_RETURN_STATUS , 1 ) ;
Line: 14796

  SELECT header_id
  FROM oe_order_lines_all
  WHERE line_id = p_x_line_rec.line_id;
Line: 14901

     l_insert_code             NUMBER;
Line: 14902

     l_insert_flag             VARCHAR2(240);
Line: 14925

     SELECT line_id,
            header_id,
            inventory_item_id,
            ordered_item,
            sold_to_org_id,
            ship_to_org_id,
            ship_from_org_id,
            demand_class_code,
            ordered_quantity,
            order_quantity_uom,
            latest_acceptable_date,
            line_number,
            shipment_number,
            option_number,
            delivery_lead_time,
            request_date,
            promise_date,
            project_id,
            task_id,
            shipping_method_code,
            ship_set_id,
            arrival_set_id,
            link_to_line_id,
            ato_line_id,
            item_type_code,
            top_model_line_id,
            component_sequence_id,
            component_code
     FROM OE_ORDER_LINES_ALL
     where header_id = p_header_id AND
          (arrival_set_id = p_arrival_set_id OR
           ship_set_id = p_ship_set_id OR
           top_model_line_id = p_top_model_line_id OR
           ato_line_id = p_ato_line_id) AND
           line_id <> p_line_id AND
           item_type_code <> 'CONFIG';
Line: 14965

              SELECT header_id,
                     inventory_item_id,
                     ordered_item,
                     sold_to_org_id,
                     ship_to_org_id,
                     ship_from_org_id,
                     demand_class_code,
                     ordered_quantity,
                     order_quantity_uom,
                     latest_acceptable_date,
                     line_number,
                     shipment_number,
                     option_number,
                     ship_model_complete_flag,
                     top_model_line_id,
                     ato_line_id,
                     delivery_lead_time,
                     request_date,
                     promise_date,
                     project_id,
                     task_id,
                     shipping_method_code,
                     ship_set_id,
                     arrival_set_id,
                     item_type_code,
                     link_to_line_id,
                     component_code,
                     component_sequence_id
              INTO l_header_id,
                   l_inventory_item_id,
                   l_ordered_item,
                   l_sold_to_org_id,
                   l_ship_to_org_id,
                   l_ship_from_org_id,
                   l_demand_class,
                   l_quantity_ordered,
                   l_uom_code,
                   l_latest_acceptable_date,
                   l_line_number,
                   l_shipment_number,
                   l_option_number,
                   l_smc_flag,
                   l_top_model_line_id,
                   l_ato_line_id,
                   l_delivery_lead_time,
                   l_request_date,
                   l_promise_date,
                   l_project_id,
                   l_task_id,
                   l_ship_method,
                   l_ship_set_id,
                   l_arrival_set_id,
                   l_item_type_code,
                   l_link_to_line_id,
                   l_component_code,
                   l_component_sequence_id
              FROM oe_order_lines_all
              WHERE line_id = p_line_id;
Line: 15026

              SELECT ORDER_NUMBER ,ORDER_DATE_TYPE_CODE
              INTO   l_order_number,l_order_date_type_code
              FROM   oe_order_headers
              WHERE  header_id=l_header_id;
Line: 15086

                  SELECT NAME
                  INTO l_customer_name
                  FROM OE_SOLD_TO_ORGS_V
                  WHERE organization_id = l_sold_to_org_id;
Line: 15099

                  SELECT NAME
                  INTO l_customer_location
                  FROM OE_SHIP_TO_ORGS_V
                  WHERE organization_id = l_ship_to_org_id;
Line: 15113

                  SELECT SET_NAME
                  INTO l_ship_set_name
                  FROM OE_SETS
                  WHERE set_id = l_ship_set_id;
Line: 15135

                  SELECT SET_NAME
                  INTO l_arrival_set_name
                  FROM OE_SETS
                  WHERE set_id = l_arrival_set_id;
Line: 15154

                   Select line_id
                   Into   l_config_line_id
                   From   oe_order_lines_all
                   Where  ato_line_id = l_line_id
                   And    item_type_code = 'CONFIG';
Line: 15175

         SELECT instance_id
            INTO l_instance_id
            FROM mrp_ap_apps_instances;
Line: 15179

            l_insert_flag :=  fnd_profile.value('MRP_ATP_CALC_SD');
Line: 15181

            IF nvl(l_insert_flag,'N') = 'Y' THEN
               l_insert_code   := 1;
Line: 15184

               l_insert_code   := 2;
Line: 15189

            INSERT INTO MRP_ATP_SCHEDULE_TEMP
            (INVENTORY_ITEM_ID,
          SR_INSTANCE_ID,
             SOURCE_ORGANIZATION_ID,
             CUSTOMER_ID,
             CUSTOMER_SITE_ID,
             DESTINATION_TIME_ZONE,
             QUANTITY_ORDERED,
             UOM_CODE,
             REQUESTED_SHIP_DATE,
             REQUESTED_ARRIVAL_DATE,
             LATEST_ACCEPTABLE_DATE,
             DELIVERY_LEAD_TIME,
             FREIGHT_CARRIER,
             INSERT_FLAG,
             SHIP_METHOD,
             DEMAND_CLASS,
             SHIP_SET_NAME,
             SHIP_SET_ID,
             ARRIVAL_SET_NAME,
             ARRIVAL_SET_ID,
             OVERRIDE_FLAG,
             SESSION_ID,
             ORDER_HEADER_ID,
             ORDER_LINE_ID,
             INVENTORY_ITEM_NAME,
             SOURCE_ORGANIZATION_CODE,
             ORDER_LINE_NUMBER,
             SHIPMENT_NUMBER,
             OPTION_NUMBER,
             PROMISE_DATE,
             CUSTOMER_NAME,
             CUSTOMER_LOCATION,
             OLD_LINE_SCHEDULE_DATE,
             OLD_SOURCE_ORGANIZATION_CODE,
             CALLING_MODULE,
             ACTION,
             STATUS_FLAG,
             SCENARIO_ID,
             ATP_LEAD_TIME,
             ORDER_NUMBER,
             OLD_SOURCE_ORGANIZATION_ID,
             OLD_DEMAND_CLASS,
             PROJECT_ID,
             TASK_ID,
             PROJECT_NUMBER,
             TASK_NUMBER,
             SHIP_METHOD_TEXT,
             TOP_MODEL_LINE_ID,
             ATO_MODEL_LINE_ID,
             PARENT_LINE_ID,
             VALIDATION_ORG,
             COMPONENT_SEQUENCE_ID,
             COMPONENT_CODE,
             INCLUDED_ITEM_FLAG,
             LINE_NUMBER,
             CONFIG_ITEM_LINE_ID
             )
            VALUES
            (l_inventory_item_id,
             l_instance_id,
             l_ship_from_org_id,  --null -- Bug 2913742
             l_sold_to_org_id, -- CUSTOMER_ID
             l_ship_to_org_id, -- CUSTOMER_SITE_ID
             null,  -- DESTINATION_TIME_ZONE
             l_quantity_ordered,
             l_uom_code,
             l_requested_ship_date,
             l_requested_arrival_date,
             l_latest_acceptable_date,
             l_delivery_lead_time,
             l_freight_carrier,
             l_insert_code,
             l_ship_method,
             l_demand_class,
             l_ship_set_name,
             l_ship_set_id_1,
             l_arrival_set_name,
             l_arrival_set_id,
             null, -- OVERRIDE_FLAG
             l_session_id,
             l_header_id,
             l_line_id,
             l_ordered_item, -- l_INVENTORY_ITEM_NAME,
             null, -- l_SOURCE_ORGANIZATION_CODE,
             l_line_number,
             l_shipment_number,
             l_option_number,
             l_promise_date,
             l_customer_name,
             l_customer_location,
             null, -- l_OLD_LINE_SCHEDULE_DATE,
             null, -- l_OLD_SOURCE_ORGANIZATION_CODE,
             null, -- l_CALLING_MODULE,
             100,
             4, -- l_STATUS_FLAG,
             l_scenario_id,
             l_atp_lead_time,
             l_order_number,
             l_ship_from_org_id,
             l_demand_class,
             l_project_id,
             l_task_id,
             l_project_number,
             l_task_number,
             l_ship_method_text,
             l_top_model_line_id,
             l_ato_model_line_id,
             l_link_to_line_id,
             OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID'),
             l_component_sequence_id,
             l_component_code,
             1 , --l_included_item_flag
             l_conc_line_number,
             l_config_line_id
             );
Line: 15409

                         SELECT NAME
                         INTO l_customer_name
                         FROM OE_SOLD_TO_ORGS_V
                         WHERE organization_id = l_sold_to_org_id;
Line: 15422

                         SELECT NAME
                         INTO l_customer_location
                         FROM OE_SHIP_TO_ORGS_V
                         WHERE organization_id = l_ship_to_org_id;
Line: 15435

                         SELECT SET_NAME
                         INTO l_ship_set_name
                         FROM OE_SETS
                         WHERE set_id = l_ship_set_id;
Line: 15448

                         SELECT SET_NAME
                         INTO l_arrival_set_name
                         FROM OE_SETS
                         WHERE set_id = l_arrival_set_id;
Line: 15482

                          Select line_id
                          Into   l_config_line_id
                          From   oe_order_lines_all
                          Where  ato_line_id = l_line_id
                          And    item_type_code = 'CONFIG';
Line: 15504

                   INSERT INTO MRP_ATP_SCHEDULE_TEMP
                   (INVENTORY_ITEM_ID,
                 SR_INSTANCE_ID,
                    SOURCE_ORGANIZATION_ID,
                    CUSTOMER_ID,
                    CUSTOMER_SITE_ID,
                    DESTINATION_TIME_ZONE,
                    QUANTITY_ORDERED,
                    UOM_CODE,
                    REQUESTED_SHIP_DATE,
                    REQUESTED_ARRIVAL_DATE,
                    LATEST_ACCEPTABLE_DATE,
                    DELIVERY_LEAD_TIME,
                    FREIGHT_CARRIER,
                    INSERT_FLAG,
                    SHIP_METHOD,
                    DEMAND_CLASS,
                    SHIP_SET_NAME,
                    SHIP_SET_ID,
                    ARRIVAL_SET_NAME,
                    ARRIVAL_SET_ID,
                    OVERRIDE_FLAG,
                    SESSION_ID,
                    ORDER_HEADER_ID,
                    ORDER_LINE_ID,
                    INVENTORY_ITEM_NAME,
                    SOURCE_ORGANIZATION_CODE,
                    ORDER_LINE_NUMBER,
                    SHIPMENT_NUMBER,
                    OPTION_NUMBER,
                    PROMISE_DATE,
                    CUSTOMER_NAME,
                    CUSTOMER_LOCATION,
                    OLD_LINE_SCHEDULE_DATE,
                    OLD_SOURCE_ORGANIZATION_CODE,
                    CALLING_MODULE,
                    ACTION,
                    STATUS_FLAG,
                    SCENARIO_ID,
                    ATP_LEAD_TIME,
                    ORDER_NUMBER,
                    OLD_SOURCE_ORGANIZATION_ID,
                    OLD_DEMAND_CLASS,
                    PROJECT_ID,
                    TASK_ID,
                    PROJECT_NUMBER,
                    TASK_NUMBER,
                    SHIP_METHOD_TEXT,
                    TOP_MODEL_LINE_ID,
                    ATO_MODEL_LINE_ID,
                    PARENT_LINE_ID,
                    VALIDATION_ORG,
                    COMPONENT_SEQUENCE_ID,
                    COMPONENT_CODE,
                    INCLUDED_ITEM_FLAG,
                    LINE_NUMBER,
                    CONFIG_ITEM_LINE_ID
                    )
                   VALUES
                   (l_inventory_item_id,
                    l_instance_id,
                    l_ship_from_org_id,  --null -- Bug 2913742
                    l_sold_to_org_id, -- CUSTOMER_ID
                    l_ship_to_org_id, -- CUSTOMER_SITE_ID
                    null,  -- DESTINATION_TIME_ZONE
                    l_quantity_ordered,
                    l_uom_code,
                    l_requested_ship_date,
                    l_requested_arrival_date,
                    l_latest_acceptable_date,
                    l_delivery_lead_time,
                    l_freight_carrier,
                    l_insert_code,
                    l_ship_method,
                    l_demand_class,
                    l_ship_set_name,
                    l_ship_set_id_1,
                    l_arrival_set_name,
                    l_arrival_set_id,
                    null, -- OVERRIDE_FLAG
                    l_session_id,
                    l_header_id,
                    l_line_id,
                    l_ordered_item, -- l_INVENTORY_ITEM_NAME,
                    null, -- l_SOURCE_ORGANIZATION_CODE,
                    l_line_number,
                    l_shipment_number,
                    l_option_number,
                    l_promise_date,
                    l_customer_name,
                    l_customer_location,
                    null, -- l_OLD_LINE_SCHEDULE_DATE,
                    null, -- l_OLD_SOURCE_ORGANIZATION_CODE,
                    null, -- l_CALLING_MODULE,
                    100,
                    4, -- l_STATUS_FLAG,
                    l_scenario_id,
                    l_atp_lead_time,
                    l_order_number,
                    l_ship_from_org_id,
                    l_demand_class,
                    l_project_id,
                    l_task_id,
                    l_project_number,
                    l_task_number,
                    l_ship_method_text,
                    l_top_model_line_id,
                    l_ato_model_line_id,
                    l_link_to_line_id,
                    OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID'),
                    l_component_sequence_id,
                    l_component_code,
                    1 , --l_included_item_flag
                    l_conc_line_number,
                    l_config_line_id
                    );
Line: 15675

       l_line_tbl(I).operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 15715

    OE_Set_Util.Update_Set
        (p_Set_Id                   => p_request_rec.param2,
         p_Shipping_Method_Code     => p_request_rec.param3,
         X_Return_Status            => x_return_status,
         x_msg_count                => l_msg_count,
         x_msg_data                 => l_msg_data
        );
Line: 15861

select line_id , schedule_action_code
from oe_schedule_lines_temp;
Line: 15919

       l_line_tbl(j).operation := OE_GLOBALS.G_OPR_UPDATE; --6715950
Line: 15932

     OE_SCHEDULE_UTIL.OE_Delayed_Schedule_line_tbl.delete;
Line: 15991

  SELECT PICK_STATUS
  FROM   WSH_DELIVERY_LINE_STATUS_V
  WHERE  SOURCE_CODE = 'OE'
  AND    SOURCE_LINE_ID = OE_LINE_SECURITY.g_record.line_id
  AND    PICK_STATUS NOT IN ('N', 'R', 'X');
Line: 16034

      SELECT shippable_item_flag
      INTO   l_shippable_flag
      FROM   MTL_SYSTEM_ITEMS
      WHERE  INVENTORY_ITEM_ID = p_new_inventory_item_id
      AND    ORGANIZATION_ID = p_new_ship_from_org_id;