DBA Data[Home] [Help]

APPS.OE_CONFIG_PVT SQL Statements

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

Line: 11

Procedure update_link_to_line_id
( p_top_model_line_id  IN  NUMBER
 ,p_remnant_flag       IN  VARCHAR2
 ,p_config_hdr_id      IN  NUMBER);
Line: 16

Procedure update_ato_line_attributes
( p_top_model_line_id   IN  NUMBER
 ,p_ui_flag             IN  VARCHAR2
 ,p_config_hdr_id       IN  NUMBER);
Line: 28

PROCEDURE Handle_Inserts
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_config_instance_tbl IN csi_datastructures_pub.instance_cz_tbl
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2 := 'Y');
Line: 38

PROCEDURE Handle_Inserts_Old
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN BOOLEAN := FALSE);
Line: 46

PROCEDURE Handle_Updates
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2);
Line: 55

PROCEDURE Handle_Updates_old
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2);
Line: 64

PROCEDURE Handle_Deletes
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2);
Line: 73

PROCEDURE Handle_Deletes_Old
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2);
Line: 92

   insert,update,or deletethem from order_lines.

   We will open three cursors :
     the first to pass an operation of INSERT
     for records which do not exist
     =>  handle_inserts proc
     The second to pass an operation of UPDATE
     for records which already exist.
     =>  handle_updates prc
     The third to pass an operation of DELETE
     for records which exist but are no longer selected.
     =>  handle_deletes proc

   get values from cz_config_details_v
   viz.  comp_code, qty, cfg_hdr_id, rev_no
   and bom_explosions viz.
   component_sequence_id, sort_order, bom_item_type,
   bill_sequence_id, top_bill_sequence_id

   call process_order and update the links.

   If the p_ui_flag 'Y', we set the control_rec.process to TRUE
   This means when options are created using configurator,
   we want all the delayed requests to be processed.
   when order_import calls process_order to create options,
   control_rec.process is set to false so that delayed requests
   do not get processed in the recursive call to process_order
   after batch validation.

Change Record:
Bug 2181376: explode bill is not required since in handle_inserts
procedure we will selecet all required data from cz_config_details_v
and do not need to join with bom_explosions anymore. This change is
also useful for multiple instance project.
--------------------------------------------------------------------*/

Procedure Process_Config(p_header_id          IN  NUMBER
                        ,p_config_hdr_id      IN  NUMBER
                        ,p_config_rev_nbr     IN  NUMBER
                        ,p_top_model_line_id  IN  NUMBER
                        ,p_ui_flag            IN  VARCHAR2 :='Y'
                        ,p_config_instance_tbl IN
                         csi_datastructures_pub.instance_cz_tbl := G_CONFIG_INSTANCE_TBL
                        ,x_change_flag        OUT NOCOPY /* file.sql.39 change */ VARCHAR2
                        ,x_msg_count          OUT NOCOPY /* file.sql.39 change */ NUMBER
                        ,x_msg_data           OUT NOCOPY /* file.sql.39 change */ VARCHAR2
                        ,x_return_status      OUT NOCOPY /* file.sql.39 change */ VARCHAR2
                        )
IS

  -- general, column_changes and and cz's delete api stuff
  l_direct_save                BOOLEAN;
Line: 178

  OE_MSG_PUB.update_msg_context
    ( p_entity_code                 => 'LINE'
     ,p_entity_id                   => l_model_line_rec.line_id
     ,p_header_id                   => l_model_line_rec.header_id
     ,p_line_id                     => l_model_line_rec.line_id
     ,p_orig_sys_document_ref       => l_model_line_rec.orig_sys_document_ref
     ,p_orig_sys_document_line_ref  => l_model_line_rec.orig_sys_line_ref
     ,p_orig_sys_shipment_ref       => l_model_line_rec.orig_sys_shipment_ref
     ,p_change_sequence             => l_model_line_rec.change_sequence
     ,p_source_document_id          => l_model_line_rec.source_document_id
     ,p_source_document_line_id     => l_model_line_rec.source_document_line_id
     ,p_order_source_id             => l_model_line_rec.order_source_id
     ,p_source_document_type_id     => l_model_line_rec.source_document_type_id);
Line: 214

        SELECT quantity, config_item_id
        INTO   l_model_new_qty, l_model_line_rec.configuration_id
        FROM   cz_config_details_v
        WHERE  config_hdr_id     = p_config_hdr_id
        AND    config_rev_nbr    = p_config_rev_nbr
        AND    inventory_item_id = l_model_line_rec.inventory_item_id;
Line: 222

        UPDATE OE_ORDER_LINES_ALL
        SET CONFIGURATION_ID = l_model_line_rec.configuration_id
        WHERE inventory_item_id = l_model_line_rec.inventory_item_id
        AND LINE_ID = l_model_line_rec.line_id;
Line: 234

            oe_debug_pub.add(  'QTY SELECT: '|| SQLERRM , 1 ) ;
Line: 242

          oe_debug_pub.add('UPDATE MODEL WITH NEW QTY '|| L_MODEL_NEW_QTY,1);
Line: 246

        l_model_line_rec.operation              := OE_GLOBALS.G_OPR_UPDATE;
Line: 254

  Handle_Inserts(p_model_line_rec   => l_model_line_rec
                ,p_config_hdr_id    => p_config_hdr_id
                ,p_config_rev_nbr   => p_config_rev_nbr
                ,p_x_line_tbl       => l_line_tbl
                ,p_config_instance_tbl => p_config_instance_tbl
                ,p_x_class_line_tbl => l_class_line_tbl
                ,p_direct_save      => l_direct_save
                ,p_ui_flag          => p_ui_flag);
Line: 270

    Handle_Updates(p_model_line_rec   => l_model_line_rec
                  ,p_config_hdr_id    => p_config_hdr_id
                  ,p_config_rev_nbr   => p_config_rev_nbr
                  ,p_x_line_tbl       => l_line_tbl
                  ,p_x_class_line_tbl => l_class_line_tbl
                  ,p_direct_save      => FALSE
                  ,p_ui_flag          => p_ui_flag);
Line: 278

    Handle_Deletes(p_model_line_rec   => l_model_line_rec
                  ,p_config_hdr_id    => p_config_hdr_id
                  ,p_config_rev_nbr   => p_config_rev_nbr
                  ,p_x_line_tbl       => l_line_tbl
                  ,p_x_class_line_tbl => l_class_line_tbl
                  ,p_direct_save      => FALSE
                  ,p_ui_flag          => p_ui_flag);
Line: 316

    ,p_update_columns    => TRUE
    ,x_return_status     => l_return_status);
Line: 331

    oe_debug_pub.add('do not delete, special', 1);
Line: 337

      Delete_Config( p_config_hdr_id   =>  p_config_hdr_id
                    ,p_config_rev_nbr  =>  p_config_rev_nbr
                    ,x_return_status   =>  l_return_status_del);
Line: 353

         Delete_Config( p_config_hdr_id   =>  l_model_line_rec.config_header_id
                       ,p_config_rev_nbr  =>  l_model_line_rec.config_rev_nbr
                       ,x_return_status   =>  l_return_status_del);
Line: 358

  END IF; -- do no delete
Line: 422

PROCEDURE Handle_Inserts

if a component is present in cz_config_details_v but not present
in oe_order_lines, we need to insert it.

Change Record:
Bug 2181376: explode bill is not required since in this
procedure we will selecet all required data from cz_config_details_v
and do not need to join with bom_explosions anymore. This change is
also useful for multiple instance project
Bug 2869052 :
Default_Child_Line procedure would be called only if there are
any new class lines to be created and direct save shoule be true.
If the call returns an error an exception would be raised. New
variable l_default_child_line has been created.

MACD: Line Type Support -  modified the cursor to select the line_type
also and then if it null and not missing, assigning the child line
record's line_type_id to the retreived line_type

Bug 3611416
Send reason for CREATE operation also, will be required if there is
a require reason constraint for versioning during create operation.

bug3578056
for a new configuration, the IB fields should be NULL for the
top model and child lines
-------------------------------------------------------------------*/

PROCEDURE Handle_Inserts
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_config_instance_tbl IN csi_datastructures_pub.instance_cz_tbl
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2 := 'Y')
IS

  CURSOR config_ins_cursor IS
    SELECT c.component_code, c.quantity
          ,c.uom_code, c.inventory_item_id
          ,c.instance_hdr_id, c.instance_rev_nbr
          ,c.component_sequence_id, c.bom_sort_order
          ,c.bom_item_type, c.config_item_id
          ,c.line_type
    FROM  CZ_CONFIG_DETAILS_V c
    WHERE c.config_hdr_id         = p_config_hdr_id
    AND   c.config_rev_nbr        = p_config_rev_nbr
    AND NOT EXISTS
          ( SELECT 'X'
            FROM  oe_order_lines l
            WHERE l.top_model_line_id = p_model_line_rec.line_id
            AND   l.component_code    = c.component_code
            AND   l.configuration_id  = c.config_item_id
            AND   l.open_flag         = 'Y')
    ORDER BY c.component_code;
