DBA Data[Home] [Help]

APPS.OE_CONFIG_UTIL SQL Statements

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

Line: 47

                 as a single update statement.
------------------------------------------------------------------------ */
Procedure Complete_Config
( p_top_model_line_id IN  NUMBER
, x_return_status     OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 131

    SELECT line_id, inventory_item_id, ordered_quantity, item_type_code,
           shipped_quantity
    FROM   oe_order_lines
    WHERE header_id = l_header_id
    AND   open_flag = 'Y'
    AND  ((top_model_line_id = p_parent_line_id
           and line_id <> p_parent_line_id)
          OR
          (l_item_type_code  = OE_GLOBALS.G_ITEM_CLASS
           and ato_line_id = p_parent_line_id
           and line_id <> p_parent_line_id ));
Line: 258

          oe_debug_pub.add('NEW QTY 0 ,NOT CANCELLATION ,SO DELETE',1);
Line: 260

        l_line_tbl(I).operation  := OE_GLOBALS.G_OPR_DELETE;
Line: 267

      l_line_tbl(I).OPERATION := OE_GLOBALS.G_OPR_UPDATE;
Line: 516

    UPDATE oe_order_lines
    SET    config_header_id = null,
           config_rev_nbr   = null,
           configuration_id = null,
           lock_control     = lock_control + 1
    WHERE  top_model_line_id = p_parent_line_id;
Line: 530

    OE_Config_Pvt.Delete_Config
    ( p_config_hdr_id   =>  l_parent_line_rec.config_header_id
     ,p_config_rev_nbr  =>  l_parent_line_rec.config_rev_nbr
     ,x_return_status   =>  l_return_status);
Line: 637

    SELECT line_id
    FROM   oe_order_lines
    WHERE((top_model_line_id = p_top_model_line_id
           and line_id <> p_line_id)
    OR    (ato_line_id  = p_ato_line_id and
           line_id <> p_line_id ))
    AND    open_flag = 'Y';
Line: 706

      l_line_rec.OPERATION        := OE_GLOBALS.G_OPR_UPDATE;
Line: 875

              SELECT po_header_id
              INTO   l_po_header_id
              FROM   oe_drop_ship_sources
              WHERE  line_id    = l_line_rec.line_id
              AND    header_id  = l_line_rec.header_id;
Line: 930

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

  SELECT line_id,config_header_id,config_rev_nbr,
         configuration_id,booked_flag
  FROM   oe_order_lines
  WHERE  item_type_code = OE_GLOBALS.G_ITEM_MODEL
  AND    header_id = p_header_id
  AND    open_flag = 'Y';
Line: 1150

            Select config_rev_nbr
            Into   l_config_rev_nbr
            From   oe_order_lines_all
            Where  line_id = l_line_id;
Line: 1227

  SELECT line_id
  FROM   oe_order_lines
  WHERE  item_type_code in (OE_GLOBALS.G_ITEM_MODEL,
                            OE_GLOBALS.G_ITEM_CLASS,
                            OE_GLOBALS.G_ITEM_KIT)
  AND    open_flag = 'Y'
  AND    header_id = p_header_id;
Line: 1307

( p_x_options_tbl  IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
 ,p_component_code  IN VARCHAR2
 ,p_ratio           IN NUMBER
  -- 4211654
 ,p_new_qty         in number
 ,p_old_qty         in number
 ,p_change_reason   IN VARCHAR2
 ,p_change_comments IN VARCHAR2);
Line: 1317

PROCEDURE Delete_Children
(p_x_options_tbl  IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code IN VARCHAR2
,p_parent_item    IN VARCHAR2);
Line: 1323

PROCEDURE Delete_Parent
(p_x_options_tbl      IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code     IN VARCHAR2
,p_top_model_line_id  IN NUMBER
,p_model_component    IN VARCHAR2
,p_ui_flag             IN   VARCHAR2 := 'N');
Line: 1332

(p_x_options_tbl      IN Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code     IN VARCHAR2
,p_top_model_line_id  IN NUMBER
,p_model_component    IN VARCHAR2
,p_ui_flag            IN VARCHAR2 := 'N')
RETURN BOOLEAN;
Line: 1341

(p_x_options_tbl      IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code     IN VARCHAR2
,p_top_model_line_id  IN NUMBER
,p_model_component    IN VARCHAR2
,p_ui_flag            IN VARCHAR2 := 'N');
Line: 1375

 p_deleted_options_tbl IN     OE_Order_PUB.request_tbl_type
                                := OE_Order_Pub.G_MISS_REQUEST_TBL,
 p_updated_options_tbl IN     OE_Order_PUB.request_tbl_type
                                := OE_Order_Pub.G_MISS_REQUEST_TBL,
 p_caller              IN     VARCHAR2 := '',
 x_valid_config        OUT NOCOPY /* file.sql.39 change */    VARCHAR2,
 x_complete_config     OUT NOCOPY /* file.sql.39 change */    VARCHAR2,
 x_return_status       OUT NOCOPY /* file.sql.39 change */    VARCHAR2)
IS
      l_header_id              NUMBER := NULL;
Line: 1388

      l_updated_options_tbl    OE_Order_PUB.request_tbl_type
                               := p_updated_options_tbl;
Line: 1390

      l_deleted_options_tbl    OE_Order_PUB.request_tbl_type
                               :=p_deleted_options_tbl;
Line: 1405

                       Oe_Process_Options_Pvt.Selected_Options_Tbl_Type;
Line: 1419

      l_any_insert             NUMBER := 0;
Line: 1433

      SELECT header_id, ordered_quantity, booked_flag,
             upgraded_flag,  config_header_id, config_rev_nbr,
             source_document_type_id,order_source_id
      INTO   l_header_id, l_model_qty, l_booked_flag,
             l_upgraded_flag ,l_config_header_id, l_config_rev_nbr,
             l_source_document_type_id, l_order_source_id
      FROM   OE_ORDER_LINES
      WHERE  line_id = p_model_line_id;
Line: 1498

      SELECT count (*)
      INTO  l_any_insert
      FROM  OE_ORDER_LINES
      WHERE top_model_line_id = p_model_line_id
      AND   line_id <> p_model_line_id
      AND   config_header_id IS NULL
      AND   config_rev_nbr  IS NULL;
Line: 1507

        OE_Debug_Pub.Add('lines w/o cfg hdr '|| l_any_insert, 3);
Line: 1511

      IF l_any_insert = 0 THEN

        BEGIN
          SELECT 1
          INTO   l_any_insert
          FROM   cz_config_details_v cz, oe_order_lines oe
          WHERE  oe.line_id = p_model_line_id
          AND    oe.ordered_quantity <> cz.quantity
          AND    oe.config_header_id = cz.config_hdr_id
          AND    oe.config_rev_nbr   = cz.config_rev_nbr
          AND    oe.component_code   = cz.component_code;
Line: 1534

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

    END IF; -- booked flag and new inserts check.
Line: 1543

       l_updated_options_tbl.COUNT =  0 AND
       l_deleted_options_tbl.COUNT =  0 AND
       l_any_insert = 0   AND
       OE_ORDER_COPY_UTIL.G_ORDER_LEVEL_COPY <> 1 AND
       l_config_rev_nbr is not null AND
       l_config_header_id is not null
    THEN
       IF l_debug_level  > 0 THEN
         OE_Debug_Pub.Add('Skip Batch Validation ');