Line: 496

  Print_Time('Handle_Inserts start time');
Line: 506

      UPDATE oe_order_lines oe
      SET ( configuration_id , sort_order ) =
        (SELECT config_item_id , bom_sort_order --bug6628691
         FROM   cz_config_details_v
         WHERE  config_hdr_id = p_config_hdr_id
         AND    config_rev_nbr = p_config_rev_nbr
         AND    component_code = oe.component_code
        )
      WHERE top_model_line_id = p_model_line_rec.line_id
      AND   config_header_id is NULL
      AND   configuration_id is NULL
      AND   item_type_code in ('MODEL', 'CLASS', 'OPTION', 'KIT')
      AND   open_flag = 'Y';
Line: 522

          oe_debug_pub.add(  'CONFIGURATION_ID UPDATED '|| SQL%ROWCOUNT ,3);
Line: 526

          oe_debug_pub.add(  'CRM 1:CONFIGURATION_ID NOT UPDATED ' , 3 ) ;
Line: 529

        UPDATE oe_order_lines oe
        SET ( configuration_id , sort_order ) =
          (SELECT config_item_id , bom_sort_order --bug6628691
           FROM   cz_config_details_v
           WHERE  config_hdr_id = p_config_hdr_id
           AND    config_rev_nbr = p_config_rev_nbr
           AND    component_code = oe.component_code
	           )
        WHERE top_model_line_id = p_model_line_rec.line_id
        AND   configuration_id is NULL
        AND   item_type_code in ('MODEL', 'CLASS', 'OPTION', 'KIT')
        AND   open_flag = 'Y';
Line: 548

            oe_debug_pub.add(  'CRM 2:CONFIGURATION_ID NOT UPDATED ' , 3 ) ;
Line: 569

    Handle_Inserts_Old
    (p_model_line_rec   => p_model_line_rec
    ,p_config_hdr_id    => p_config_hdr_id
    ,p_config_rev_nbr   => p_config_rev_nbr
    ,p_x_line_tbl       => p_x_line_tbl
    ,p_x_class_line_tbl => p_x_class_line_tbl
    ,p_direct_save      => p_direct_save);
Line: 676

      SELECT concatenated_segments
      INTO l_concatenated_segments
      FROM MTL_SYSTEM_ITEMS_KFV
      WHERE inventory_item_id = config_rec.inventory_item_id
      AND organization_id = OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID');
Line: 688

      oe_debug_pub.add('INSERTING COMP CODE: '||CONFIG_REC.COMPONENT_CODE,1);
Line: 744

      SELECT  OE_ORDER_LINES_S.NEXTVAL
      INTO    l_class_line_rec.line_id
      FROM    DUAL;
Line: 793

  Print_Time('Handle_Inserts end time');
Line: 797

      oe_debug_pub.add(  'EXCEPTION IN HANDLE_INSERTS'|| SQLERRM , 1 ) ;
Line: 801

END Handle_Inserts;
Line: 806

PROCEDURE Handle_Inserts_Old

if a component is present in cz_config_details_v but not present
in oe_order_lines, we need to insert it.

Change Record:
Bug 2181376: explode bill is not required since in this
procedure we will selecet all required data from cz_config_details_v
and do not need to join with bom_explosions anymore. This change is
also useful for multiple instance project.
Bug 2869052 :
Default_Child_Line procedure would be called only if there are
any new class lines to be created and direct save shoule be true.
If the call returns an error an exception would be raised. New
variable l_default_child_line has been created.
-------------------------------------------------------------*/

PROCEDURE Handle_Inserts_Old
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN BOOLEAN := FALSE)
IS

  CURSOR config_ins_cursor IS
    SELECT c.component_code, c.quantity
          ,c.uom_code, c.inventory_item_id
          ,c.component_sequence_id, c.bom_sort_order
          ,c.bom_item_type
    FROM  CZ_CONFIG_DETAILS_V c
    WHERE c.config_hdr_id         = p_config_hdr_id
    AND   c.config_rev_nbr        = p_config_rev_nbr
    AND NOT EXISTS
          ( SELECT 'X'
            FROM  oe_order_lines l
            WHERE l.top_model_line_id = p_model_line_rec.line_id
            AND   l.component_code    = c.component_code
            AND   l.open_flag         = 'Y')
    ORDER BY c.component_code;
Line: 859

  Print_Time('Handle_Inserts start time');
Line: 877

      SELECT concatenated_segments
      INTO l_concatenated_segments
      FROM MTL_SYSTEM_ITEMS_KFV
      WHERE inventory_item_id = config_rec.inventory_item_id
      AND organization_id = OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID');
Line: 889

      oe_debug_pub.add('INSERTING COMP CODE: ' || CONFIG_REC.COMPONENT_CODE,1);
Line: 925

      SELECT  OE_ORDER_LINES_S.NEXTVAL
      INTO    l_class_line_rec.line_id
      FROM    DUAL;
Line: 961

  Print_Time('Handle_Inserts_Old end time');
Line: 965

      oe_debug_pub.add(  'EXCEPTION IN HANDLE_INSERTS_OLD'|| SQLERRM , 1 ) ;
Line: 968

END Handle_Inserts_Old;
Line: 972

PROCEDURE Handle_Updates

If quantity of a component is different in oe_order_lines and
cz_config_details_v, we need to update that component.

for config UI only: if there is a constraint on qty change,
should we pass a hardcoded reason/comment, or should we fail?
we should fail.

MACD: Compare the line type in OM and CZ and if different
select into cursor. Also, set the child line record's line_type to
the selected value from cz
------------------------------------------------------------*/

PROCEDURE Handle_Updates
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2)
IS
  CURSOR config_upd_cursor IS
    SELECT distinct
          l.line_id
         ,c.component_code
         ,c.quantity
         ,l.ordered_quantity
         ,l.cancelled_quantity -- 12695580
         ,l.item_type_code
         ,c.line_type
         ,c.bom_sort_order
    FROM  CZ_CONFIG_DETAILS_V c, oe_order_lines l
    WHERE c.config_hdr_id     = p_config_hdr_id
    AND   c.config_rev_nbr    = p_config_rev_nbr
    AND   (c.quantity <> l.ordered_quantity OR
           c.line_type <> l.line_type_id OR
           c.bom_sort_order <> l.sort_order)
    AND   l.top_model_line_id = p_model_line_rec.line_id
    AND   l.component_code    = c.component_code
    AND   l.configuration_id  = c.config_item_id
    AND   l.open_flag         = 'Y';
Line: 1024

  Print_Time('Handle_Updates start time');
Line: 1032

    Handle_Updates_Old
    (p_model_line_rec   => p_model_line_rec
    ,p_config_hdr_id    => p_config_hdr_id
    ,p_config_rev_nbr   => p_config_rev_nbr
    ,p_x_line_tbl       => p_x_line_tbl
    ,p_x_class_line_tbl => p_x_class_line_tbl
    ,p_direct_save      => FALSE
    ,p_ui_flag          => p_ui_flag);
Line: 1052

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

  Print_Time('Handle_Updates end time');
Line: 1120

      oe_debug_pub.add(  'EXCEPTION IN HANDLE_UPDATES'|| SQLERRM , 1 ) ;
Line: 1130

END Handle_Updates;
Line: 1134

PROCEDURE Handle_Updates_Old

If quantity of a component is different in oe_order_lines and
cz_config_details_v, we need to update that component.

for config UI only: if there is a constraint on qty change,
should we pass a hardcoded reason/comment, or should we fail?
we should fail.
------------------------------------------------------------*/

PROCEDURE Handle_Updates_Old
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2)
IS
  CURSOR config_upd_cursor IS
    SELECT distinct
          l.line_id
         ,c.component_code
         ,c.quantity
         ,l.ordered_quantity
         ,l.item_type_code
    FROM  CZ_CONFIG_DETAILS_V c, oe_order_lines l
    WHERE c.config_hdr_id     = p_config_hdr_id
    AND   c.config_rev_nbr    = p_config_rev_nbr
    AND   c.quantity <> l.ordered_quantity
    AND   l.top_model_line_id = p_model_line_rec.line_id
    AND   l.component_code    = c.component_code
    AND   l.open_flag         = 'Y';
Line: 1176

  Print_Time('Handle_Updates_Old start time');
Line: 1182

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

  Print_Time('Handle_Updates_Old end time');
Line: 1222

      oe_debug_pub.add(  'EXCEPTION IN HANDLE_UPDATES_OLD'|| SQLERRM , 1 ) ;
Line: 1225

END Handle_Updates_Old;
Line: 1229

PROCEDURE Handle_Deletes

If a component exists in oe_order_lines, but does not exist
in cz_config_details_v, we need to delete that component.

Change Record:

bug 1939531: to not call check_if_cancellation
if first configuration is yet getting saved for the first
time and link_to_line_id is not yet populated.

do not call the check_if_cancellation id p_ui_flag is 'Y'.
This is because,
1) you can not enter reason and comment in configurator, so
if cancellation constraint is on, delete will fail.
2) configuraor will take care of cascading change to
child and parent lines, so we do not have to check in
oe_order_lines.
----------------------------------------------------------*/

PROCEDURE Handle_Deletes
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2)
IS
 CURSOR config_del_cursor IS
    SELECT l.line_id, l.item_type_code, l.link_to_line_id,
           l.component_code, nvl(l.cancelled_flag, 'N') cancelled_flag
    FROM   oe_order_lines l
    WHERE  l.top_model_line_id = p_model_line_rec.line_id
    AND    (l.item_type_code = OE_GLOBALS.G_ITEM_CLASS OR
            l.item_type_code = OE_GLOBALS.G_ITEM_OPTION OR
            l.item_type_code = OE_GLOBALS.G_ITEM_KIT)
    AND     l.open_flag       = 'Y'
    AND
    (NOT EXISTS
          (     SELECT 'X'
                FROM   CZ_CONFIG_DETAILS_V c
                WHERE  c.component_code = l.component_code
                AND    c.config_item_id = l.configuration_id
                AND    c.config_hdr_id  = p_config_hdr_id
                AND    c.config_rev_nbr = p_config_rev_nbr )
    OR EXISTS
          (     SELECT 'X'
                FROM   CZ_CONFIG_DETAILS_V c
                WHERE  c.component_code = l.component_code
                AND    c.config_item_id = l.configuration_id
                AND    c.config_hdr_id  = p_config_hdr_id
                AND    c.config_rev_nbr = p_config_rev_nbr
                AND    c.quantity = 0));
Line: 1296

  Print_Time('Handle_Deletes start time');
Line: 1304

   Handle_Deletes_Old
   ( p_model_line_rec   => p_model_line_rec
    ,p_config_hdr_id    => p_config_hdr_id
    ,p_config_rev_nbr   => p_config_rev_nbr
    ,p_x_line_tbl       => p_x_line_tbl
    ,p_x_class_line_tbl => p_x_class_line_tbl
    ,p_direct_save      => FALSE
    ,p_ui_flag          => p_ui_flag);
Line: 1349

      Is_Cancel_OR_Delete
      ( p_line_id           => config_rec.line_id
       ,p_change_reason     => l_change_reason
       ,p_change_comments   => l_change_comments
       ,x_cancellation      => l_cancellation
       ,x_line_rec          => l_line_rec);
Line: 1365

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

        oe_debug_pub.add('LINE_ID TO BE DELETED: ' || CONFIG_REC.LINE_ID ,1);
Line: 1389

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

  Print_Time('Handle_Deletes end time');
Line: 1411

      oe_debug_pub.add(  'EXCEPTION IN HANDLE_DELETES'|| SQLERRM , 1 ) ;
Line: 1414

END Handle_Deletes;
Line: 1418

PROCEDURE Handle_Deletes_Old

If a component exists in oe_order_lines, but does not exist
in cz_config_details_v, we need to delete that component.

Change Record:

bug 1939531: to not call check_if_cancellation
if first configuration is yet getting saved for the first
time and link_to_line_id is not yet populated.

do not call the check_if_cancellation id p_ui_flag is 'Y'.
This is because,
1) you can not enter reason and comment in configurator, so
if cancellation constraint is on, delete will fail.
2) configuraor will take care of cascading change to
child and parent lines, so we do not have to check in
oe_order_lines.
----------------------------------------------------------*/

PROCEDURE Handle_Deletes_Old
( p_model_line_rec    IN  OE_Order_Pub.Line_rec_Type
 ,p_config_hdr_id     IN  NUMBER
 ,p_config_rev_nbr    IN  NUMBER
 ,p_x_line_tbl        IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_x_class_line_tbl  IN  OUT NOCOPY OE_Order_Pub.Line_tbl_Type
 ,p_direct_save       IN  BOOLEAN := FALSE
 ,p_ui_flag           IN  VARCHAR2)
IS
 CURSOR config_del_cursor IS
    SELECT l.line_id, l.item_type_code, l.link_to_line_id,
           l.component_code
    FROM   oe_order_lines l
    WHERE  l.top_model_line_id = p_model_line_rec.line_id
    AND    (l.item_type_code = OE_GLOBALS.G_ITEM_CLASS OR
            l.item_type_code = OE_GLOBALS.G_ITEM_OPTION OR
            l.item_type_code = OE_GLOBALS.G_ITEM_KIT)
    AND     l.open_flag       = 'Y'
    AND
    (NOT EXISTS
          (     SELECT 'X'
                FROM   CZ_CONFIG_DETAILS_V c
                WHERE  c.component_code = l.component_code
                AND    c.config_hdr_id  = p_config_hdr_id
                AND    c.config_rev_nbr = p_config_rev_nbr )
    OR EXISTS
          (     SELECT 'X'
                FROM   CZ_CONFIG_DETAILS_V c
                WHERE  c.component_code = l.component_code
                AND    c.config_hdr_id  = p_config_hdr_id
                AND    c.config_rev_nbr = p_config_rev_nbr
                AND    c.quantity = 0));
Line: 1481

  Print_Time('Handle_Deletes_Old start time');
Line: 1513

      Is_Cancel_OR_Delete
      ( p_line_id           => config_rec.line_id
       ,p_change_reason     => 'CONFIGURATOR'
       ,p_change_comments   => 'Changes in Configurator Window'
       ,x_cancellation      => l_cancellation
       ,x_line_rec          => l_line_rec);
Line: 1529

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

        oe_debug_pub.add('LINE_ID TO BE DELETED: '||CONFIG_REC.LINE_ID,1);
Line: 1553

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

  Print_Time('Handle_Deletes_Old end time');
Line: 1577

      oe_debug_pub.add(  'EXCEPTION IN HANDLE_DELETES_OLD'|| SQLERRM , 1 ) ;
Line: 1580

END Handle_Deletes_Old;
Line: 1586

is actually a complete cancellation. If so, we will not delete
the lines from oe_order_lines and they will be closed instead.

Change Record:
bug 2191666: the sqls and logic modified when a class gets
cancelled as a result of cascading.
---------------------------------------------------------------------*/
PROCEDURE Check_If_cancellation
( p_line_id           IN  NUMBER
 ,p_top_model_line_id IN  NUMBER
 ,p_item_type_code    IN  VARCHAR2
 ,x_cancellation      OUT NOCOPY /* file.sql.39 change */ BOOLEAN
 ,x_current_quantity  OUT NOCOPY /* file.sql.39 change */ NUMBER)
IS
  l_open_flag        VARCHAR2(1);
Line: 1619

    SELECT ordered_quantity, open_flag, component_code
    INTO   l_ordered_quantity, l_open_flag, l_component_code
    FROM   oe_order_lines
    WHERE  line_id = l_line_id;
Line: 1634

          oe_debug_pub.add('NOT COMPLETE CANCEL, SO DELETE'|| L_LINE_ID ,3);
Line: 1672

    SELECT link_to_line_id
    INTO   l_parent_line_id
    FROM   oe_order_lines
    WHERE  line_id = l_line_id;
Line: 1684

      SELECT open_flag
      INTO   l_open_flag
      FROM   oe_order_lines
      WHERE  line_id = l_parent_line_id;
Line: 1721

      SELECT   count(*)
      INTO     l_line_id
      FROM     oe_order_lines
      WHERE    top_model_line_id = p_top_model_line_id
      AND      link_to_line_id = p_line_id
      AND      open_flag = 'Y'
      AND      item_type_code IN ('CLASS', 'OPTION', 'KIT');
Line: 1729

      SELECT   count(*)
      INTO     l_parent_line_id
      FROM     oe_order_lines
      WHERE    top_model_line_id = p_top_model_line_id
      AND      link_to_line_id = p_line_id
      AND      item_type_code IN ('CLASS', 'OPTION', 'KIT');
Line: 1743

        oe_debug_pub.add(  'IT IS A DELETE' , 1 ) ;
Line: 1754

        SELECT count(*)
        INTO   l_line_id
        FROM   oe_order_lines
        WHERE  top_model_line_id = p_top_model_line_id
        AND    component_code like (l_component_code || '%')
        AND    open_flag = 'N'
        AND    cancelled_flag = 'Y'
        AND    item_type_code IN ('CLASS', 'OPTION', 'KIT');
Line: 1817