Line: 1641

        p_deleted_options_tbl  => l_deleted_options_tbl,
        p_updated_options_tbl  => l_updated_options_tbl,
        p_model_qty            => l_model_qty,
        p_xml_hdr              => l_xml_hdr,
        x_out_xml_msg          => l_xml_message,
        x_return_status        => l_return_status );
Line: 1805

 p_deleted_options_tbl IN     OE_Order_PUB.request_tbl_type
                                := OE_Order_Pub.G_MISS_REQUEST_TBL,
 p_updated_options_tbl IN     OE_Order_PUB.request_tbl_type
                                := OE_Order_Pub.G_MISS_REQUEST_TBL,
 p_caller              IN     VARCHAR2 := '',
 x_valid_config        OUT NOCOPY /* file.sql.39 change */    VARCHAR2,
 x_complete_config     OUT NOCOPY /* file.sql.39 change */    VARCHAR2,
 x_return_status       OUT NOCOPY /* file.sql.39 change */    VARCHAR2)
IS
  l_options_tbl     Oe_Process_Options_Pvt.Selected_Options_Tbl_Type;
Line: 1815

  l_updated_options_tbl OE_Order_PUB.request_tbl_type;
Line: 1816

  l_deleted_options_tbl OE_Order_PUB.request_tbl_type;
Line: 1866

  IF p_deleted_options_tbl.COUNT > 0 OR
     p_updated_options_tbl.COUNT > 0 OR
     l_msg_data = 'Y' THEN

    SELECT component_code
    INTO   l_model_component
    FROM   oe_order_lines
    WHERE  line_id = p_model_line_id;
Line: 1875

    l_updated_options_tbl := p_updated_options_tbl;
Line: 1876

    l_deleted_options_tbl := p_deleted_options_tbl;
Line: 1883

       ,p_x_updated_options_tbl => l_updated_options_tbl
       ,p_x_deleted_options_tbl => l_deleted_options_tbl);
Line: 1889

      oe_debug_pub.add('CALLING CASCADE_UPDATES_DELETES '||
                        l_deleted_options_tbl.COUNT || '-' ||
                        l_updated_options_tbl.COUNT, 3);
Line: 1894

    Cascade_Updates_Deletes
    ( p_model_line_id       => p_model_line_id
     ,p_model_component     => l_model_component
     ,p_x_options_tbl       => l_options_tbl
     ,p_deleted_options_tbl => l_deleted_options_tbl
     ,p_updated_options_tbl => l_updated_options_tbl
     ,x_return_status       => l_return_status);
Line: 1937

Procedure Name :  Cascade_Updates_Deletes
Description    :  This API will be used when there are updates and deletes
to option/class of a configuration and we want to cascade the operation to
either upwards or downwards.
  -- handle updates
  -- if any class is updated, modify the l_options-tbl so that, options
  -- qty cascades, set operation of update on the updated once, and none
  -- on the others

  -- handle deletes
  -- if any class deleted, delete all options underit.
  -- if a option is deleted, i.e. the only option in a class
  -- delete the class from l_options_tbl

  Note:
  If a kit under a model is updated/deleted, since its included items
  are not present in l_options_tbl, so we can not use cascade_qty
  or delete_options for it.
  We handle this seperately, before call to process_order in
  handle_dml in OEXVOPTB.pls. We also handle the case of included
  items under a PTO class in handle_dml.

 As part of pack J ato options decimal quantity project
 decimal_ratio_check is moved to OE_VALIDATE_LINE
 for Decimal quantities for ATO Options Project
 the decimal ratio check will be part of line entity
 validation
-----------------------------------------------------------------------*/

PROCEDURE Cascade_Updates_Deletes
( p_model_line_id        IN   NUMBER
 ,p_model_component      IN   VARCHAR2
 ,p_x_options_tbl        IN   OUT NOCOPY
                              Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
 ,p_deleted_options_tbl  IN   OE_Order_PUB.request_tbl_type
                              := OE_Order_Pub.G_MISS_REQUEST_TBL
 ,p_updated_options_tbl  IN   OE_Order_PUB.request_tbl_type
                              := OE_Order_Pub.G_MISS_REQUEST_TBL
 ,p_ui_flag              IN   VARCHAR2 := 'N'
 ,x_return_status        OUT NOCOPY /* file.sql.39 change */  VARCHAR2)
IS
  I                          NUMBER;
Line: 1982

  l_deleted_options_tbl      OE_Order_PUB.request_tbl_type
                             := p_deleted_options_tbl;
Line: 1991

    oe_debug_pub.add('ENTERING CASCADE_UPDATES_DELETES' , 1);
Line: 1992

    oe_debug_pub.add('FIRST UPDATES' , 2 );
Line: 1995

  IF p_updated_options_tbl.COUNT > 0 THEN
    SELECT ordered_quantity
    INTO   l_qty
    FROM   oe_order_lines
    WHERE  line_id = p_model_line_id;
Line: 2002

  I :=p_updated_options_tbl.FIRST;
Line: 2005

    l_req_rec  := p_updated_options_tbl(I);
Line: 2008

      oe_debug_pub.add('OPTIONS UPDATED ' , 4 );
Line: 2018

        oe_debug_pub.add('QTY = 0 AND NO CANCELLATION , SO DELETE' , 1);
Line: 2030

        p_x_options_tbl(l_index).operation := OE_GLOBALS.G_OPR_DELETE;
Line: 2040

      l_deleted_options_tbl(nvl(l_deleted_options_tbl.LAST, 0) + 1) :=
                                  l_req_rec; -- ok, since params match
Line: 2045

        oe_debug_pub.add('REGULAR CODE OF UPDATES'|| L_REQ_REC.PARAM3 , 1);
Line: 2090

    I :=  p_updated_options_tbl.NEXT(I);
Line: 2094

    oe_debug_pub.add('NOW DELETES' , 1);
Line: 2097

  I :=l_deleted_options_tbl.FIRST;
Line: 2101

      oe_debug_pub.add('THERE ARE ITEMS DELETED'|| L_REQ_REC.PARAM2 , 1);
Line: 2104

    l_req_rec  := l_deleted_options_tbl(I);
Line: 2108

        oe_debug_pub.add('CLASS IS DELETED'|| L_REQ_REC.PARAM2 , 1);
Line: 2111

      Delete_Children( p_x_options_tbl  => p_x_options_tbl
                      ,p_component_code => l_req_rec.param2
                      ,p_parent_item    => l_req_rec.param10 ); -- 3563690
Line: 2129

      oe_debug_pub.add('OPTION/CLASS/KIT IS DELETED' , 1);
Line: 2132

    Delete_Parent(p_x_options_tbl     => p_x_options_tbl
                 ,p_component_code    => l_req_rec.param2
                 ,p_top_model_line_id => p_model_line_id
                 ,p_model_component   => p_model_component
                 ,p_ui_flag           => p_ui_flag);
Line: 2138

    I :=  l_deleted_options_tbl.NEXT(I);
Line: 2143

    oe_debug_pub.add('LEAVING CASCADE_UPDATES_DELETES' , 1);
Line: 2149

      oe_debug_pub.add('EXCEPTION IN CASCADE_UPDATES_DELETES'|| SQLERRM , 1);
Line: 2152

END Cascade_Updates_Deletes;
Line: 2161