The direct operation of update and delete should not
happen, no records should be in class_tbl for update
and delete, since a a value of FALSE is passes to
handle_updates and handle_deletes.

We set a bunch of globals before and after call to lines.
  in a delayed request, process order calls batch validate.
  after batch validation we might insert/update/delete  option
  &/ classes.
  because of this change there should not be again a delayed request
  for batch validation. hence a global OECFG_VALIDATE_CONFIG varchar2(1)
  will be reset and set before and after a call to process_order resp.
  also we do not wnat to cascade here,
  set OE_CONFIG_UTIL.CASCADE_CHANGES_FLAG := 'Y' before the call
  oe_config_ui_used: idicates, options window/configurator call.
  There are some other flags also.

Change Record:
added Insert_into_Set call
 If the parent is in fulfillment set then push the child
 into same fulfillment set. This will handle cases that
 are not calling Lines procedure and doing direct inserts
 into the the table.

MACD: Modified the control record to pass security
---------------------------------------------------------------*/

PROCEDURE Call_Process_Order
( p_line_tbl          IN  OUT NOCOPY  OE_Order_Pub.Line_Tbl_Type
 ,p_class_line_tbl    IN  OE_Order_Pub.Line_Tbl_Type
                          := OE_ORDER_PUB.G_MISS_LINE_TBL
 ,p_control_rec       IN  OUT NOCOPY  OE_GLOBALS.Control_Rec_Type
 ,p_ui_flag           IN  VARCHAR2    := 'N'
 ,p_top_model_line_id IN  NUMBER      := null
 ,p_config_hdr_id     IN  NUMBER      := null
 ,p_config_rev_nbr    IN  NUMBER      := null
 ,p_update_columns    IN  BOOLEAN     := FALSE
 ,x_return_status     OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
IS
  -- process_order in variables
  I                               NUMBER;
Line: 2006

            oe_debug_pub.add('INSERT: ' || L_LINE_REC.COMPONENT_CODE , 1 ) ;
Line: 2009

          OE_Line_Util.Insert_Row( p_line_rec => l_line_rec);
Line: 2011

          OE_Default_Line.Insert_into_set
          (p_line_id         => l_line_rec.top_model_line_id,
           p_child_line_id   => l_line_rec.line_id,
           x_return_status   => l_return_status);
Line: 2028

        ELSIF l_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
          IF l_debug_level  > 0 THEN
            oe_debug_pub.add('UPDATE: ' || L_LINE_REC.LINE_ID , 1 ) ;
Line: 2033

          UPDATE oe_order_lines
          SET    ordered_quantity = l_line_rec.ordered_quantity
          WHERE  line_id = l_line_rec.line_id;
Line: 2037

        ELSIF l_line_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
          IF l_debug_level  > 0 THEN
            oe_debug_pub.add('DELETE: ' || L_LINE_REC.LINE_ID , 1 ) ;
Line: 2042

          DELETE FROM oe_order_lines
          WHERE  line_id = l_line_rec.line_id;
Line: 2064

  IF p_update_columns = TRUE THEN

      IF l_debug_level  > 0 THEN
        oe_debug_pub.add('CALLING CHANGE COLUMNS' , 2 ) ;
Line: 2077

      oe_service_util.Update_Service_Option_Numbers
      (p_top_model_line_id  => p_top_model_line_id);
Line: 2094

          ,p_delete        => FND_API.G_TRUE
          ,x_return_status => l_return_status
          );
Line: 2143

  Update link_to_line_id, ATO_line_id, option_number
  config_header_id and config_rev_nbr of model/class/option
  after updating ato_linr_id, for ato's under pto,
  default stuff.
  update lock_control, once is enough, however if
  p_config_flag is 'N', that is why also update in
  option_number update.
  we can set config_hdr and rev in the line_rec passed
  to process_order. But that will change the hdr and revb
  of only those options that got updated/newly inserted
  not all the options of this model.

  change columns updates:
  column                              when do we want to update
  ------------------------------      ----------------------------
  link_to_line_id                     => creates
  ato_line_id                         => creates
  option_number                       => creates/deletes
  config_header_id, config_rev_nbr    => always

  p_operation : C for create
                D for delete
                A for all (proportional split, copy config calls)
Change Record :
Bug-2405271   : Update Option numbers for Config Item
Bug-3318910   : Update config hdr/rev/id only if top level is MODEL
Bug-3082485   : validation of decimal ratio for options to classes
Bug-3700148   : do not do ratio check if model is remnant
-----------------------------------------------------------------*/

Procedure Change_Columns
(p_top_model_line_id IN NUMBER,
 p_config_hdr_id     IN NUMBER,
 p_config_rev_nbr    IN NUMBER,
 p_ui_flag           IN VARCHAR2 := 'N',
 p_operation         IN VARCHAR2 := 'A')
IS
  l_line_id                   NUMBER;
Line: 2211

  SELECT line_id, link_to_line_id, item_type_code,ordered_quantity,
         ato_line_id,inventory_item_id,ordered_item
        ,split_from_line_id ,sort_order--bug12758138
  FROM   oe_order_lines
  WHERE  top_model_line_id = p_top_model_line_id
  AND    line_id <> p_top_model_line_id
  AND    service_reference_line_id is null
  AND    item_type_code <> OE_GLOBALS.G_ITEM_INCLUDED
  AND    item_type_code <> OE_GLOBALS.G_ITEM_CONFIG
  order by sort_order;
Line: 2230

    SELECT item_type_code, ato_line_id, config_header_id, config_rev_nbr,
           nvl(model_remnant_flag, 'N')
    INTO   l_model_item_type_code , l_model_ato_line_id,
           l_prev_config_header_id, l_prev_config_rev_nbr,
           l_remnant_flag
    FROM   oe_order_lines
    WHERE line_id = p_top_model_line_id;
Line: 2255

      UPDATE oe_order_lines
      SET    configuration_id  = nvl(configuration_id, 0) + 1,
             lock_control      = lock_control + 1
      WHERE  top_model_line_id = p_top_model_line_id
      AND    item_type_code IN ('MODEL', 'CLASS', 'OPTION', 'KIT');
Line: 2268

      UPDATE oe_order_lines
      SET    config_header_id  = p_config_hdr_id,
             config_rev_nbr    = p_config_rev_nbr,
             lock_control      = lock_control + 1
      WHERE  top_model_line_id = p_top_model_line_id
      AND    item_type_code IN ('MODEL', 'CLASS', 'OPTION', 'KIT');
Line: 2284

      oe_debug_pub.add('UPDATE ATO ATTRIBS FOR SUBASSEMBLIES' , 1 ) ;
Line: 2286

    update_ato_line_attributes( p_top_model_line_id => p_top_model_line_id
                               ,p_ui_flag           => p_ui_flag
                               ,p_config_hdr_id     => p_config_hdr_id);
Line: 2291

    UPDATE oe_order_lines
    SET    shippable_flag = 'N'
    WHERE  top_model_line_id = p_top_model_line_id
    AND    ato_line_id is NOT NULL
    AND    item_type_code <> OE_GLOBALS.G_ITEM_CONFIG
    AND    NOT (item_type_code = OE_GLOBALS.G_ITEM_OPTION AND
                ato_line_id    = line_id)
    AND    NOT (item_type_code = OE_GLOBALS.G_ITEM_INCLUDED AND --9775352
                ato_line_id    = line_id);
Line: 2307

    update_link_to_line_id
    ( p_top_model_line_id => p_top_model_line_id
     ,p_remnant_flag      => l_remnant_flag
     ,p_config_hdr_id     => p_config_hdr_id);
Line: 2340

        Select option_number
        into  l_option_number
        from oe_order_lines
        where split_from_line_id = l_split_from_line_id
        and model_remnant_flag = 'Y'
        and option_number is not null
    --  and ato_line_id is not null
    --  and ato_line_id <> top_model_line_id
        and top_model_line_id = p_top_model_line_id
        and shipped_quantity is null
        and NVL(sort_order,-99) = NVL(l_sort_order, -99)
        and line_id <> l_line_id;
Line: 2361

                oe_debug_pub.add('option_nbr update error: -' || SQLERRM, 1 ) ;
Line: 2372

    UPDATE oe_order_lines
    SET    option_number = l_option_number,
           lock_control  = lock_control + 1
    WHERE  line_id = l_line_id;
Line: 2378

            oe_debug_pub.add('option_nbr rows updated : -' || SQL%ROWCOUNT, 1 ) ;
Line: 2388

    UPDATE oe_order_lines
    SET    option_number = l_option_nbr,
           lock_control  = lock_control + 1
    WHERE  line_id = l_line_id;
Line: 2413

        SELECT INDIVISIBLE_FLAG
        INTO   l_indivisible_flag
        FROM   mtl_system_items
        WHERE  inventory_item_id = l_child_inv_item_id
        AND    organization_id   =
               OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID');