( p_x_options_tbl   IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
 ,p_component_code  IN VARCHAR2
 ,p_ratio           IN NUMBER
  -- 4211654
 ,p_new_qty         IN number
 ,p_old_qty         IN number
 ,p_change_reason   IN VARCHAR2
 ,p_change_comments IN VARCHAR2)
IS
  I            NUMBER;
Line: 2188

       AND p_x_options_tbl(I).operation <> OE_GLOBALS.G_OPR_DELETE
    THEN
       IF l_debug_level  > 0 THEN
         oe_debug_pub.add('OPTION TO BE UPDATED '
                          || P_X_OPTIONS_TBL (I).COMPONENT_CODE , 3 );
Line: 2207

       IF p_x_options_tbl(I).operation <>  OE_GLOBALS.G_OPR_INSERT THEN
         p_x_options_tbl(I).operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 2229

PROCEDURE: Delete_Children
3563690 => If operation is insert for a child line, do not set the
           operation to delete. Instead, raise an exception
           Changed the signature of the procedure to accept the  name
           of the class.
----------------------------------------------------------------------*/
PROCEDURE Delete_Children
( p_x_options_tbl  IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
 ,p_component_code IN VARCHAR2
 ,p_parent_item    IN VARCHAR2)
IS
  I            NUMBER;
Line: 2247

    oe_debug_pub.add('ENTERING DELETE_CHILDREN' , 1);
Line: 2260

         oe_debug_pub.add('OPTION TO BE DELETED '
                          || P_X_OPTIONS_TBL (I).COMPONENT_CODE , 3 );
Line: 2263

       IF p_x_options_tbl(I).operation <> OE_GLOBALS.G_OPR_INSERT
       THEN
         p_x_options_tbl(I).operation := OE_GLOBALS.G_OPR_DELETE;
Line: 2267

         FND_MESSAGE.SET_NAME('ONT','ONT_CONFIG_INSERT_DELETE');
Line: 2272

           oe_debug_pub.add('OPERATION IS INSERT IN PROCEDURE DELETE_CHILDREN');
Line: 2283

    oe_debug_pub.add('LEAVING DELETE_CHILDREN' , 1);
Line: 2288

      oe_debug_pub.add('ECXEPTION IN DELETE_CHILDREN'|| SQLERRM , 1);
Line: 2291

END Delete_Children;
Line: 2295

PROCEDURE Delete_Parent
delete the parent only if the only option under it is getting deleted.
Never delete the model line.
----------------------------------------------------------------------*/
PROCEDURE Delete_Parent
(p_x_options_tbl      IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code     IN VARCHAR2
,p_top_model_line_id  IN NUMBER
,p_model_component    IN VARCHAR2
,p_ui_flag            IN VARCHAR2 := 'N')
IS
  I                  NUMBER;
Line: 2315

    oe_debug_pub.add('ENTERING DELETE_PARENT' , 1);
Line: 2360

          oe_debug_pub.add('PARENT TO BE DELETED '
                           || P_X_OPTIONS_TBL (I).COMPONENT_CODE , 3 );
Line: 2364

        p_x_options_tbl(I).operation := OE_GLOBALS.G_OPR_DELETE;
Line: 2371

        Delete_Parent(p_x_options_tbl     => p_x_options_tbl
                     ,p_component_code    => l_parent
                     ,p_top_model_line_id => p_top_model_line_id
                     ,p_model_component   => p_model_component
                     ,p_ui_flag           => p_ui_flag);
Line: 2392

    oe_debug_pub.add('LEAVING DELETE_PARENT'|| P_COMPONENT_CODE , 1);
Line: 2397

      oe_debug_pub.add('ECXEPTION IN DELETE_PARENT'|| SQLERRM , 1);
Line: 2400

END Delete_Parent;
Line: 2409

(p_x_options_tbl      IN OUT NOCOPY Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code     IN VARCHAR2
,p_top_model_line_id  IN NUMBER
,p_model_component    IN VARCHAR2
,p_ui_flag            IN VARCHAR2 := 'N')
IS
  I                  NUMBER;
Line: 2475

        p_x_options_tbl(I).operation := OE_GLOBALS.G_OPR_UPDATE;
Line: 2522

delete the parent only if the only option under it is getting deleted.
Never delete the model line.
p_component_code is the component_code of the child, for which
we are trying tofind out if this is the only child to its parent.
----------------------------------------------------------------------*/
FUNCTION No_More_Children_Left
(p_x_options_tbl      IN Oe_Process_Options_Pvt.Selected_Options_Tbl_Type
,p_component_code     IN VARCHAR2
,p_top_model_line_id  IN NUMBER
,p_model_component    IN VARCHAR2
,p_ui_flag            IN VARCHAR2 := 'N')
RETURN BOOLEAN
IS
  l_parent    VARCHAR2(1000);
Line: 2570

       AND p_x_options_tbl(I).operation <> OE_GLOBALS.G_OPR_DELETE
       AND NOT(p_x_options_tbl(I).operation = OE_GLOBALS.G_OPR_UPDATE AND
               p_x_options_tbl(I).ordered_quantity = 0) -- cancel

    THEN
      IF l_debug_level  > 0 THEN
        oe_debug_pub.add('OPTION UNDER SAME PARENT EXISTS' , 3 );
Line: 2591

  SELECT /* MOAC_SQL_CHANGE */ count(*)
  INTO   l_count
  FROM   oe_order_lines_all
  WHERE  top_model_line_id = p_top_model_line_id
  AND    item_type_code = OE_GLOBALS.G_ITEM_INCLUDED
  AND    open_flag      = 'Y'
  AND    link_to_line_id =
      (SELECT line_id
       FROM   oe_order_lines_all
       WHERE  top_model_line_id = p_top_model_line_id
       AND    component_code = l_parent
       AND    open_flag      = 'Y' );
Line: 2636

 p_deleted_options_tbl IN     OE_Order_PUB.request_tbl_type
                                := OE_Order_Pub.G_MISS_REQUEST_TBL,
 p_updated_options_tbl IN     OE_Order_PUB.request_tbl_type
                                := OE_Order_Pub.G_MISS_REQUEST_TBL,
 p_validate_flag       IN     VARCHAR2 := 'Y',
 p_complete_flag       IN     VARCHAR2 := 'Y',
 p_caller              IN     VARCHAR2 := '',
 x_valid_config        OUT NOCOPY /* file.sql.39 change */    VARCHAR2,
 x_complete_config     OUT NOCOPY /* file.sql.39 change */    VARCHAR2,
 x_return_status       OUT NOCOPY /* file.sql.39 change */    VARCHAR2)

IS
  l_header_id                 NUMBER;
Line: 2683

     SELECT header_id, config_header_id, config_rev_nbr, ordered_quantity,
            configuration_id, order_source_id, orig_sys_document_ref,
            orig_sys_line_ref, orig_sys_shipment_ref, change_sequence,
            source_document_type_id, source_document_id, source_document_line_id
     INTO   l_header_id, l_config_hdr_id, l_config_rev_nbr, l_model_qty,
            l_configuration_id, 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_type_id, l_source_document_id, l_source_document_line_id
     FROM   OE_ORDER_LINES_ALL
     WHERE  line_id = p_model_line_id;
Line: 2745

        p_deleted_options_tbl  => p_deleted_options_tbl,
        p_updated_options_tbl  => p_updated_options_tbl,
        p_caller               => p_caller,
        x_valid_config         => x_valid_config,
        x_complete_config      => x_complete_config,
        x_return_status        => x_return_status);
Line: 2769

        p_deleted_options_tbl  => p_deleted_options_tbl,
        p_updated_options_tbl  => p_updated_options_tbl,
        p_caller               => p_caller,
        x_valid_config         => x_valid_config,
        x_complete_config      => x_complete_config,
        x_return_status        => x_return_status);
Line: 2837

                 options that are newly inserted/updated/deleted
                 from the model.

                 SPC validation_status :
                 CONFIG_PROCESSED              constant NUMBER :=0;
Line: 2861

              p_deleted_options_tbl IN   OE_Order_PUB.request_tbl_type
                                    := OE_Order_Pub.G_MISS_REQUEST_TBL,
              p_updated_options_tbl IN   OE_Order_PUB.request_tbl_type
                                    := OE_Order_Pub.G_MISS_REQUEST_TBL,
              p_model_qty           IN NUMBER,
              p_xml_hdr             IN VARCHAR2,
              x_out_xml_msg         OUT NOCOPY /* file.sql.39 change */ LONG ,
              x_return_status       OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
  l_html_pieces              CZ_BATCH_VALIDATE.CFG_OUTPUT_PIECES;
Line: 2871

  l_option                   CZ_BATCH_VALIDATE.INPUT_SELECTION;
Line: 2873

  l_db_options_tbl       OE_Process_Options_Pvt.SELECTED_OPTIONS_TBL_TYPE;
Line: 2917

        SELECT ol.component_code, ol.configuration_id
        INTO   l_component_code, l_configuration_id
        FROM   oe_order_lines ol, cz_config_details_v cz
        WHERE  ol.line_id        = p_model_line_id
        AND    cz.component_code = ol.component_code
        AND    cz.config_hdr_id  = ol.config_header_id
        AND    cz.config_rev_nbr = ol.config_rev_nbr
        AND    cz.quantity      <> ol.ordered_quantity;
Line: 2967

       oe_debug_pub.add('cursor GET NEWLY INSERTED OPTIONS '|| l_flag , 2 );
Line: 3011

        oe_debug_pub.add('OUT OF NEWLY INSERTED OPTIONS LOOP' , 2 );
Line: 3019

       oe_debug_pub.add('NO. OF UPDATED OPTIONS: '
                        ||P_UPDATED_OPTIONS_TBL.COUNT , 2 );
Line: 3021

       oe_debug_pub.add('ENTERING LOOP TO PASS UPDATED OPTIONS' , 2 );
Line: 3027

     FOR I IN 1..p_updated_options_tbl.COUNT
     LOOP
         IF l_debug_level  > 0 THEN
           oe_debug_pub.add('WITHIN THE LOOP OF P_UPDATED_OPTIONS_TBL' , 2 );
Line: 3034

         l_req_rec  := p_updated_options_tbl(l_rec_index);
Line: 3037

           oe_debug_pub.add('UPDATE LINE_ID: ' || L_REQ_REC.ENTITY_ID , 2 );
Line: 3057

            || ' OPTION UPDATED TO A QTY OF: ' || L_REQ_REC.PARAM5 , 3 );
Line: 3072

       oe_debug_pub.add('LEAVING LOOP TO PASS UPDATED OPTIONS' , 2 );
Line: 3080

       oe_debug_pub.add('NO. OF DELETED OPTIONS: '
                        ||P_DELETED_OPTIONS_TBL.COUNT , 2 );
Line: 3082

       oe_debug_pub.add('ENTERING LOOP TO PASS DELETED OPTIONS' , 2 );
Line: 3086

     FOR I IN 1..p_deleted_options_tbl.COUNT
     LOOP

         IF l_debug_level  > 0 THEN
           oe_debug_pub.add('WITHIN THE LOOP OF P_DELETED_OPTIONS_TBL' , 2 );
Line: 3095

         l_req_rec := p_deleted_options_tbl(l_rec_index);
Line: 3125

       oe_debug_pub.add('OUT OF INSERT/UPDATE/DELETE OPTIONS LOOPS ' , 1);
Line: 3131

         l_html_pieces.DELETE;
Line: 3537

      l_selection_line_id               NUMBER;
Line: 3729

         OE_Config_Pvt.Delete_Config
                        ( p_config_hdr_id   =>  l_config_header_id
                         ,p_config_rev_nbr  =>  l_config_rev_nbr
                         ,x_return_status   =>  l_return_status_del);
Line: 3784

    SELECT  line_id
    FROM    OE_ORDER_LINES_ALL
    WHERE   HEADER_ID = l_header_id AND
            TOP_MODEL_LINE_ID   = p_top_model_line_id
    ORDER BY line_number,shipment_number,nvl(option_number,-1),nvl(component_number,-1);
Line: 3801

        SELECT header_id
        INTO   l_header_id
        FROM   oe_order_lines_all
        WHERE  line_id = p_top_model_line_id;
Line: 3854

    SELECT  line_id
    FROM    OE_ORDER_LINES_ALL
    WHERE   HEADER_ID = l_header_id AND
            TOP_MODEL_LINE_ID   = l_top_model_line_id AND
            ATO_LINE_ID   = p_ato_line_id
    ORDER BY line_number,shipment_number,nvl(option_number,-1);
Line: 3871

        SELECT top_model_line_id ,header_id
        INTO   l_top_model_line_id,l_header_id
        FROM   oe_order_lines_all
        WHERE  line_id = p_ato_line_id;
Line: 4032

    SELECT  line_id
    FROM    OE_ORDER_LINES_ALL
    WHERE   HEADER_ID = l_header_id AND
            TOP_MODEL_LINE_ID   = l_top_model_line_id AND
            LINK_TO_LINE_ID   = p_line_id AND
            ITEM_TYPE_CODE    = OE_GLOBALS.G_ITEM_INCLUDED
    ORDER BY line_number,shipment_number,nvl(option_number,-1);
Line: 4053

           SELECT top_model_line_id ,header_id
           INTO   l_top_model_line_id,l_header_id
           FROM   oe_order_lines_all
           WHERE  line_id = p_line_id;
Line: 4107

PROCEDURE update_component_number
(p_line_id           IN  NUMBER ,
 p_top_model_line_id IN  NUMBER ,
 x_return_status     OUT NOCOPY /* file.sql.39 change */ VARCHAR2);
Line: 4150

  Also, insert_into_set call removed, moved to generic
  model_option_defaulting API.
2508632
  Copy Calculate Price Flag of included items from Parent Line.

Bug 2869052 :
  Default_Child_Line procedure would be called only if there are
  any new included items to be created. If the call returns an
  error an exception would be raised. New variable l_default_child_line
  has been created.
-----------------------------------------------------------------------*/
FUNCTION Process_Included_Items
(p_line_rec         IN OE_ORDER_PUB.line_rec_type
                    := OE_ORDER_PUB.G_MISS_LINE_REC,
 p_line_id          IN  NUMBER := FND_API.G_MISS_NUM,
 p_freeze           IN  BOOLEAN,
 p_process_requests IN BOOLEAN DEFAULT FALSE)
RETURN VARCHAR2
IS

  -- process_order in variables
  l_control_rec               OE_GLOBALS.Control_Rec_Type;