Line: 2440

        SELECT ordered_quantity,ordered_item,
               item_type_code,inventory_item_id
        INTO   l_parent_ordered_quantity,l_parent_ordered_item,
               l_parent_item_type_code, l_parent_inv_item_id
        FROM   OE_ORDER_LINES
        WHERE  line_id = l_link;
Line: 2474

        UPDATE oe_order_lines
        SET    option_number = l_option_nbr,
               lock_control  = lock_control + 1
        WHERE  top_model_line_id = p_top_model_line_id
        AND    link_to_line_id   = l_line_id
        AND    item_type_code    = 'INCLUDED';
Line: 2489

        UPDATE oe_order_lines
 --       SET    option_number = l_option_nbr,    ---commented for bug12758138
        SET    option_number = NVL(l_option_number,l_option_nbr),    ---bug12758138
               lock_control  = lock_control + 1
        WHERE  top_model_line_id = p_top_model_line_id
        AND    ato_line_id       = l_line_id
        AND    item_type_code    = 'CONFIG';
Line: 2511

    UPDATE oe_order_lines o
    SET   ordered_quantity =
      (SELECT ordered_quantity
       FROM   oe_order_lines
       WHERE  line_id = o.link_to_line_id)
    WHERE top_model_line_id = p_top_model_line_id
    AND   item_type_code = OE_GLOBALS.G_ITEM_CONFIG
    AND   nvl(model_remnant_flag, 'N') = 'N';
Line: 2520

    UPDATE oe_order_lines
    SET    cancelled_flag = 'Y'
    WHERE  top_model_line_id = p_top_model_line_id
    AND    item_type_code = 'CONFIG'
    AND    ordered_quantity = 0;
Line: 2549

Procedure : update_link_to_line_id
OE_CODE_CONTROL.Get_Code_Release_Level >= '110508' : Pack H
-----------------------------------------------------------------*/
Procedure update_link_to_line_id
( p_top_model_line_id  IN  NUMBER
 ,p_remnant_flag       IN  VARCHAR2
 ,p_config_hdr_id      IN  NUMBER)
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 2573

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
            (SELECT line_id
             FROM    oe_order_lines oe1
             WHERE   split_from_line_id =
            (SELECT link_to_line_id
             FROM   oe_order_lines oe2
             WHERE  line_id = OEOPT.split_from_line_id
             AND    oe2.open_flag           = 'Y')
             AND    oe1.top_model_line_id   =  p_top_model_line_id
             AND    oe1.open_flag           = 'Y' )
    WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
    AND    OEOPT.line_id            <> p_top_model_line_id
    AND    OEOPT.link_to_line_id     is NULL
    AND    OEOPT.split_from_line_id is NOT NULL
    AND    OEOPT.open_flag           = 'Y';