Line: 4212

    SELECT
      component_item_id,
      component_sequence_id,
      extended_quantity,
      component_code,
      PRIMARY_UOM_CODE,
      sort_order
    FROM bom_explosions  be
    WHERE
      be.explosion_type = 'INCLUDED'
      AND be.plan_level >= 0
      AND be.extended_quantity > 0
      AND be.TOP_BILL_SEQUENCE_ID = p_top_bill_sequence_id
      AND be.EFFECTIVITY_DATE <= p_std_comp_freeze_date
      AND be.DISABLE_DATE > p_std_comp_freeze_date
      AND be.COMPONENT_ITEM_ID <> be.TOP_ITEM_ID
      AND NOT EXISTS
          (   SELECT 'X'
                FROM  oe_order_lines l
                WHERE l.top_model_line_id = p_top_model_line_id
                AND   l.link_to_line_id   = l_parent_line_rec.line_id
                AND   l.component_code = be.component_code
                AND   l.open_flag = 'Y')
    ORDER BY sort_order;
Line: 4239

  CURSOR update_included_items(p_top_bill_sequence_id IN NUMBER,
                               p_top_model_line_id    IN NUMBER,
                               p_top_model_quantity   IN NUMBER,
                               p_std_comp_freeze_date IN DATE)
  IS
    SELECT
         oel.line_id, be.extended_quantity * p_top_model_quantity
    FROM oe_order_lines oel, bom_explosions be
    WHERE oel.top_model_line_id = p_top_model_line_id
    AND oel.link_to_line_id     = l_parent_line_rec.line_id
    AND oel.item_type_code = 'INCLUDED'
    AND be.explosion_type = 'INCLUDED'
    AND be.plan_level >= 0
    AND be.TOP_BILL_SEQUENCE_ID = p_top_bill_sequence_id
    AND be.EFFECTIVITY_DATE <= p_std_comp_freeze_date
    AND be.DISABLE_DATE > p_std_comp_freeze_date
    AND be.COMPONENT_ITEM_ID <> be.TOP_ITEM_ID
    AND be.component_code = oel.component_code
    AND oel.ordered_quantity/p_top_model_quantity <> be.extended_quantity
    AND oel.open_flag = 'Y';
Line: 4265

    SELECT
         l.line_id
    FROM  oe_order_lines l
    WHERE l.link_to_line_id = l_parent_line_rec.line_id
    AND   l.top_model_line_id = p_top_model_line_id
    AND   l.item_type_code = 'INCLUDED'
    AND   l.open_flag = 'Y'
    AND NOT EXISTS
          (   SELECT 'X'
           FROM  bom_explosions be
           WHERE be.component_code = l.component_code
           AND be.explosion_type   = 'INCLUDED'
           AND be.plan_level >= 0
           AND be.TOP_BILL_SEQUENCE_ID =  p_top_bill_sequence_id
           AND be.EFFECTIVITY_DATE <= p_std_comp_freeze_date
           AND be.DISABLE_DATE > p_std_comp_freeze_date);
Line: 4396

     GOTO UPDATE_EXP_DATE;
Line: 4425

    SELECT bill_sequence_id
    INTO   l_parent_component_sequence_id
    FROM   bom_bill_of_materials
    WHERE  ASSEMBLY_ITEM_ID = l_parent_line_rec.inventory_item_id
    AND    ORGANIZATION_ID = l_validation_org
    AND    ALTERNATE_BOM_DESIGNATOR IS NULL;
Line: 4451

    SELECT max(component_number)
    INTO   l_component_number
    FROM   oe_order_lines
    WHERE  link_to_line_id = p_line_id
    AND    top_model_line_id = l_parent_line_rec.top_model_line_id;
Line: 4524

      SELECT concatenated_segments
      INTO   l_line_rec.ordered_item
      FROM   MTL_SYSTEM_ITEMS_KFV
      WHERE  inventory_item_id = l_line_rec.inventory_item_id
      AND    organization_id   = l_validation_org;
Line: 4539

      oe_debug_pub.add('INSERTING....'|| L_LINE_REC.COMPONENT_CODE , 2 );
Line: 4544

    SELECT OE_ORDER_LINES_S.NEXTVAL
    INTO   l_line_rec.line_id
    FROM   dual;
Line: 4602

  SELECT count(*)
  INTO   l_top_model_quantity
  FROM   oe_order_lines
  WHERE  item_type_code = 'INCLUDED'
  AND    top_model_line_id = l_parent_line_rec.top_model_line_id
  AND    link_to_line_id   = l_parent_line_rec.line_id;
Line: 4625

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

    OPEN update_included_items
       (p_top_bill_sequence_id =>  l_parent_component_sequence_id,
        p_top_model_line_id    =>  l_parent_line_rec.top_model_line_id,
        p_top_model_quantity   =>  l_top_model_quantity,
        p_std_comp_freeze_date =>  l_explosion_date);
Line: 4635

      FETCH update_included_items
      INTO  l_line_rec.line_id, l_line_rec.ordered_quantity;
Line: 4637

      EXIT WHEN update_included_items%NOTFOUND;
Line: 4649

    CLOSE update_included_items;
Line: 4659

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

        oe_debug_pub.add('INCLUDED ITEMS GOT DELETED' , 1);
Line: 4740

     update_component_number
      (p_line_id           => p_line_id,
       p_top_model_line_id => l_parent_line_rec.top_model_line_id,
       x_return_status     => l_return_status);
Line: 4753

  <>
  IF nvl(p_freeze, FALSE) = TRUE OR
     l_freeze_macd_kit THEN
    -- Update the explosion date on the model line.
    BEGIN
      UPDATE OE_ORDER_LINES_ALL
      set explosion_date = l_explosion_date,
          lock_control   = lock_control + 1
      WHERE line_id      = l_parent_line_rec.line_id;
Line: 4797

Procedure Name : update_component_number
Description    : This procedure is written to update the
                 component_number on the included items,
                 if any of them is deleted.

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