Line: 2592

        oe_debug_pub.add('1 LLID UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2599

        oe_debug_pub.add('update_link_to_line_id: May be Due to bug 12758138',1 ) ;
Line: 2602

   UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
            (SELECT line_id
             FROM    oe_order_lines oe1
             WHERE   split_from_line_id =
            (SELECT link_to_line_id
             FROM   oe_order_lines oe2
             WHERE  line_id = OEOPT.split_from_line_id
             AND    oe2.open_flag           = 'Y')
             AND    oe1.top_model_line_id   =  p_top_model_line_id
             AND    oe1.open_flag           = 'Y'
             AND    oe1.shipped_quantity IS NULL
             )
    WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
    AND    OEOPT.line_id            <> p_top_model_line_id
    AND    OEOPT.link_to_line_id     is NULL
    AND    OEOPT.split_from_line_id is NOT NULL
    AND    OEOPT.shipped_quantity IS NULL
    AND    OEOPT.open_flag           = 'Y';
Line: 2624

        oe_debug_pub.add('1aE for unshipped LLID UPDATED ' || SQL%ROWCOUNT,1 ) ;
Line: 2629

        oe_debug_pub.add('update_link_to_line_id: In errors block at 2',1 ) ;
Line: 2632

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
            (SELECT line_id
             FROM    oe_order_lines oe1
             WHERE   split_from_line_id =
                                (SELECT link_to_line_id
                                FROM   oe_order_lines oe2
                                WHERE  line_id = OEOPT.split_from_line_id
                              AND    oe2.open_flag           = 'Y')
             AND    oe1.top_model_line_id   =  p_top_model_line_id
             AND    oe1.open_flag           = 'Y'
             AND    oe1.shipped_quantity IS NOT NULL )
    WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
    AND    OEOPT.line_id            <> p_top_model_line_id
    AND    OEOPT.link_to_line_id     is NULL
    AND    OEOPT.split_from_line_id is NOT NULL
    AND    OEOPT.shipped_quantity IS NOT NULL
    AND    OEOPT.open_flag           = 'Y';
Line: 2652

         oe_debug_pub.add('1bE for shipped LLID UPDATED ' || SQL%ROWCOUNT,1 ) ;
Line: 2660

        oe_debug_pub.add('update_link_to_line_id: In errors block at 3 llid',1 ) ;
Line: 2663

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
            (SELECT line_id
             FROM    oe_order_lines oe1
             WHERE   split_from_line_id =
                                (SELECT link_to_line_id
                                FROM   oe_order_lines oe2
                                WHERE  line_id = OEOPT.split_from_line_id
                              AND    oe2.open_flag           = 'Y')
             AND    oe1.top_model_line_id   =  p_top_model_line_id
             AND    oe1.open_flag           = 'Y'
             AND    oe1.shipped_quantity IS NULL )
    WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
    AND    OEOPT.line_id            <> p_top_model_line_id
    AND    OEOPT.link_to_line_id     is NULL
    AND    OEOPT.split_from_line_id is NOT NULL
    AND    OEOPT.shipped_quantity IS NOT NULL
    AND    OEOPT.open_flag           = 'Y';
Line: 2683

         oe_debug_pub.add('1cE for shipped LLID UPDATED ' || SQL%ROWCOUNT,1 ) ;
Line: 2699

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
    ( SELECT line_id
      FROM   oe_order_lines OELNK
      WHERE  OELNK.top_model_line_id = OEOPT.top_model_line_id
      AND OELNK.configuration_id =
      ( SELECT parent_config_item_id
        FROM   cz_config_details_v
        WHERE  config_hdr_id  = OELNK.config_header_id
        AND    config_rev_nbr = OELNK.config_rev_nbr
        AND    config_item_id = OEOPT.configuration_id
      )
      AND OELNK.open_flag = 'Y'
    )
    WHERE  OEOPT.top_model_line_id =  p_top_model_line_id
    AND    OEOPT.line_id           <> p_top_model_line_id
    AND    OEOPT.link_to_line_id   IS NULL;
Line: 2719

        oe_debug_pub.add('2 LLID UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2730

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
    ( SELECT  OELNK.line_id
      FROM    oe_order_lines OELNK
      WHERE   (( OELNK.line_id = oeopt.top_model_line_id OR
                 OELNK.top_model_line_id = OEOPT.top_model_line_id ))
      AND     (OELNK.component_code =  SUBSTR( OEOPT.component_code,1,
               LENGTH( RTRIM( OEOPT.component_code,'0123456789' )) - 1)
      OR      (OELNK.component_code  = OEOPT.component_code AND
               OEOPT.item_type_code  = OE_GLOBALS.G_ITEM_MODEL))
      AND     open_flag = 'Y'
    )
    WHERE  OEOPT.top_model_line_id =  p_top_model_line_id
    AND    OEOPT.line_id           <> p_top_model_line_id
    AND    OEOPT.link_to_line_id   IS NULL
    AND    OEOPT.item_type_code <> OE_GLOBALS.G_ITEM_INCLUDED;
Line: 2749

        oe_debug_pub.add('3 LLID UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2756

        oe_debug_pub.add('update_link_to_line_id2 at error ' || SQLERRM ) ;
Line: 2759

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
    ( SELECT  OELNK.line_id
      FROM    oe_order_lines OELNK
      WHERE   (( OELNK.line_id = oeopt.top_model_line_id OR
                 OELNK.top_model_line_id = OEOPT.top_model_line_id ))
      AND     (OELNK.component_code =  SUBSTR( OEOPT.component_code,1,
               LENGTH( RTRIM( OEOPT.component_code,'0123456789' )) - 1)
      OR      (OELNK.component_code  = OEOPT.component_code AND
               OEOPT.item_type_code  = OE_GLOBALS.G_ITEM_MODEL))
      AND     open_flag = 'Y'
      AND    OELNK.shipped_quantity IS NULL
    )
    WHERE  OEOPT.top_model_line_id =  p_top_model_line_id
    AND    OEOPT.line_id           <> p_top_model_line_id
    AND    OEOPT.link_to_line_id   IS NULL
    AND    OEOPT.shipped_quantity IS NULL
    AND    OEOPT.item_type_code <> OE_GLOBALS.G_ITEM_INCLUDED;
Line: 2780

        oe_debug_pub.add('3 update_link_to_line_id2 UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2785

        oe_debug_pub.add('update_link_to_line_id2 at A'  ) ;
Line: 2789

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
    ( SELECT  OELNK.line_id
      FROM    oe_order_lines OELNK
      WHERE   (( OELNK.line_id = oeopt.top_model_line_id OR
                 OELNK.top_model_line_id = OEOPT.top_model_line_id ))
      AND     (OELNK.component_code =  SUBSTR( OEOPT.component_code,1,
               LENGTH( RTRIM( OEOPT.component_code,'0123456789' )) - 1)
      OR      (OELNK.component_code  = OEOPT.component_code AND
               OEOPT.item_type_code  = OE_GLOBALS.G_ITEM_MODEL))
      AND     open_flag = 'Y'
      AND    OELNK.shipped_quantity IS NOT NULL
    )
    WHERE  OEOPT.top_model_line_id =  p_top_model_line_id
    AND    OEOPT.line_id           <> p_top_model_line_id
    AND    OEOPT.link_to_line_id   IS NULL
    AND    OEOPT.shipped_quantity IS NOT NULL
    AND    OEOPT.item_type_code <> OE_GLOBALS.G_ITEM_INCLUDED;
Line: 2810

        oe_debug_pub.add('3b update_link_to_line_id2 UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2815

        oe_debug_pub.add('update_link_to_line_id2 at B'  ) ;
Line: 2819

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
    ( SELECT  OELNK.line_id
      FROM    oe_order_lines OELNK
      WHERE   (( OELNK.line_id = oeopt.top_model_line_id OR
                 OELNK.top_model_line_id = OEOPT.top_model_line_id ))
      AND     (OELNK.component_code =  SUBSTR( OEOPT.component_code,1,
               LENGTH( RTRIM( OEOPT.component_code,'0123456789' )) - 1)
      OR      (OELNK.component_code  = OEOPT.component_code AND
               OEOPT.item_type_code  = OE_GLOBALS.G_ITEM_MODEL))
      AND     open_flag = 'Y'
      AND    OELNK.shipped_quantity IS NULL
    )
    WHERE  OEOPT.top_model_line_id =  p_top_model_line_id
    AND    OEOPT.line_id           <> p_top_model_line_id
    AND    OEOPT.link_to_line_id   IS NULL
    AND    OEOPT.shipped_quantity IS NOT NULL
    AND    OEOPT.item_type_code <> OE_GLOBALS.G_ITEM_INCLUDED;
Line: 2840

        oe_debug_pub.add('3c update_link_to_line_id2 UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2844

        oe_debug_pub.add('update_link_to_line_id2 at C'  ) ;
Line: 2850

    UPDATE  oe_order_lines OEOPT
    SET     link_to_line_id =
            (SELECT line_id
             FROM    oe_order_lines oe1
             WHERE   split_from_line_id =
             (SELECT link_to_line_id
              FROM   oe_order_lines oe2
              WHERE  line_id = OEOPT.split_from_line_id
              AND    oe2.open_flag           = 'Y')
              AND    oe1.top_model_line_id   =  p_top_model_line_id
              AND    oe1.open_flag           = 'Y' )
    WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
    AND    OEOPT.line_id            <> p_top_model_line_id
    AND    OEOPT.item_type_code      = OE_GLOBALS.G_ITEM_INCLUDED
    AND    OEOPT.link_to_line_id     is NULL
    AND    OEOPT.split_from_line_id is NOT NULL
    AND    OEOPT.open_flag           = 'Y';
Line: 2870

        oe_debug_pub.add('1 LLID UPDATED ' || SQL%ROWCOUNT ) ;
Line: 2877

    oe_debug_pub.add('UPDATED LINK_TO_LINE_ID IN OE_ORDER_LINES' , 2 ) ;
Line: 2883

      oe_debug_pub.add('ERROR IN UPDATE_LINK_TO_LINE_ID' || SQLERRM , 1 ) ;
Line: 2886

END update_link_to_line_id;
Line: 2890

Procedure : update_ato_line_attributes

Change Record:
bug 1894331
  the select statement for getting ato_line_id in case of
  pto+ato case is modified. look at the bug for more details.
  also made same change in OEXDLINB.pls:get_ato_line.

bug 2143052: added open_flag to cursors.

From mi project, we have decided that ato_line_id will not be
updated if the model is remnant here. The ato_line_id populated
by SPLIT defaulting remains.
-----------------------------------------------------------------*/
Procedure update_ato_line_attributes
( p_top_model_line_id   IN  NUMBER
 ,p_ui_flag             IN  VARCHAR2
 ,p_config_hdr_id       IN  NUMBER)
IS
  l_component_code            varchar2(1000);
Line: 2933

  SELECT unique(ato_line_id)
  FROM   oe_order_lines_all
  WHERE  top_model_line_id = p_top_model_line_id
  AND    ato_line_id is not null
  AND    item_type_code = OE_GLOBALS.G_ITEM_CLASS
  AND    open_flag = 'Y'; -- ato subconfigs
Line: 2942

  SELECT opt.line_id
  FROM   oe_order_lines_all opt, oe_order_lines_all ato_model
  WHERE  opt.top_model_line_id       = p_top_model_line_id AND
         ato_model.top_model_line_id = p_top_model_line_id AND
         ato_model.line_id           = p_ato_line_id AND
         opt.open_flag               = 'Y'           AND
         opt.ato_line_id             = p_ato_line_id AND
         (nvl(ato_model.project_id,-1) <>
          nvl(opt.project_id,-1) OR

          nvl(ato_model.task_id,-1) <>
          nvl(opt.task_id,-1) OR

          nvl(ato_model.ship_from_org_id,-1) <>
          nvl(opt.ship_from_org_id,-1) OR

          nvl(ato_model.ship_to_org_id,-1) <>
          nvl(opt.ship_to_org_id,-1) OR

          nvl(ato_model.schedule_ship_date,SYSDATE) <>
          nvl(opt.schedule_ship_date,SYSDATE) OR

          nvl(ato_model.schedule_arrival_date,SYSDATE) <>
          nvl(opt.schedule_arrival_date,SYSDATE) OR

          nvl(ato_model.request_date,SYSDATE) <>
          nvl(opt.request_date,SYSDATE) OR

          nvl(ato_model.shipping_method_code,'-') <>
          nvl(opt.shipping_method_code,'-') OR

          nvl(ato_model.freight_carrier_code,'-') <>
          nvl(opt.freight_carrier_code,'-') );
Line: 2994

        oe_debug_pub.add('UPDATE_ATO: PACK H NEW LOGIC MI' , 1 ) ;
Line: 2997

      UPDATE oe_order_lines OEOPT
      SET    ato_line_id =
      ( SELECT line_id
        FROM    oe_order_lines OEATO
        WHERE   OEOPT.top_model_line_id = OEATO.top_model_line_id
        AND     OEATO.configuration_id =
                (SELECT  ato_config_item_id
                 FROM    cz_config_details_v
                 WHERE   config_hdr_id  = OEOPT.config_header_id
                 AND     config_rev_nbr = OEOPT.config_rev_nbr
                 AND     config_item_id = OEOPT.configuration_id)
        AND      OEATO.open_flag = 'Y'
      )
      WHERE  TOP_MODEL_LINE_ID = p_top_model_line_id
      AND NOT (item_type_code = 'OPTION' AND
               ato_line_id    = line_id AND
               ato_line_id is not null)
      AND NOT (item_type_code = 'INCLUDED' AND --9775352
               ato_line_id    = line_id AND
               ato_line_id is not null)
      AND item_type_code <> 'CONFIG' -- not config line important.
      AND nvl(model_remnant_flag, 'N') = 'N'
      AND ordered_quantity > 0;
Line: 3024

          oe_debug_pub.add('NEW ATO_LINE UPDATED ' || SQL%ROWCOUNT ) ;
Line: 3028

          oe_debug_pub.add('DID NOT UPDATE ANY LINE WITH ATO' ) ;
Line: 3035

      UPDATE  oe_order_lines OEOPT
      SET     ato_line_id =
              (SELECT line_id
               FROM   oe_order_lines oe1
               WHERE  split_from_line_id =
              (SELECT ato_line_id
               FROM   oe_order_lines oe2
               WHERE  line_id = OEOPT.split_from_line_id
               AND    oe2.open_flag           = 'Y')
               AND    oe1.top_model_line_id   =  p_top_model_line_id
               AND    oe1.open_flag           = 'Y' )
      WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
      AND    OEOPT.line_id            <> p_top_model_line_id
      AND    OEOPT.split_from_line_id is NOT NULL
      AND    OEOPT.open_flag           = 'Y'
      AND    OEOPT.item_type_code = 'CONFIG'
      AND    OEOPT.ato_line_id is null;
Line: 3066

      UPDATE  oe_order_lines OEOPT
      SET     ato_line_id =
              (SELECT line_id
               FROM   oe_order_lines oe1
               WHERE  split_from_line_id =
              (SELECT ato_line_id
               FROM   oe_order_lines oe2
               WHERE  line_id = OEOPT.split_from_line_id
               AND    oe2.open_flag           = 'Y')
               AND    oe1.top_model_line_id   =  p_top_model_line_id
               AND    oe1.open_flag           = 'Y' )
      WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
      AND    OEOPT.line_id            <> p_top_model_line_id
      AND    OEOPT.split_from_line_id is NOT NULL
      AND    OEOPT.open_flag           = 'Y'
      AND    OEOPT.model_remnant_flag = 'Y'
      AND    NOT (item_type_code = 'OPTION' AND
                  ato_line_id    = line_id AND
                  ato_line_id is not null)
      AND    NOT (item_type_code = 'INCLUDED' AND --9775352
                  ato_line_id    = line_id AND
                  ato_line_id is not null);
Line: 3102

                     UPDATE  oe_order_lines OEOPT
                      SET     ato_line_id =
                              (SELECT line_id
                               FROM   oe_order_lines oe1
                               WHERE  split_from_line_id =
                                                          (SELECT ato_line_id
                                                          FROM   oe_order_lines oe2
                                                          WHERE  line_id = OEOPT.split_from_line_id
                                                          AND    oe2.open_flag           = 'Y')
                               AND    oe1.top_model_line_id   =  p_top_model_line_id
                               AND    oe1.open_flag           = 'Y'
                               AND    oe1.shipped_quantity IS NULL
                               )
                      WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
                      AND    OEOPT.line_id            <> p_top_model_line_id
                      AND    OEOPT.split_from_line_id is NOT NULL
                      AND    OEOPT.open_flag           = 'Y'
                      AND    OEOPT.model_remnant_flag = 'Y'
                      AND    OEOPT.shipped_quantity IS NULL
                      AND    NOT (item_type_code = 'OPTION' AND
                                  ato_line_id    = line_id AND
                                  ato_line_id is not null)
                      AND    NOT (item_type_code = 'INCLUDED' AND --9775352
                                  ato_line_id    = line_id AND
                                  ato_line_id is not null);
Line: 3139

                     UPDATE  oe_order_lines OEOPT
                     SET     ato_line_id =
                              (SELECT line_id
                               FROM   oe_order_lines oe1
                               WHERE  split_from_line_id =
                                                          (SELECT ato_line_id
                                                          FROM   oe_order_lines oe2
                                                          WHERE  line_id = OEOPT.split_from_line_id
                                                          AND    oe2.open_flag           = 'Y')
                               AND    oe1.top_model_line_id   =  p_top_model_line_id
                               AND    oe1.open_flag           = 'Y'
                               AND    oe1.shipped_quantity IS NOT NULL
                               )
                      WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
                      AND    OEOPT.line_id            <> p_top_model_line_id
                      AND    OEOPT.split_from_line_id is NOT NULL
                      AND    OEOPT.open_flag           = 'Y'
                      AND    OEOPT.model_remnant_flag = 'Y'
                      AND    OEOPT.shipped_quantity IS NOT NULL
                      AND    NOT (item_type_code = 'OPTION' AND
                                  ato_line_id    = line_id AND
                                  ato_line_id is not null)
                      AND    NOT (item_type_code = 'INCLUDED' AND --9775352
                                  ato_line_id    = line_id AND
                                  ato_line_id is not null);
Line: 3178

                     UPDATE  oe_order_lines OEOPT
                     SET     ato_line_id =
                              (SELECT line_id
                               FROM   oe_order_lines oe1
                               WHERE  split_from_line_id =
                                                          (SELECT ato_line_id
                                                          FROM   oe_order_lines oe2
                                                          WHERE  line_id = OEOPT.split_from_line_id
                                                          AND    oe2.open_flag           = 'Y')
                               AND    oe1.top_model_line_id   =  p_top_model_line_id
                               AND    oe1.open_flag           = 'Y'
                               AND    oe1.shipped_quantity IS NULL
                               )
                      WHERE  OEOPT.top_model_line_id  =  p_top_model_line_id
                      AND    OEOPT.line_id            <> p_top_model_line_id
                      AND    OEOPT.split_from_line_id is NOT NULL
                      AND    OEOPT.open_flag           = 'Y'
                      AND    OEOPT.model_remnant_flag = 'Y'
                      AND    OEOPT.shipped_quantity IS NOT NULL
                      AND    OEOPT.item_type_code = 'CONFIG'
                      AND    OEOPT.ato_line_id IS NULL
                      AND    NOT (item_type_code = 'OPTION' AND
                                  ato_line_id    = line_id AND
                                  ato_line_id is not null)
                      AND    NOT (item_type_code = 'INCLUDED' AND --9775352
                                  ato_line_id    = line_id AND
                                  ato_line_id is not null);
Line: 3224

        UPDATE OE_ORDER_LINES_ALL OEOPT
        SET    ATO_LINE_ID =
              ( SELECT OEATO.LINE_ID
                FROM   OE_ORDER_LINES_ALL OEATO
                WHERE  OEATO.TOP_MODEL_LINE_ID =
                       OEOPT.TOP_MODEL_LINE_ID
                AND    ITEM_TYPE_CODE = 'CLASS'
                AND    OEATO.COMPONENT_CODE =
                       SUBSTR( OEOPT.COMPONENT_CODE, 1,
                               LENGTH( OEATO.COMPONENT_CODE )
                              )
                AND OEATO.inventory_item_id =
                    ( SELECT inventory_item_id
                      FROM mtl_system_items
                      WHERE inventory_item_id =
                      OEATO.inventory_item_id
                      AND organization_id =
                      OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID')
                      AND replenish_to_order_flag = 'Y'
                     )
                AND    OEATO.COMPONENT_CODE =
                     ( SELECT MIN( OEMIN.COMPONENT_CODE )
                       FROM   OE_ORDER_LINES_ALL OEMIN
                       WHERE  OEMIN.TOP_MODEL_LINE_ID
                       = OEOPT.TOP_MODEL_LINE_ID
                       AND    OEMIN.COMPONENT_CODE =
                       SUBSTR( OEOPT.COMPONENT_CODE, 1,
                       LENGTH( OEMIN.COMPONENT_CODE ))
                       AND OEMIN.inventory_item_id =
                      ( SELECT inventory_item_id
                        FROM mtl_system_items
                        WHERE inventory_item_id =
                        OEMIN.inventory_item_id
                        AND organization_id =
                        OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID')
                        AND replenish_to_order_flag = 'Y'
                       )
                      )
                 AND ((SUBSTR(OEOPT.component_code,
                       LENGTH(OEATO.component_code) + 1, 1) = '-' OR
                       SUBSTR(OEOPT.component_code,
                       LENGTH(OEATO.component_code) + 1, 1) is NULL)
                      )
                     )
        WHERE  TOP_MODEL_LINE_ID = p_top_model_line_id
        AND NOT (item_type_code = 'OPTION' AND
                 ato_line_id    = line_id AND
                 ato_line_id is not null)
	AND NOT (item_type_code = 'INCLUDED' AND -- 9775352
                 ato_line_id    = line_id AND
                 ato_line_id is not null);
Line: 3278

            oe_debug_pub.add('OLD ATO_LINE UPDATED ' || SQL%ROWCOUNT ) ;
Line: 3289

        oe_debug_pub.add('UNEXPECTED ERROR IN UPDATE ATO_LINE_ID' , 1 ) ;
Line: 3331

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

    oe_debug_pub.add('IN UPDATE_ATO_ATTIRBS , CALLING PROCESS_ORDER' , 1 ) ;
Line: 3390

    ('IN UPDATE_ATO_ATTIRBS , AFTER PO: ' || L_RETURN_STATUS , 1 ) ;
Line: 3402

      oe_debug_pub.add('ERROR IN UPDATE_ATO_LINE_ATTRIBUTES' || SQLERRM , 1 ) ;
Line: 3405

END update_ato_line_attributes;
Line: 3409

Procedure Name : Delete_Config
Description    : Deletes the configuration from SPC's tables
-------------------------------------------------------------------- */

Procedure Delete_Config
          (p_config_hdr_id      IN  NUMBER ,
           p_config_rev_nbr     IN  NUMBER ,
           x_return_status      OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
IS
l_usage_exists   number;
Line: 3428

    oe_debug_pub.add('ENTERING DELETE_CONFIG IN OE_CONFIG_PVT' , 1 ) ;
Line: 3439

     CZ_CF_API.Delete_Configuration
             ( config_hdr_id   => p_config_hdr_id
              ,config_rev_nbr  => p_config_rev_nbr
              ,usage_exists    => l_usage_exists
              ,error_message   => l_error_message
              ,return_value    => l_return_value );
Line: 3451

          oe_debug_pub.add('ERROR IN DELETE_CONFIG IN OE_CONFIG_PVT' , 1 ) ;
Line: 3464

    oe_debug_pub.add('LEAVING DELETE_CONFIG IN OE_CONFIG_PVT' , 1 ) ;
Line: 3470

      oe_debug_pub.add('ERROR IN DELETE_CONFIG IN OE_CONFIG_PVT' , 1 ) ;
Line: 3474

END Delete_Config;
Line: 3481

                 updates link_to_line_id, ATO_line_id, option_number
                 config_header_id and config_rev_nbr of model/class/option

Change Record:
2611771 : new cz copy config call
3144865 : skip call to change_columns if only model line is selected
3318910 : call change_columns for KIT/ options window, bug fix on top
          of 3144865 to fix the issues in that bug fix.
-------------------------------------------------------------------- */

Procedure Copy_Config(p_top_model_line_id  IN  NUMBER ,
                      p_config_hdr_id      IN  NUMBER ,
                      p_config_rev_nbr     IN  NUMBER ,
                      p_configuration_id   IN  NUMBER ,
                      p_remnant_flag       IN  VARCHAR2 ,
                      x_return_status      OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
  l_return_value      number;
Line: 3577

          oe_debug_pub.add('no need to update config ids ',1);
Line: 3584

          UPDATE oe_order_lines
          SET    configuration_id  = l_new_item_id_tbl(I)
          WHERE  top_model_line_id = p_top_model_line_id
          AND    configuration_id  = l_orig_item_id_tbl(I);
Line: 3603

    UPDATE oe_order_lines
    SET    configuration_id = null,
           config_header_id = null,
           config_rev_nbr   = null
    WHERE  top_model_line_id = p_top_model_line_id;
Line: 3611

        oe_debug_pub.add('CONFIG IDS UPDATED TO NULL' , 2 ) ;
Line: 3624

    UPDATE oe_order_lines
    SET    link_to_line_id = NULL
    WHERE  top_model_line_id = p_top_model_line_id
    AND    split_from_line_id is not NULL;
Line: 3631

    UPDATE oe_order_lines
    SET    link_to_line_id = NULL
    WHERE  top_model_line_id = p_top_model_line_id;
Line: 3641

     Since Update_ato_line_attributes are updating only Class records
     The ato_line_id populated by SPLIT code in case of PTO+ATO is
     the line_id of the top PTO mode whcih is incorrect. Hence,
     it is important to update the ATO with correct ato_line_id.
   */

  SELECT ato_line_id ,booked_flag, item_type_code
  INTO   l_ato_line_id, l_booked_flag, l_error_message
  FROM   oe_order_lines
  WHERE  line_id = p_top_model_line_id;
Line: 3662

       UPDATE oe_order_lines
       SET    ato_line_id       = NULL
       WHERE  top_model_line_id = p_top_model_line_id
       AND    NOT (item_type_code = OE_GLOBALS.G_ITEM_OPTION AND
                   ato_line_id    = line_id)
       AND    NOT (item_type_code = OE_GLOBALS.G_ITEM_INCLUDED AND --9775352
                   ato_line_id    = line_id);
Line: 3687

		update_link_to_line_id
                ( p_top_model_line_id => p_top_model_line_id  --added for bug 7261021
                 ,p_remnant_flag      => p_remnant_flag
                 ,p_config_hdr_id     => p_config_hdr_id);
Line: 3762

    SELECT line_number || '.'|| shipment_number
    INTO   l_line_number
    FROM   oe_order_lines
    WHERE  line_id = p_line_id;
Line: 3818

         FND_MESSAGE.Set_Name('ONT', 'OE_VAL_CONFIG_HOLD_INSERT');
Line: 3905

the model line rec so that it can be sent in for update.
we will call a direct update on the model line later.

change record:
new parameters for ER config date effectivity 2625376
p_check_effective_date  : if need to check model date effectivity.
x_config_effective_date : null if p_check_effective_date is N
x_frozen_model_bill     : null if p_check_effective_date is N
------------------------------------------------------------*/
Procedure Explode_Bill
( p_model_line_rec        IN  OUT NOCOPY OE_Order_Pub.Line_Rec_Type
 ,p_do_update             IN  BOOLEAN   := TRUE
 ,p_check_effective_date  IN  VARCHAR2  := 'Y'
 ,x_config_effective_date OUT NOCOPY    DATE
 ,x_frozen_model_bill     OUT NOCOPY    VARCHAR2
 ,x_return_status         OUT NOCOPY    VARCHAR2)
IS
  /* variables for call to explode */
  l_rev_date                   DATE;
Line: 4018

       SELECT bill_sequence_id
       INTO   p_model_line_rec.component_sequence_id
       FROM   bom_bill_of_materials
       WHERE  assembly_item_id = p_model_line_rec.inventory_item_id
       AND    organization_id = l_validation_org
       AND    alternate_bom_designator is NULL;
Line: 4041

       oe_debug_pub.add('TOP_BILL_SEQ_ID SELECTED FROM BOM_bill_of_mat' ) ;
Line: 4044

     IF p_do_update THEN
       UPDATE oe_order_lines
       SET component_sequence_id  = p_model_line_rec.component_sequence_id
          ,sort_order             = p_model_line_rec.sort_order
          ,component_code         = p_model_line_rec.component_code
          ,lock_control           = lock_control + 1
       WHERE line_id = p_model_line_rec.line_id;
Line: 4122

  SELECT line_id, ordered_quantity
  FROM   oe_order_lines
  WHERE  top_model_line_id = p_top_model_line_id
  AND    link_to_line_id   = p_link_to_line_id
  AND    item_type_code    = OE_GLOBALS.G_ITEM_INCLUDED;
Line: 4206

      IF l_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE AND
         l_line_rec.ordered_quantity = 0 AND
         OE_MODIFY_INC_ITEMS_TBL(I).param11 = 'N'
      THEN
         IF l_debug_level  > 0 THEN
           oe_debug_pub.add('DELETE SINCE NOT FULL CANCEL' , 3 ) ;
Line: 4213

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

  SELECT line_id, component_code, link_to_line_id, ordered_quantity
  FROM   oe_order_lines
  WHERE  item_type_code = 'INCLUDED'
  AND    link_to_line_id <> top_model_line_id
  AND    top_model_line_id = p_top_model_line_id;
Line: 4306

      SELECT component_sequence_id, creation_date
      INTO   l_component_sequence_id, l_creation_date
      FROM   oe_order_lines
      WHERE  line_id = p_top_model_line_id;
Line: 4353

        SELECT ordered_quantity
        INTO   l_ordered_qty
        FROM   oe_order_lines
        WHERE  top_model_line_id = p_top_model_line_id
        AND    line_id = l_rec.link_to_line_id;
Line: 4360

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

          oe_debug_pub.add('PARENT WAS UPDATED' || L_ORDERED_QTY , 3 ) ;
Line: 4374

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

            oe_debug_pub.add('PARENT WAS DELETED' , 3 ) ;
Line: 4385

            oe_debug_pub.add('COULD NOT SELECT PARENT QTY' , 1 ) ;
Line: 4490

PROCEDURE Is_Cancel_OR_Delete

--------------------------------------------------------*/
PROCEDURE Is_Cancel_OR_Delete
( p_line_id          IN NUMBER
 ,p_change_reason    IN VARCHAR2 := null
 ,p_change_comments  IN VARCHAR2 := null
 ,x_cancellation     OUT NOCOPY BOOLEAN
 ,x_line_rec         IN OUT NOCOPY OE_Order_Pub.line_rec_type)
IS
  l_return_status    VARCHAR2(1);
Line: 4518

  x_line_rec.operation  := OE_GLOBALS.G_OPR_DELETE;
Line: 4537

      OE_Msg_Pub.Delete_Msg;
Line: 4545

        OE_Msg_Pub.Delete_Msg(l_msg_count2 - I);
Line: 4557

      oe_debug_pub.add('do cancellation hence update with 0', 3 );
Line: 4561

    x_line_rec.operation            := OE_GLOBALS.G_OPR_UPDATE;
Line: 4574

      oe_debug_pub.add('no cancellation, delete ok ', 3 ) ;
Line: 4584

      oe_debug_pub.add('error in Is_Cancel_OR_Delete '|| sqlerrm, 3);
Line: 4587

END Is_Cancel_OR_Delete;