PROCEDURE update_component_number(p_line_id           IN  NUMBER ,
                                  p_top_model_line_id IN  NUMBER ,
                                  x_return_status     OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
IS

  CURSOR comp_number IS
  SELECT line_id
  FROM   oe_order_lines
  WHERE  link_to_line_id    = p_line_id
  AND    top_model_line_id  = p_top_model_line_id;
Line: 4822

    oe_debug_pub.add('ENTERING OE_CONFIG_UTIL.UPDATE_COMPONENT_NUMBER' , 1);
Line: 4832

    UPDATE oe_order_lines
    SET    component_number = l_component_number,
           lock_control     = lock_control + 1
    WHERE  line_id = l_line_id;
Line: 4842

    oe_debug_pub.add('EXITING OE_CONFIG_UTIL.UPDATE_COMPONENT_NUMBER' , 1);
Line: 4848

END update_component_number;
Line: 5621

    SELECT  line_id
    FROM    OE_ORDER_LINES_ALL
    WHERE   HEADER_ID = l_header_id
    AND     (TOP_MODEL_LINE_ID   = l_top_model_line_id OR
            ( LINK_TO_LINE_ID   = p_link_to_line_id AND
              ITEM_TYPE_CODE    = OE_GLOBALS.G_ITEM_INCLUDED AND
              TOP_MODEL_LINE_ID = p_top_model_line_id) OR
            ( ATO_LINE_ID       = p_ato_line_id AND
              TOP_MODEL_LINE_ID = p_top_model_line_id))
    ORDER BY line_number,shipment_number,nvl(option_number,-1);
Line: 5656

      SELECT header_id
      INTO l_header_id
      FROM oe_order_lines_all
      WHERE line_id=ll_line_id;
Line: 5787

SELECT line_id, inventory_item_id, ordered_item, component_code
FROM   oe_order_lines
WHERE  top_model_line_id = p_top_model_line_id
AND    item_type_code <> OE_GLOBALS.G_ITEM_CONFIG
AND    open_flag = 'Y'
AND    (component_code is null OR
        component_sequence_id is null OR
        sort_order is null OR
        order_quantity_uom is null
       );
Line: 5809

    SELECT creation_date, component_code, component_sequence_id,
           inventory_item_id, ordered_quantity, ordered_item
    INTO   l_rev_date, l_component_code, l_model_seq_id,
           l_top_item_id, l_exp_quantity, l_model_ordered_item
    FROM   oe_order_lines
    WHERE  line_id = p_top_model_line_id;
Line: 5819

        oe_debug_pub.add('EXCEPTION IN SELECT' , 1);
Line: 5860

       SELECT bill_sequence_id
       into l_model_seq_id
       FROM bom_explosions
       WHERE COMPONENT_ITEM_ID = l_top_item_id
       AND ORGANIZATION_ID = l_validation_org
       AND PLAN_LEVEL = 0
       AND effectivity_date <= l_rev_date
       AND disable_date > l_rev_date
       AND explosion_type   =  l_stdcompflag ;
Line: 5900

        SELECT component_code, component_sequence_id, sort_order,
               primary_uom_code
        INTO   l_component_code, l_component_seq_id, l_sort_order,
               l_uom_code
        FROM   bom_explosions
        WHERE  component_item_id    = line_rec.inventory_item_id
        AND    explosion_type       = Oe_Config_Util.OE_BMX_ALL_COMPS
        AND    top_bill_sequence_id = l_model_seq_id
        AND    effectivity_date     <= l_rev_date
        AND    disable_date         > l_rev_date
        AND    organization_id      =  l_validation_org
        AND    component_code       = line_rec.component_code;
Line: 5918

        SELECT component_code, component_sequence_id, sort_order,
               primary_uom_code
        INTO   l_component_code, l_component_seq_id, l_sort_order,
               l_uom_code
        FROM   bom_explosions
        WHERE  component_item_id    = line_rec.inventory_item_id
        AND    explosion_type       = Oe_Config_Util.OE_BMX_ALL_COMPS
        AND    top_bill_sequence_id = l_model_seq_id
        AND    effectivity_date     <= l_rev_date
        AND    disable_date         > l_rev_date
        AND    organization_id      =  l_validation_org;
Line: 5934

          oe_debug_pub.add('SELECT COMP_CODE FAILED , NO DATA FOUND ' , 1);
Line: 5948

          oe_debug_pub.add('SELECT COMP_CODE FAILED , TOO_MANY ROWS ' , 1);
Line: 5962

         oe_debug_pub.add('SELECT COMP_CODE FAILED , OTHERS ' , 1);
Line: 5969

    UPDATE oe_order_lines
    SET    component_code        = l_component_code,
           component_sequence_id = l_component_seq_id,
           sort_order            = l_sort_order,
           order_quantity_uom    = l_uom_code,
           lock_control          = lock_control + 1
    WHERE line_id = line_rec.line_id;
Line: 6039

       SELECT top_model_line_id, ordered_quantity, order_quantity_uom
       INTO   l_top_model_line_id, l_ordered_quantity, l_order_quantity_uom
       FROM   oe_order_lines
       WHERE  line_id = p_line_id;
Line: 6159

     SELECT item_type_code, ato_line_id, ordered_item,inventory_item_id
     INTO   l_item_type_code, l_ato_line_id, l_ordered_item,l_inv_item_id
     FROM   oe_order_lines
     WHERE  line_id = p_line_id;
Line: 6175

        SELECT inventory_item_id,line_id,header_id,
               RTRIM(line_number||'.'||shipment_number||'.'||
               option_number||'.'||component_number||'.'||
               service_number,'.'),source_type_code
        INTO   l_config_id,l_config_line_id,l_config_header_id,
               l_line_num,l_source_type
        FROM   oe_order_lines
        -- Bug#5026787: Start:- ato_line_id should be used instead of top_model_line_id.
        -- WHERE top_model_line_id = p_line_id
        WHERE ato_line_id = p_line_id
        -- Bug#5026787: End
        AND    item_type_code = 'CONFIG';
Line: 6197

              SELECT po_header_id
              INTO   l_po_header_id
              FROM   oe_drop_ship_sources
              WHERE  line_id    = l_config_line_id
              AND    header_id  = l_config_header_id;
Line: 6250

          oe_debug_pub.add('AFTER SELECT STMT.' , 2 );
Line: 6342

  SELECT item_type_code,header_id, top_model_line_id, line_id
  INTO   l_item_type_code,l_header_id, l_top_model_line_id, l_line_id
  FROM   oe_order_lines
  WHERE  line_id = oe_line_security.g_record.line_id;
Line: 6371

    SELECT count(*)
    INTO   l_count
    FROM   OE_ORDER_LINES
    WHERE  top_model_line_id = oe_line_security.g_record.line_id
    AND    line_id          <> oe_line_security.g_record.line_id
    AND    header_id         = l_header_id;
Line: 6426

     SELECT item_type_code, ato_line_id, ordered_item
     INTO   l_item_type_code, l_ato_line_id, l_ordered_item
     FROM   oe_order_lines
     WHERE  line_id = p_line_id;
Line: 6445

        SELECT distinct 1
        INTO l_valid
        FROM oe_order_lines_all oel,
             mtl_system_items msi
        WHERE oel.line_id = p_line_id
        AND oel.inventory_item_id = msi.base_item_id
        AND msi.inventory_item_id = p_config_item_id;
Line: 6495

Procedure Name :  Update_Comp_Seq_Id
Description    :  API for CTO to do a direct update on
                  oe_order_lines w/o calling process_order.
-----------------------------------------------------------------------*/

PROCEDURE Update_Comp_Seq_Id
( p_line_id        IN  NUMBER
 ,p_comp_seq_id    IN  NUMBER
 ,x_return_status  OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 6510

    oe_debug_pub.add('ENTERING OE_CONFIG_UTIL.UPDATE_COMP_SEQ_ID' , 1);
Line: 6513

  UPDATE oe_order_lines
  SET    component_sequence_id = p_comp_seq_id
        ,last_update_date      = sysdate
        ,last_updated_by       = FND_Global.User_Id
        ,last_update_login     = FND_Global.Login_Id
        ,lock_control          = lock_control + 1
  where  line_id = p_line_id;
Line: 6524

    oe_debug_pub.add('EXITING OE_CONFIG_UTIL.UPDATE_COMP_SEQ_ID' , 1);
Line: 6530

      oe_debug_pub.add('NO_DATA_FOUND IN UPDATE_COMP_SEQ_ID' , 1);
Line: 6536

      oe_debug_pub.add('OTHERS EXCEPTION IN UPDATE_COMP_SEQ_ID' , 1);
Line: 6539

END Update_Comp_Seq_Id;
Line: 6543

Procedure Name :  Update_Visible_Demand_Flag
Description    :  API for CTO to do a direct update on
                  oe_order_lines w/o calling process_order.
-----------------------------------------------------------------------*/

PROCEDURE  Update_Visible_Demand_Flag
( p_ato_line_id            IN  NUMBER
 ,p_visible_demand_flag    IN  VARCHAR2 := 'N'
 ,x_return_status          OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 6558

    oe_debug_pub.add('ENTERING OE_CONFIG_UTIL.UPDATE_VISIBLE_DEMAND_FLAG' , 1);
Line: 6561

  UPDATE oe_order_lines
  SET    visible_demand_flag = p_visible_demand_flag
        ,last_update_date      = sysdate
        ,last_updated_by       = FND_Global.User_Id
        ,last_update_login     = FND_Global.Login_Id
        ,lock_control          = lock_control + 1
  where  ato_line_id = p_ato_line_id;
Line: 6572

    oe_debug_pub.add('EXITING OE_CONFIG_UTIL.UPDATE_VISIBLE_DEMAND_FLAG' , 1);
Line: 6578

      oe_debug_pub.add('NO_DATA_FOUND IN UPDATE_VISIBLE_DEMAND_FLAG' , 1);
Line: 6584

      oe_debug_pub.add('OTHERS EXCEPTION IN UPDATE_VISIBLE_DEMAND_FLAG' , 1);
Line: 6587

END  Update_Visible_Demand_Flag;
Line: 6591

Procedure Name :  Update_Mfg_Comp_Seq_Id
Description    :  API for CTO to do a direct update on
                  oe_order_lines w/o calling process_order.
-----------------------------------------------------------------------*/

PROCEDURE  Update_Mfg_Comp_Seq_Id
( p_ato_line_id            IN  NUMBER
 ,p_mfg_comp_seq_id        IN  NUMBER
 ,x_return_status          OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 6606

    oe_debug_pub.add('ENTERING OE_CONFIG_UTIL.UPDATE_MFG_COMP_SEQ_ID' , 1);
Line: 6609

  UPDATE oe_order_lines_all
  SET    mfg_component_sequence_id = p_mfg_comp_seq_id
        ,last_update_date      = sysdate
        ,last_updated_by       = FND_Global.User_Id
        ,last_update_login     = FND_Global.Login_Id
        ,lock_control          = lock_control + 1
  where  ato_line_id = p_ato_line_id;
Line: 6620

    oe_debug_pub.add('EXITING OE_CONFIG_UTIL.UPDATE_MFG_COMP_SEQ_ID' , 1);
Line: 6626

      oe_debug_pub.add('NO_DATA_FOUND IN UPDATE_MFG_COMP_SEQ_ID' , 1);
Line: 6632

      oe_debug_pub.add('OTHERS EXCEPTION IN UPDATE_MFG_COMP_SEQ_ID' , 1);
Line: 6635

END  Update_Mfg_Comp_Seq_Id;
Line: 6639

Procedure Name :  Update_Model_Group_Number
Description    :  API for CTO to do a direct update on
                  oe_order_lines w/o calling process_order.
-----------------------------------------------------------------------*/

PROCEDURE  Update_Model_Group_Number
( p_ato_line_id            IN  NUMBER
 ,p_model_group_number     IN  NUMBER
 ,x_return_status          OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 6654

    oe_debug_pub.add('ENTERING OE_CONFIG_UTIL.UPDATE_MODEL_GROUP_NUMBER' , 1);
Line: 6657

  UPDATE oe_order_lines
  SET    model_group_number = p_model_group_number
        ,last_update_date      = sysdate
        ,last_updated_by       = FND_Global.User_Id
        ,last_update_login     = FND_Global.Login_Id
        ,lock_control          = lock_control + 1
  where  ato_line_id = p_ato_line_id;
Line: 6668

    oe_debug_pub.add('EXITING OE_CONFIG_UTIL.UPDATE_MODEL_GROUP_NUMBER' , 1);
Line: 6674

      oe_debug_pub.add('NO_DATA_FOUND IN UPDATE_MODEL_GROUP_NUMBER' , 1);
Line: 6680

      oe_debug_pub.add('OTHERS EXCEPTION IN UPDATE_MODEL_GROUP_NUMBER' , 1);
Line: 6683

END  Update_Model_Group_Number;
Line: 6687

Procedure Name :  Update_Cto_Columns
Description    :  API for CTO to do a direct update on
                  oe_order_lines w/o calling process_order.
-----------------------------------------------------------------------*/

PROCEDURE  Update_Cto_Columns
( p_ato_line_id            IN  NUMBER
 ,p_request_id             IN  NUMBER
 ,p_program_id             IN  NUMBER
 ,p_prog_update_date       IN  DATE
 ,p_prog_appl_id           IN  NUMBER
 ,x_return_status          OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
IS
--
l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
Line: 6705

    oe_debug_pub.add('ENTERING OE_CONFIG_UTIL.UPDATE_CTO_COLUMNS' , 1);
Line: 6708

  UPDATE oe_order_lines
  SET    request_id             = p_request_id
        ,program_id             = p_program_id
        ,program_update_date    = p_prog_update_date
        ,program_application_id = p_prog_appl_id
        ,last_update_date       = sysdate
        ,last_updated_by        = FND_Global.User_Id
        ,last_update_login      = FND_Global.Login_Id
        ,lock_control           = lock_control + 1
  where  ato_line_id            = p_ato_line_id;
Line: 6722

    oe_debug_pub.add('EXITING OE_CONFIG_UTIL.UPDATE_CTO_COLUMNS' , 1);
Line: 6728

      oe_debug_pub.add('NO_DATA_FOUND IN UPDATE_CTO_COLUMNS' , 1);
Line: 6734

      oe_debug_pub.add('OTHERS EXCEPTION IN UPDATE_CTO_COLUMNS' , 1);
Line: 6737

END  Update_Cto_Columns;
Line: 6853

    SELECT ato_line_id
    INTO   l_ato_line_id
    FROM   oe_order_lines
    WHERE  line_id = p_request_tbl(I).param1;
Line: 6977

  SELECT ordered_item, item_type_code,inventory_item_id
  INTO   l_ordered_item, l_item_type_code,l_inv_item_id
  FROM   oe_order_lines
  WHERE  top_model_line_id = p_top_model_line_id
  AND    component_code = p_component_code
  AND    rownum = 1;
Line: 6988

  SELECT ordered_item, item_type_code,inventory_item_id
  INTO   l_ordered_item, l_item_type_code,l_inv_item_id
  FROM   oe_order_lines
  WHERE  line_id = p_top_model_line_id;
Line: 7042

additional columns from parent in case of direct insert of
class line.

bug 2015511:
added cancelled_flag := 'N' in direct_save defaulting.

2150536 : moved the ato/smc/set specific defaulting to
here in default_child_line.

bug 2208039: copy dff from parent to child.

Dropship for config: populate the source_type from parent if
ato_line_id not null.

bug 2311690: get all reqd. attributes for ato under pto
from the parent ato.

Bug 2454658: Raise Error if Top Model line id or
header id are NULL.

Bug 1282873: Assign override_atp_date_code from the parent to child
for ato model.

Bug 2511313: For flexfield defaulting.
The call to OE_Validate_Line.Validate_Flex is not for validation
but to default the flex field segments, this call should be made
after the ont_copy_model_dff logic.

Bug 2703023: Setting calculate price flag to Y when direct save
related profile is set to Yes

Bug 2869052: copy dff from model to child has been extended to all
callers and the validate_flex is called with validation level FULL
and we raise an exception if it returns an error.

Bug 3060043: Enabling the code to default blanket number,blanket
version number and blanket line number for Config Items.
Blanket Line number and Version Number for the Child lines will be
defaulted only when blanket number is defined on the parent line.
Otherwise it should not.
This code was added by Srini to support CONFIG ITEMS for PACK-J.

bug fix 3056512: ship to, bill to and request date not cascaded for
non SMC models if caller provides a value.

MACD: Different components of a container model should be allowed to
have different line types when order is received from upstream
sales application
-------------------------------------------------------------------*/
PROCEDURE Default_Child_Line
( p_parent_line_rec    IN   OE_Order_Pub.Line_Rec_Type
 ,p_x_child_line_rec   IN   OUT NOCOPY OE_Order_Pub.Line_Rec_Type
 ,p_direct_save        IN   BOOLEAN := FALSE
 ,x_return_status      OUT NOCOPY /* file.sql.39 change */  VARCHAR2)
IS
--
l_debug_level CONSTANT   NUMBER := oe_debug_pub.g_debug_level;
Line: 7560

    p_x_child_line_rec.last_update_date   := p_parent_line_rec.last_update_date;
Line: 7561

    p_x_child_line_rec.last_updated_by    := p_parent_line_rec.last_updated_by;
Line: 7709

     SELECT user_item_description
     INTO   p_x_child_line_rec.user_item_description
     FROM   oe_order_lines
     WHERE  line_id = p_x_child_line_rec.ato_line_id;
Line: 7736

     SELECT source_type_code, project_id, task_id,
            ship_from_org_id, ship_to_org_id,
            schedule_ship_date, schedule_arrival_date,
            request_date, shipping_method_code,
            freight_carrier_code, invoice_to_org_id,
            firm_demand_flag, override_atp_date_code,
            ship_to_contact_id,intmed_ship_to_org_id  --bug 7041018,7175458
     INTO   p_x_child_line_rec.source_type_code,
            p_x_child_line_rec.project_id,
            p_x_child_line_rec.task_id,
            p_x_child_line_rec.ship_from_org_id,
            p_x_child_line_rec.ship_to_org_id,
            p_x_child_line_rec.schedule_ship_date,
            p_x_child_line_rec.schedule_arrival_date,
            p_x_child_line_rec.request_date,
            p_x_child_line_rec.shipping_method_code,
            p_x_child_line_rec.freight_carrier_code,
            p_x_child_line_rec.invoice_to_org_id,
            p_x_child_line_rec.firm_demand_flag,
            p_x_child_line_rec.override_atp_date_code,
            p_x_child_line_rec.ship_to_contact_id,   --bug7041018,7175458
            p_x_child_line_rec.intermed_ship_to_org_id   --bug 7041018,7175458
     FROM   oe_order_lines
     WHERE  line_id = p_x_child_line_rec.ato_line_id;
Line: 7800

This API will check if the delete and update quantity operation
performed on a Included item should be allowed or not.
We will not allow any user delete/update quantity.
We will allow system changes ex: cascading.

We have to write a pl/sql api because we want the system to be able to
do the operations.

result of 1 means constrained.

Process_Included_Items procedure will set the security_check to
false, before calling process_order.

--##1922440 bug fix.
----------------------------------------------------------------------*/
PROCEDURE Is_Included_Item_Constrained
( p_application_id                IN   NUMBER,
  p_entity_short_name             IN   VARCHAR2,
  p_validation_entity_short_name  IN   VARCHAR2,
  p_validation_tmplt_short_name   IN   VARCHAR2,
  p_record_set_short_name         IN   VARCHAR2,
  p_scope                         IN   VARCHAR2,
  x_result                        OUT NOCOPY /* file.sql.39 change */  NUMBER )
IS
  l_item_type_code         VARCHAR2(30);
Line: 7837

  SELECT item_type_code, model_remnant_flag
  INTO   l_item_type_code, l_model_remnant_flag
  FROM   oe_order_lines
  WHERE  line_id = oe_line_security.g_record.line_id;
Line: 7992

       p_line_tbl(I).operation = 'UPDATE' THEN

      IF l_debug_level  > 0 THEN
        oe_debug_pub.add('LOGGING REQ TO VERIFY_PAYMENT' , 3 );
Line: 8038

	select 'Y'
	into   l_serviceable_item
	from   mtl_system_items mtl
	where  mtl.inventory_item_id = p_line_tbl(I).inventory_item_id
	and    mtl.organization_id = OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID')
	and    mtl.serviceable_product_flag='Y'
	and    rownum = 1;
Line: 8059

	   select 'Y'
           into   l_serviced_model
	   from   oe_order_lines
	   where  item_type_code = 'SERVICE'
	   and    service_reference_line_id = p_line_tbl(I).top_model_line_id
	   and    service_reference_type_code = 'ORDER'
	   and    rownum = 1;
Line: 8217

  SELECT count(*)
  INTO   l_count
  FROM   oe_order_lines
  WHERE  line_category_code  <> 'RETURN'
	-- the condition below is commented for bug 3441504
 -- AND  booked_flag = 'Y'
  AND    (header_id          = p_header_id OR
          (top_model_line_id = p_top_model_line_id AND
           p_line_id         = p_top_model_line_id) OR
          (ato_line_id       = p_ato_line_id AND
           top_model_line_id = p_top_model_line_id AND
           p_line_id         = p_ato_line_id AND
           p_item_type_code in ('MODEL', 'CLASS')) OR
          line_id           = p_line_id)
  AND    ((source_type_code = 'EXTERNAL' AND
           shippable_flag = 'Y') OR
          (ato_line_id = line_id AND
           item_type_code in ('STANDARD', 'OPTION')) OR
           item_type_code = 'CONFIG')
  AND     OPEN_FLAG = 'Y';
Line: 8336

    SELECT constraint_type , message
    FROM   cz_config_messages
    WHERE  config_hdr_id =  p_config_hdr_id
    AND    config_rev_nbr = p_config_rev_nbr;
Line: 8367

        SELECT nvl(ordered_item,inventory_item_id )
        INTO   l_message_text
        FROM   oe_order_lines
        WHERE  line_id = p_line_id;
Line: 8438

      SELECT creation_date
      INTO   l_creation_date
      FROM   oe_order_lines
      WHERE  header_id = l_header_id
      AND    line_set_id = p_model_line_rec.line_set_id
      AND    split_from_line_id is NULL;
Line: 8471

    SELECT header_id, creation_date,
           line_set_id, split_from_line_id
    INTO   l_header_id, l_creation_date,
           l_line_set_id, l_split_from_line_id
    FROM   oe_order_lines
    WHERE  line_id = p_model_line_id;
Line: 8480

      SELECT creation_date
      INTO   l_creation_date
      FROM   oe_order_lines
      WHERE  header_id = l_header_id
      AND    line_set_id = l_line_set_id
      AND    split_from_line_id is NULL;
Line: 8550

    SELECT nvl(booked_flag, 'N'), booked_date
    INTO   x_frozen_model_bill, x_config_effective_date
    FROM   oe_order_headers
    WHERE  header_id = l_header_id;
Line: 8584

    SELECT nvl(booked_flag, 'N')    INTO   x_frozen_model_bill
    FROM   oe_order_headers
    WHERE  header_id = l_header_id;