DBA Data[Home] [Help]

APPS.WSM_SERIAL_SUPPORT_PVT SQL Statements

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

Line: 111

PROCEDURE update_serial_attr ( p_calling_mode           IN         NUMBER,
                               p_serial_number_rec      IN         WSM_Serial_Support_GRP.WSM_SERIAL_NUM_REC,
                               p_inventory_item_id      IN         NUMBER,
                               p_organization_id        IN         NUMBER,
                               p_clear_serial_attr      IN         NUMBER DEFAULT NULL,  -- will be used in case of WLT SpUA to clear the attributes
                               p_wlt_txn_type           IN         NUMBER DEFAULT NULL,
                               -- Pass the serial attribute context corresponding to the inventory item id
                               p_serial_attr_context    IN         VARCHAR2 DEFAULT NULL,
                               p_update_serial_attr     IN         NUMBER,
                               p_update_desc_attr       IN         NUMBER,
                               x_return_status          OUT NOCOPY VARCHAR2,
                               x_error_count            OUT NOCOPY NUMBER,
                               x_error_msg              OUT NOCOPY VARCHAR2
                             );
Line: 231

        select
        wsti.Serial_Number                     ,
        null                                   ,  -- assembly_item_id
        wsti.header_id                         ,  -- header_id
        wsti.Generate_serial_number            ,
        wsti.Generate_for_qty                  ,
        wsti.Action_flag                       ,
        wsti.Current_wip_entity_name           ,
        wsti.Changed_wip_entity_name           ,
        wsti.Current_wip_entity_id             ,
        wsti.Changed_wip_entity_id             ,
        decode(wsti.serial_attribute_category  , l_null_char, null, null, msn.serial_attribute_category, wsti.serial_attribute_category), -- serial_attribute_category
        decode(wsti.territory_code             , l_null_char, null, null, msn.territory_code           , wsti.territory_code           ), -- territory_code
        decode(wsti.origination_date           , l_null_date, null, null, msn.origination_date         , wsti.origination_date         ), -- origination_date
        decode(wsti.c_attribute1               , l_null_char, null, null, msn.c_attribute1             , wsti.c_attribute1             ), -- c_attribute1
        decode(wsti.c_attribute2               , l_null_char, null, null, msn.c_attribute2             , wsti.c_attribute2             ), -- c_attribute2
        decode(wsti.c_attribute3               , l_null_char, null, null, msn.c_attribute3             , wsti.c_attribute3             ), -- c_attribute3
        decode(wsti.c_attribute4               , l_null_char, null, null, msn.c_attribute4             , wsti.c_attribute4             ), -- c_attribute4
        decode(wsti.c_attribute5               , l_null_char, null, null, msn.c_attribute5             , wsti.c_attribute5             ), -- c_attribute5
        decode(wsti.c_attribute6               , l_null_char, null, null, msn.c_attribute6             , wsti.c_attribute6             ), -- c_attribute6
        decode(wsti.c_attribute7               , l_null_char, null, null, msn.c_attribute7             , wsti.c_attribute7             ), -- c_attribute7
        decode(wsti.c_attribute8               , l_null_char, null, null, msn.c_attribute8             , wsti.c_attribute8             ), -- c_attribute8
        decode(wsti.c_attribute9               , l_null_char, null, null, msn.c_attribute9             , wsti.c_attribute9             ), -- c_attribute9
        decode(wsti.c_attribute10              , l_null_char, null, null, msn.c_attribute10            , wsti.c_attribute10            ), -- c_attribute10
        decode(wsti.c_attribute11              , l_null_char, null, null, msn.c_attribute11            , wsti.c_attribute11            ), -- c_attribute11
        decode(wsti.c_attribute12              , l_null_char, null, null, msn.c_attribute12            , wsti.c_attribute12            ), -- c_attribute12
        decode(wsti.c_attribute13              , l_null_char, null, null, msn.c_attribute13            , wsti.c_attribute13            ), -- c_attribute13
        decode(wsti.c_attribute14              , l_null_char, null, null, msn.c_attribute14            , wsti.c_attribute14            ), -- c_attribute14
        decode(wsti.c_attribute15              , l_null_char, null, null, msn.c_attribute15            , wsti.c_attribute15            ), -- c_attribute15
        decode(wsti.c_attribute16              , l_null_char, null, null, msn.c_attribute16            , wsti.c_attribute16            ), -- c_attribute16
        decode(wsti.c_attribute17              , l_null_char, null, null, msn.c_attribute17            , wsti.c_attribute17            ), -- c_attribute17
        decode(wsti.c_attribute18              , l_null_char, null, null, msn.c_attribute18            , wsti.c_attribute18            ), -- c_attribute18
        decode(wsti.c_attribute19              , l_null_char, null, null, msn.c_attribute19            , wsti.c_attribute19            ), -- c_attribute19
        decode(wsti.c_attribute20              , l_null_char, null, null, msn.c_attribute20            , wsti.c_attribute20            ), -- c_attribute20
        decode(wsti.d_attribute1               , l_null_date, null, null, msn.d_attribute1             , wsti.d_attribute1             ), -- d_attribute1
        decode(wsti.d_attribute2               , l_null_date, null, null, msn.d_attribute2             , wsti.d_attribute2             ), -- d_attribute2
        decode(wsti.d_attribute3               , l_null_date, null, null, msn.d_attribute3             , wsti.d_attribute3             ), -- d_attribute3
        decode(wsti.d_attribute4               , l_null_date, null, null, msn.d_attribute4             , wsti.d_attribute4             ), -- d_attribute4
        decode(wsti.d_attribute5               , l_null_date, null, null, msn.d_attribute5             , wsti.d_attribute5             ), -- d_attribute5
        decode(wsti.d_attribute6               , l_null_date, null, null, msn.d_attribute6             , wsti.d_attribute6             ), -- d_attribute6
        decode(wsti.d_attribute7               , l_null_date, null, null, msn.d_attribute7             , wsti.d_attribute7             ), -- d_attribute7
        decode(wsti.d_attribute8               , l_null_date, null, null, msn.d_attribute8             , wsti.d_attribute8             ), -- d_attribute8
        decode(wsti.d_attribute9               , l_null_date, null, null, msn.d_attribute9             , wsti.d_attribute9             ), -- d_attribute9
        decode(wsti.d_attribute10              , l_null_date, null, null, msn.d_attribute10            , wsti.d_attribute10            ), -- d_attribute10
        decode(wsti.n_attribute1               , l_null_num , null, null, msn.n_attribute1             , wsti.n_attribute1             ), -- n_attribute1
        decode(wsti.n_attribute2               , l_null_num , null, null, msn.n_attribute2             , wsti.n_attribute2             ), -- n_attribute2
        decode(wsti.n_attribute3               , l_null_num , null, null, msn.n_attribute3             , wsti.n_attribute3             ), -- n_attribute3
        decode(wsti.n_attribute4               , l_null_num , null, null, msn.n_attribute4             , wsti.n_attribute4             ), -- n_attribute4
        decode(wsti.n_attribute5               , l_null_num , null, null, msn.n_attribute5             , wsti.n_attribute5             ), -- n_attribute5
        decode(wsti.n_attribute6               , l_null_num , null, null, msn.n_attribute6             , wsti.n_attribute6             ), -- n_attribute6
        decode(wsti.n_attribute7               , l_null_num , null, null, msn.n_attribute7             , wsti.n_attribute7             ), -- n_attribute7
        decode(wsti.n_attribute8               , l_null_num , null, null, msn.n_attribute8             , wsti.n_attribute8             ), -- n_attribute8
        decode(wsti.n_attribute9               , l_null_num , null, null, msn.n_attribute9             , wsti.n_attribute9             ), -- n_attribute9
        decode(wsti.n_attribute10              , l_null_num , null, null, msn.n_attribute10            , wsti.n_attribute10            ), -- n_attribute10
        decode(wsti.status_id                  , l_null_num , null, null, msn.status_id                , wsti.status_id                ), -- status_id
        decode(wsti.time_since_new             , l_null_num , null, null, msn.time_since_new           , wsti.time_since_new           ), -- time_since_new
        decode(wsti.cycles_since_new           , l_null_num , null, null, msn.cycles_since_new         , wsti.cycles_since_new         ), -- cycles_since_new
        decode(wsti.time_since_overhaul        , l_null_num , null, null, msn.time_since_overhaul      , wsti.time_since_overhaul      ), -- time_since_overhaul
        decode(wsti.cycles_since_overhaul      , l_null_num , null, null, msn.cycles_since_overhaul    , wsti.cycles_since_overhaul    ), -- cycles_since_overhaul
        decode(wsti.time_since_repair          , l_null_num , null, null, msn.time_since_repair        , wsti.time_since_repair        ), -- time_since_repair
        decode(wsti.cycles_since_repair        , l_null_num , null, null, msn.cycles_since_repair      , wsti.cycles_since_repair      ), -- cycles_since_repair
        decode(wsti.time_since_visit           , l_null_num , null, null, msn.time_since_visit         , wsti.time_since_visit         ), -- time_since_visit
        decode(wsti.cycles_since_visit         , l_null_num , null, null, msn.cycles_since_visit       , wsti.cycles_since_visit       ), -- cycles_since_visit
        decode(wsti.time_since_mark            , l_null_num , null, null, msn.time_since_mark          , wsti.time_since_mark          ), -- time_since_mark
        decode(wsti.cycles_since_mark          , l_null_num , null, null, msn.cycles_since_mark        , wsti.cycles_since_mark        ), -- cycles_since_mark
        decode(wsti.number_of_repairs          , l_null_num , null, null, msn.number_of_repairs        , wsti.number_of_repairs        ), -- number_of_repairs
        decode(wsti.attribute_category         , l_null_char, l_miss_char , null ,msn.attribute_category   ,wsti.attribute_category    ),
        decode(wsti.attribute1                 , l_null_char ,l_miss_char , wsti.attribute1            ),
        decode(wsti.attribute2                 , l_null_char ,l_miss_char , wsti.attribute2            ),
        decode(wsti.attribute3                 , l_null_char ,l_miss_char , wsti.attribute3            ),
        decode(wsti.attribute4                 , l_null_char ,l_miss_char , wsti.attribute4            ),
        decode(wsti.attribute5                 , l_null_char ,l_miss_char , wsti.attribute5            ),
        decode(wsti.attribute6                 , l_null_char ,l_miss_char , wsti.attribute6            ),
        decode(wsti.attribute7                 , l_null_char ,l_miss_char , wsti.attribute7            ),
        decode(wsti.attribute8                 , l_null_char ,l_miss_char , wsti.attribute8            ),
        decode(wsti.attribute9                 , l_null_char ,l_miss_char , wsti.attribute9            ),
        decode(wsti.attribute10                , l_null_char ,l_miss_char , wsti.attribute10           ),
        decode(wsti.attribute11                , l_null_char ,l_miss_char , wsti.attribute11           ),
        decode(wsti.attribute12                , l_null_char ,l_miss_char , wsti.attribute12           ),
        decode(wsti.attribute13                , l_null_char ,l_miss_char , wsti.attribute13           ),
        decode(wsti.attribute14                , l_null_char ,l_miss_char , wsti.attribute14           ),
        decode(wsti.attribute15                , l_null_char ,l_miss_char , wsti.attribute15           )
        from wsm_serial_txn_interface wsti,
             mtl_serial_numbers       msn
        where header_id = p_header_id
        and transaction_type_id = 1
        and  wsti.serial_number = msn.serial_number (+)
        and  msn.inventory_item_id (+) = p_inventory_item_id
        and  msn.current_organization_id (+) = p_organization_id
        order by nvl(wsti.action_flag,0) desc; -- Code review remark
Line: 345

                l_param_tbl.delete;
Line: 381

        select status_type
        into   l_status_type
        from   wip_discrete_jobs
        where  wip_entity_id = p_wip_entity_id
        and    organization_id = p_organization_id;
Line: 395

                        l_msg_tokens.delete;
Line: 411

                l_msg_tokens.delete;
Line: 522

                l_param_tbl.delete;
Line: 592

                                l_msg_tokens.delete;
Line: 613

                        l_msg_tokens.delete;
Line: 723

                        SELECT  nvl(SERIAL_NUMBER_CONTROL_CODE,1)
                        INTO    x_serial_ctrl_code
                        FROM    MTL_SYSTEM_ITEMS MSI
                        WHERE   MSI.inventory_item_id = p_serial_item_id
                        AND     MSI.organization_id = p_organization_id;
Line: 737

                                        l_msg_tokens.delete;
Line: 767

                SELECT WDJ.serialization_start_op,
                       first_serial_txn_id,
                       WLBJ.serialization_start_op
                INTO   x_serial_start_flag,
                       x_first_serial_txn_id,
                       x_serial_start_op
                FROM   WSM_LOT_BASED_JOBS WLBJ,WIP_DISCRETE_JOBS WDJ
                WHERE  WLBJ.wip_entity_id = p_wip_entity_id
                AND    WDJ.wip_entity_id = WLBJ.wip_entity_id
                AND    WLBJ.organization_id = p_organization_id;
Line: 786

                                l_msg_tokens.delete;
Line: 886

                l_param_tbl.delete;
Line: 900

                l_msg_tokens.delete;
Line: 921

                SELECT start_quantity
                into l_job_qty
                from wip_discrete_jobs
                where wip_entity_id = p_wip_entity_id
                and organization_id = p_organization_id;
Line: 930

                        SELECT max(operation_seq_num)
                        INTO   l_op_seq_num
                        FROM   wip_operations
                        WHERE  wip_entity_id = p_wip_entity_id
                        AND   ((quantity_in_queue <> 0
                                 OR quantity_running <> 0
                                 OR quantity_waiting_to_move <> 0)
                                 OR (quantity_in_queue = 0
                                     and quantity_running = 0
                                     and quantity_waiting_to_move = 0
                                     and quantity_scrapped = quantity_completed
                                     and quantity_completed > 0));
Line: 945

                        SELECT quantity_in_queue,
                               quantity_running,
                               quantity_waiting_to_move
                        INTO   l_qty_queue,
                               l_qty_run,
                               l_qty_tomove
                        FROM   wip_operations
                        WHERE  wip_entity_id = p_wip_entity_id
                        AND    operation_seq_num = l_op_seq_num;
Line: 973

                SELECT count(*)
                into l_serial_num_count
                -- ST : Fix for bug 4910758 (remove usage of wsm_job_serial_numbers_v)
                -- from wsm_job_serial_numbers_v
                from mtl_serial_numbers
                where wip_entity_id = p_wip_entity_id
                and   inventory_item_id = p_item_id
                and   current_organization_id = p_organization_id;
Line: 990

                   (p_wsm_serial_nums_tbl(l_index).action_flag <> WSM_UPDATE_SERIAL_NUM)
                then -- Serialization has begun and action is not update...

                        l_stmt_num := 100;
Line: 999

                                l_msg_tokens.delete;
Line: 1024

                                        l_msg_tokens.delete;
Line: 1073

                        update_serial( p_serial_number                  => p_wsm_serial_nums_tbl(l_index).serial_number,
                                       p_inventory_item_id              => p_item_id,
                                       -- p_new_inventory_item_id               => p_inventory_item_id,
                                       p_organization_id                => p_organization_id,
                                       p_wip_entity_id                  => null,
                                       p_operation_seq_num              => null,
                                       p_intraoperation_step_type       => null,
                                       x_return_status                  => x_return_status,
                                       x_error_msg                      => x_error_msg,
                                       x_error_count                    => x_error_count
                                     );
Line: 1113

                                        l_msg_tokens.delete;
Line: 1137

                                        l_msg_tokens.delete;
Line: 1187

                elsif p_wsm_serial_nums_tbl(l_index).action_flag = WSM_UPDATE_SERIAL_NUM then

                        l_stmt_num := 270;
Line: 1191

                        update_serial_attr (   p_calling_mode           => p_calling_mode                                ,
                                               p_serial_number_rec      => p_wsm_serial_nums_tbl(l_index)                ,
                                               p_inventory_item_id      => p_item_id                                     ,
                                               p_organization_id        => p_organization_id                             ,
                                               p_clear_serial_attr      => null                                          ,
                                               p_wlt_txn_type           => null                                          ,
                                               p_update_serial_attr     => null                                          ,
                                               p_update_desc_attr       => null                                          ,
                                               x_return_status          => x_return_status                               ,
                                               x_error_count            => x_error_count                                 ,
                                               x_error_msg              => x_error_msg
                                             );
Line: 1220

                                l_msg_tokens.delete;
Line: 1322

                        l_msg_tokens.delete;
Line: 1351

                                l_msg_tokens.delete;
Line: 1372

                        l_msg_tokens.delete;
Line: 1409

                                l_msg_tokens.delete;
Line: 1451

       update_serial( p_serial_number                   => l_serial_number,
                      p_inventory_item_id               => p_inventory_item_id,
                      --p_new_inventory_item_id         => p_inventory_item_id,
                      p_organization_id                 => p_organization_id,
                      p_wip_entity_id                   => p_wip_entity_id,
                      p_operation_seq_num               => p_operation_seq_num,
                      p_intraoperation_step_type        => p_intraoperation_step,
                      x_return_status                   => x_return_status,
                      x_error_msg                       => x_error_msg,
                      x_error_count                     => x_error_count
                    );
Line: 1473

       IF p_gen_serial_flag = 1 THEN -- Indicates that it is a generation call.. so no updates will be done...
                RETURN;
Line: 1479

       update_serial_attr (   p_calling_mode            => p_calling_mode             ,
                               p_serial_number_rec      => p_serial_number_rec        ,
                               p_inventory_item_id      => p_inventory_item_id        ,
                               p_organization_id        => p_organization_id          ,
                               p_clear_serial_attr      => null                       ,
                               p_wlt_txn_type           => null                       ,
                               p_update_serial_attr     => 1                          ,
                               p_update_desc_attr       => 1                          ,
                               x_return_status          => x_return_status            ,
                               x_error_count            => x_error_count              ,
                               x_error_msg              => x_error_msg
                             );
Line: 1585

                        l_msg_tokens.delete;
Line: 1615

                                l_msg_tokens.delete;
Line: 1658

                                l_msg_tokens.delete;
Line: 1680

                        l_msg_tokens.delete;
Line: 1718

                        l_msg_tokens.delete;
Line: 1720

                                                p_msg_text          => 'Invoking update_serial',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 1729

               update_serial( p_serial_number                   => p_serial_number,
                              p_inventory_item_id               => p_inventory_item_id,
                              --p_new_inventory_item_id         => p_inventory_item_id,
                              p_organization_id                 => p_organization_id,
                              p_wip_entity_id                   => p_wip_entity_id,
                              p_operation_seq_num               => p_operation_seq_num,
                              p_intraoperation_step_type        => p_intraoperation_step,
                              x_return_status                   => x_return_status,
                              x_error_msg                       => x_error_msg,
                              x_error_count                     => x_error_count
                            );
Line: 1837

                        select  wip_entity_id,
                                group_mark_id,
                                line_mark_id,
                                current_status,
                                last_txn_source_id,
                                last_txn_source_type_id,
                                gen_object_id
                        into    l_wip_entity_id,
                                l_group_mark_id,
                                l_line_mark_id,
                                l_current_status,
                                l_last_txn_srcid,
                                l_last_txn_src_typid,
                                l_gen_object_id
                        from mtl_serial_numbers
                        where inventory_item_id = p_assembly_item_id
                        and current_organization_id = p_organization_id
                        and serial_number = p_serial_number;
Line: 1877

                                     select count(1)
                                     into l_exists
                                     from mtl_object_genealogy mog,
                                          mtl_serial_numbers   msn
                                     where mog.object_id = l_gen_object_id
                                     and   mog.parent_object_type = 2
                                     and   mog.parent_object_id = msn.gen_object_id
                                     and   msn.inventory_item_id = p_assembly_item_id
                                     and   msn.current_organization_id = p_organization_id
                                     and   msn.wip_entity_id = p_wip_entity_id;
Line: 1892

                                                        l_msg_tokens.delete;
Line: 1909

                                        l_msg_tokens.delete;
Line: 1938

                l_msg_tokens.delete;
Line: 2014

PROCEDURE update_serial_attr ( p_calling_mode           IN         NUMBER,
                               p_serial_number_rec      IN         WSM_Serial_Support_GRP.WSM_SERIAL_NUM_REC,
                               p_inventory_item_id      IN         NUMBER,
                               p_organization_id        IN         NUMBER,
                               p_clear_serial_attr      IN         NUMBER   DEFAULT NULL,  -- will be used in case of WLT to clear the attributes
                               p_wlt_txn_type           IN         NUMBER   DEFAULT NULL,
                               -- Pass the serial attribute context corresponding to the inventory item id
                               p_serial_attr_context    IN         VARCHAR2 DEFAULT NULL,
                               p_update_serial_attr     IN         NUMBER,
                               p_update_desc_attr       IN         NUMBER,
                               x_return_status          OUT NOCOPY VARCHAR2,
                               x_error_count            OUT NOCOPY NUMBER,
                               x_error_msg              OUT NOCOPY VARCHAR2
                             )

IS
l_serial_attributes_tbl         inv_lot_sel_attr.lot_sel_attributes_tbl_type;
Line: 2036

l_update_serial_attr            NUMBER;
Line: 2037

l_update_desc_attr              NUMBER;
Line: 2047

l_module            VARCHAR2(100) := 'wsm.plsql.WSM_SERIAL_SUPPORT_PVT.update_serial_attr';
Line: 2060

                l_param_tbl.delete;
Line: 2077

        l_update_serial_attr := p_update_serial_attr;
Line: 2081

        if l_update_serial_attr is null then -- the calling program hasnt passed on the value..

                -- derive if a context exists...
                -- need an additional check on if WMS is installed or not...
                l_stmt_num := 30;
Line: 2098

                        l_update_serial_attr := g_wms_installed;
Line: 2100

                        l_update_serial_attr := g_wms_installed;
Line: 2107

                l_msg_tokens.delete;
Line: 2109

                                        p_msg_text          => 'Value of l_update_serial_attr ' || l_update_serial_attr,
                                        p_stmt_num          => l_stmt_num               ,
                                        p_msg_tokens        => l_msg_tokens             ,
                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                        p_run_log_level     => l_log_level
                                        );
Line: 2139

                        l_msg_tokens.delete;
Line: 2156

        if l_update_serial_attr = 1 THEN

                l_stmt_num := 50;
Line: 2311

                l_msg_tokens.delete;
Line: 2313

                                        p_msg_text          => 'Value of p_update_desc_attr ' || p_update_desc_attr,
                                        p_stmt_num          => l_stmt_num               ,
                                        p_msg_tokens        => l_msg_tokens             ,
                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                        p_run_log_level     => l_log_level
                                        );
Line: 2321

        IF nvl(p_update_desc_attr,1) = 1 THEN

                l_stmt_num := 75;
Line: 2373

                l_msg_tokens.delete;
Line: 2375

                                        p_msg_text          => 'Invoking the procedure update_serial_attr(2)',
                                        p_stmt_num          => l_stmt_num               ,
                                        p_msg_tokens        => l_msg_tokens             ,
                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                        p_run_log_level     => l_log_level
                                        );
Line: 2383

        update_serial_attr( p_job_serial_number       =>  p_serial_number_rec.serial_number  ,
                            p_inventory_item_id       =>  p_inventory_item_id                ,
                            p_organization_id         =>  p_organization_id                  ,
                            p_serial_desc_attr_tbl    =>  l_desc_attributes_tbl              ,
                            p_attribute_category      =>  l_attribute_category               ,
                            p_update_serial_attr      =>  p_update_serial_attr               ,
                            p_update_desc_attr        =>  1                                  ,
                            p_serial_attributes_tbl   =>  l_serial_attributes_tbl            ,
                            x_return_status           =>  x_return_status                    ,
                            x_error_count             =>  x_error_count                      ,
                            x_error_msg               =>  x_error_msg
                          );
Line: 2440

END update_serial_attr;
Line: 2443

PROCEDURE update_serial_attr( p_job_serial_number     IN   VARCHAR2,
                              p_inventory_item_id     IN   NUMBER,
                              p_organization_id       IN   NUMBER,
                              p_serial_desc_attr_tbl  IN   inv_serial_number_attr.char_table,
                              p_attribute_category    IN   VARCHAR2,
                              p_update_serial_attr    IN   NUMBER DEFAULT NULL,
                              p_update_desc_attr      IN   NUMBER,
                              p_serial_attributes_tbl IN   inv_lot_sel_attr.lot_sel_attributes_tbl_type,
                              x_return_status         OUT  NOCOPY VARCHAR2,
                              x_error_count           OUT  NOCOPY NUMBER,
                              x_error_msg             OUT  NOCOPY VARCHAR2
                            ) IS

l_validation_status  varchar2(10);
Line: 2457

l_update_serial_attr NUMBER;
Line: 2458

l_update_desc_attr   NUMBER;
Line: 2467

l_module            VARCHAR2(100) := 'wsm.plsql.WSM_SERIAL_SUPPORT_PVT.update_serial_attr(2)';
Line: 2480

                l_param_tbl.delete;
Line: 2481

                l_param_tbl(1).paramName := 'p_update_serial_attr';
Line: 2482

                l_param_tbl(1).paramValue := p_update_serial_attr;
Line: 2484

                l_param_tbl(2).paramName := 'p_update_desc_attr';
Line: 2485

                l_param_tbl(2).paramValue := p_update_desc_attr;
Line: 2493

        l_update_serial_attr := p_update_serial_attr;
Line: 2494

        l_update_desc_attr   := nvl(p_update_desc_attr,1);
Line: 2498

        if l_update_serial_attr is null then -- the calling program hasnt passed on the value..

                l_stmt_num  := 30;
Line: 2514

                        l_update_serial_attr := g_wms_installed;
Line: 2516

                        l_update_serial_attr := g_wms_installed;
Line: 2522

                l_msg_tokens.delete;
Line: 2524

                                        p_msg_text          => 'Value of l_update_serial_attr : ' || l_update_serial_attr,
                                        p_stmt_num          => l_stmt_num               ,
                                        p_msg_tokens        => l_msg_tokens             ,
                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                        p_run_log_level     => l_log_level
                                        );
Line: 2532

        if  (l_update_serial_attr = 1)
        then
                l_stmt_num  := 50;
Line: 2537

                        l_msg_tokens.delete;
Line: 2539

                                                p_msg_text          => 'Invoking INV_SERIAL_NUMBER_PUB.validate_update_serial_att',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 2547

                INV_SERIAL_NUMBER_PUB.validate_update_serial_att (x_return_status         =>  x_return_status,
                                                                  x_msg_count             =>  x_error_count    ,
                                                                  x_msg_data              =>  x_error_msg     ,
                                                                  x_validation_status     =>  l_validation_status,
                                                                  p_serial_number         =>  p_job_serial_number,
                                                                  p_organization_id       =>  p_organization_id,
                                                                  p_inventory_item_id     =>  p_inventory_item_id,
                                                                  p_serial_att_tbl        =>  p_serial_attributes_tbl,
                                                                  p_validate_only         =>  false
                                                                 );
Line: 2569

        IF l_update_desc_attr = 1 then

                l_stmt_num  := 70;
Line: 2574

                        l_msg_tokens.delete;
Line: 2576

                                                p_msg_text          => 'Invoking INV_SERIAL_NUMBER_ATTR.Update_Serial_number_attr',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 2585

                INV_SERIAL_NUMBER_ATTR.Update_Serial_number_attr(       x_return_status             => x_return_status,
                                                                        x_msg_count                 => x_error_count,
                                                                        x_msg_data                  => x_error_msg,
                                                                        p_serial_number             => p_job_serial_number,
                                                                        p_inventory_item_id         => p_inventory_item_id,
                                                                        p_attribute_category        => p_attribute_category,
                                                                        p_attributes_tbl            => p_serial_desc_attr_tbl
                                                                );
Line: 2642

END update_serial_attr;
Line: 2704

procedure update_serial( p_serial_number                IN              VARCHAR2,
                         p_inventory_item_id            IN              NUMBER,
                         --p_new_inventory_item_id      IN              NUMBER,
                         p_organization_id              IN              NUMBER,
                         p_wip_entity_id                IN              NUMBER,
                         p_operation_seq_num            IN              NUMBER,
                         p_intraoperation_step_type     IN              NUMBER,
                         x_return_status                OUT NOCOPY      VARCHAR2,
                         x_error_msg                    OUT NOCOPY      VARCHAR2,
                         x_error_count                  OUT NOCOPY      NUMBER
                        ) is
   l_object_id                  NUMBER;
Line: 2746

l_module            VARCHAR2(100) := 'wsm.plsql.WSM_SERIAL_SUPPORT_PVT.update_serial';
Line: 2759

                l_param_tbl.delete;
Line: 2778

        SAVEPOINT update_serial;
Line: 2780

        SELECT current_status,
          initialization_date,
          completion_date,
          ship_date,
          revision,
          lot_number,
          group_mark_id,
          lot_line_mark_id,
          current_organization_id,
          current_locator_id,
          current_subinventory_code,
          original_wip_entity_id,
          original_unit_vendor_id,
          vendor_lot_number,
          vendor_serial_number,
          last_receipt_issue_type,
          last_txn_source_id,
          last_txn_source_type_id,
          last_txn_source_name,
          parent_item_id,
          parent_serial_number
        INTO l_current_status,
          l_initialization_date,
          l_completion_date,
          l_ship_date,
          l_revision,
          l_lot_number,
          l_group_mark_id,
          l_lot_line_mark_id,
          l_current_organization_id,
          l_current_locator_id,
          l_current_subinventory_code,
          l_original_wip_entity_id,
          l_original_unit_vendor_id,
          l_vendor_lot_number,
          l_vendor_serial_number,
          l_last_receipt_issue_type,
          l_last_txn_source_id,
          l_last_txn_source_type_id,
          l_last_txn_source_name,
          l_parent_item_id,
          l_parent_serial_number
        FROM mtl_serial_numbers
        WHERE serial_number = p_serial_number
        AND inventory_item_id = p_inventory_item_id
        AND current_organization_id = p_organization_id
        FOR UPDATE NOWAIT;
Line: 2839

                l_msg_tokens.delete;
Line: 2841

                                        p_msg_text          => 'Invoking INV_SERIAL_NUMBER_PUB.updateserial',
                                        p_stmt_num          => l_stmt_num               ,
                                        p_msg_tokens        => l_msg_tokens             ,
                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                        p_run_log_level     => l_log_level
                                        );
Line: 2849

        inv_serial_number_pub.updateserial (  p_api_version              => 1.0,
                                              p_inventory_item_id        => p_inventory_item_id,
                                              p_organization_id          => p_organization_id,
                                              p_serial_number            => p_serial_number,
                                              p_initialization_date      => l_initialization_date,
                                              p_completion_date          => l_completion_date,
                                              p_ship_date                => l_ship_date,
                                              p_revision                 => l_revision,
                                              p_lot_number               => l_lot_number,
                                              p_current_locator_id       => l_current_locator_id,
                                              p_subinventory_code        => l_current_subinventory_code,
                                              p_trx_src_id               => l_original_wip_entity_id,
                                              p_unit_vendor_id           => l_original_unit_vendor_id,
                                              p_vendor_lot_number        => l_vendor_lot_number,
                                              p_vendor_serial_number     => l_vendor_serial_number,
                                              p_receipt_issue_type       => l_last_receipt_issue_type,
                                              p_txn_src_id               => l_last_txn_source_id,
                                              p_txn_src_name             => l_last_txn_source_name,
                                              p_txn_src_type_id          => l_last_txn_source_type_id,
                                              p_current_status           => l_current_status,
                                              p_parent_item_id           => l_parent_item_id,
                                              p_parent_serial_number     => l_parent_serial_number,
                                              p_serial_temp_id           => null,
                                              p_last_status              => l_last_status,
                                              p_status_id                => null,
                                              x_object_id                => l_object_id,
                                              x_return_status            => x_return_status,
                                              x_msg_count                => x_error_count,
                                              x_msg_data                 => x_error_msg,
                                              p_wip_entity_id            => p_wip_entity_id,
                                              p_operation_seq_num        => p_operation_seq_num,
                                              p_intraoperation_step_type => p_intraoperation_step_type,
                                              p_line_mark_id             => l_lot_line_mark_id
                                           );
Line: 2895

                rollback to update_serial;
Line: 2903

                rollback to update_serial;
Line: 2910

                 rollback to update_serial;
Line: 2927

end update_serial;
Line: 2973

        select
        wsti.Serial_Number                     ,
        msn.gen_object_id                      ,
        -- (Gen_object_id --> assembly_item_id No longer used Instead the column will have gen_object_id)
        wsti.header_id                         ,  -- header_id
        wsti.Generate_serial_number            ,
        wsti.Generate_for_qty                  ,
        wsti.Action_flag                       ,
        wsti.Current_wip_entity_name           ,
        wsti.Changed_wip_entity_name           ,
        wsti.Current_wip_entity_id             ,
        wsti.Changed_wip_entity_id             ,
        decode(wsti.serial_attribute_category  , l_null_char, null, null, msn.serial_attribute_category, wsti.serial_attribute_category), -- serial_attribute_category
        decode(wsti.territory_code             , l_null_char, null, null, msn.territory_code           , wsti.territory_code           ), -- territory_code
        decode(wsti.origination_date           , l_null_date, null, null, msn.origination_date         , wsti.origination_date         ), -- origination_date
        decode(wsti.c_attribute1               , l_null_char, null, null, msn.c_attribute1             , wsti.c_attribute1             ), -- c_attribute1
        decode(wsti.c_attribute2               , l_null_char, null, null, msn.c_attribute2             , wsti.c_attribute2             ), -- c_attribute2
        decode(wsti.c_attribute3               , l_null_char, null, null, msn.c_attribute3             , wsti.c_attribute3             ), -- c_attribute3
        decode(wsti.c_attribute4               , l_null_char, null, null, msn.c_attribute4             , wsti.c_attribute4             ), -- c_attribute4
        decode(wsti.c_attribute5               , l_null_char, null, null, msn.c_attribute5             , wsti.c_attribute5             ), -- c_attribute5
        decode(wsti.c_attribute6               , l_null_char, null, null, msn.c_attribute6             , wsti.c_attribute6             ), -- c_attribute6
        decode(wsti.c_attribute7               , l_null_char, null, null, msn.c_attribute7             , wsti.c_attribute7             ), -- c_attribute7
        decode(wsti.c_attribute8               , l_null_char, null, null, msn.c_attribute8             , wsti.c_attribute8             ), -- c_attribute8
        decode(wsti.c_attribute9               , l_null_char, null, null, msn.c_attribute9             , wsti.c_attribute9             ), -- c_attribute9
        decode(wsti.c_attribute10              , l_null_char, null, null, msn.c_attribute10            , wsti.c_attribute10            ), -- c_attribute10
        decode(wsti.c_attribute11              , l_null_char, null, null, msn.c_attribute11            , wsti.c_attribute11            ), -- c_attribute11
        decode(wsti.c_attribute12              , l_null_char, null, null, msn.c_attribute12            , wsti.c_attribute12            ), -- c_attribute12
        decode(wsti.c_attribute13              , l_null_char, null, null, msn.c_attribute13            , wsti.c_attribute13            ), -- c_attribute13
        decode(wsti.c_attribute14              , l_null_char, null, null, msn.c_attribute14            , wsti.c_attribute14            ), -- c_attribute14
        decode(wsti.c_attribute15              , l_null_char, null, null, msn.c_attribute15            , wsti.c_attribute15            ), -- c_attribute15
        decode(wsti.c_attribute16              , l_null_char, null, null, msn.c_attribute16            , wsti.c_attribute16            ), -- c_attribute16
        decode(wsti.c_attribute17              , l_null_char, null, null, msn.c_attribute17            , wsti.c_attribute17            ), -- c_attribute17
        decode(wsti.c_attribute18              , l_null_char, null, null, msn.c_attribute18            , wsti.c_attribute18            ), -- c_attribute18
        decode(wsti.c_attribute19              , l_null_char, null, null, msn.c_attribute19            , wsti.c_attribute19            ), -- c_attribute19
        decode(wsti.c_attribute20              , l_null_char, null, null, msn.c_attribute20            , wsti.c_attribute20            ), -- c_attribute20
        decode(wsti.d_attribute1               , l_null_date, null, null, msn.d_attribute1             , wsti.d_attribute1             ), -- d_attribute1
        decode(wsti.d_attribute2               , l_null_date, null, null, msn.d_attribute2             , wsti.d_attribute2             ), -- d_attribute2
        decode(wsti.d_attribute3               , l_null_date, null, null, msn.d_attribute3             , wsti.d_attribute3             ), -- d_attribute3
        decode(wsti.d_attribute4               , l_null_date, null, null, msn.d_attribute4             , wsti.d_attribute4             ), -- d_attribute4
        decode(wsti.d_attribute5               , l_null_date, null, null, msn.d_attribute5             , wsti.d_attribute5             ), -- d_attribute5
        decode(wsti.d_attribute6               , l_null_date, null, null, msn.d_attribute6             , wsti.d_attribute6             ), -- d_attribute6
        decode(wsti.d_attribute7               , l_null_date, null, null, msn.d_attribute7             , wsti.d_attribute7             ), -- d_attribute7
        decode(wsti.d_attribute8               , l_null_date, null, null, msn.d_attribute8             , wsti.d_attribute8             ), -- d_attribute8
        decode(wsti.d_attribute9               , l_null_date, null, null, msn.d_attribute9             , wsti.d_attribute9             ), -- d_attribute9
        decode(wsti.d_attribute10              , l_null_date, null, null, msn.d_attribute10            , wsti.d_attribute10            ), -- d_attribute10
        decode(wsti.n_attribute1               , l_null_num , null, null, msn.n_attribute1             , wsti.n_attribute1             ), -- n_attribute1
        decode(wsti.n_attribute2               , l_null_num , null, null, msn.n_attribute2             , wsti.n_attribute2             ), -- n_attribute2
        decode(wsti.n_attribute3               , l_null_num , null, null, msn.n_attribute3             , wsti.n_attribute3             ), -- n_attribute3
        decode(wsti.n_attribute4               , l_null_num , null, null, msn.n_attribute4             , wsti.n_attribute4             ), -- n_attribute4
        decode(wsti.n_attribute5               , l_null_num , null, null, msn.n_attribute5             , wsti.n_attribute5             ), -- n_attribute5
        decode(wsti.n_attribute6               , l_null_num , null, null, msn.n_attribute6             , wsti.n_attribute6             ), -- n_attribute6
        decode(wsti.n_attribute7               , l_null_num , null, null, msn.n_attribute7             , wsti.n_attribute7             ), -- n_attribute7
        decode(wsti.n_attribute8               , l_null_num , null, null, msn.n_attribute8             , wsti.n_attribute8             ), -- n_attribute8
        decode(wsti.n_attribute9               , l_null_num , null, null, msn.n_attribute9             , wsti.n_attribute9             ), -- n_attribute9
        decode(wsti.n_attribute10              , l_null_num , null, null, msn.n_attribute10            , wsti.n_attribute10            ), -- n_attribute10
        decode(wsti.status_id                  , l_null_num , null, null, msn.status_id                , wsti.status_id                ), -- status_id
        decode(wsti.time_since_new             , l_null_num , null, null, msn.time_since_new           , wsti.time_since_new           ), -- time_since_new
        decode(wsti.cycles_since_new           , l_null_num , null, null, msn.cycles_since_new         , wsti.cycles_since_new         ), -- cycles_since_new
        decode(wsti.time_since_overhaul        , l_null_num , null, null, msn.time_since_overhaul      , wsti.time_since_overhaul      ), -- time_since_overhaul
        decode(wsti.cycles_since_overhaul      , l_null_num , null, null, msn.cycles_since_overhaul    , wsti.cycles_since_overhaul    ), -- cycles_since_overhaul
        decode(wsti.time_since_repair          , l_null_num , null, null, msn.time_since_repair        , wsti.time_since_repair        ), -- time_since_repair
        decode(wsti.cycles_since_repair        , l_null_num , null, null, msn.cycles_since_repair      , wsti.cycles_since_repair      ), -- cycles_since_repair
        decode(wsti.time_since_visit           , l_null_num , null, null, msn.time_since_visit         , wsti.time_since_visit         ), -- time_since_visit
        decode(wsti.cycles_since_visit         , l_null_num , null, null, msn.cycles_since_visit       , wsti.cycles_since_visit       ), -- cycles_since_visit
        decode(wsti.time_since_mark            , l_null_num , null, null, msn.time_since_mark          , wsti.time_since_mark          ), -- time_since_mark
        decode(wsti.cycles_since_mark          , l_null_num , null, null, msn.cycles_since_mark        , wsti.cycles_since_mark        ), -- cycles_since_mark
        decode(wsti.number_of_repairs          , l_null_num , null, null, msn.number_of_repairs        , wsti.number_of_repairs        ), -- number_of_repairs
        decode(wsti.attribute_category         , l_null_char, l_miss_char , null ,msn.attribute_category   ,wsti.attribute_category    ),
        decode(wsti.attribute1                 , l_null_char ,l_miss_char , wsti.attribute1            ),
        decode(wsti.attribute2                 , l_null_char ,l_miss_char , wsti.attribute2            ),
        decode(wsti.attribute3                 , l_null_char ,l_miss_char , wsti.attribute3            ),
        decode(wsti.attribute4                 , l_null_char ,l_miss_char , wsti.attribute4            ),
        decode(wsti.attribute5                 , l_null_char ,l_miss_char , wsti.attribute5            ),
        decode(wsti.attribute6                 , l_null_char ,l_miss_char , wsti.attribute6            ),
        decode(wsti.attribute7                 , l_null_char ,l_miss_char , wsti.attribute7            ),
        decode(wsti.attribute8                 , l_null_char ,l_miss_char , wsti.attribute8            ),
        decode(wsti.attribute9                 , l_null_char ,l_miss_char , wsti.attribute9            ),
        decode(wsti.attribute10                , l_null_char ,l_miss_char , wsti.attribute10           ),
        decode(wsti.attribute11                , l_null_char ,l_miss_char , wsti.attribute11           ),
        decode(wsti.attribute12                , l_null_char ,l_miss_char , wsti.attribute12           ),
        decode(wsti.attribute13                , l_null_char ,l_miss_char , wsti.attribute13           ),
        decode(wsti.attribute14                , l_null_char ,l_miss_char , wsti.attribute14           ),
        decode(wsti.attribute15                , l_null_char ,l_miss_char , wsti.attribute15           )
        from wsm_serial_txn_interface wsti,
             mtl_serial_numbers       msn
        where wsti.header_id = p_header_id
        and   wsti.transaction_type_id = 2
        and  (wsti.action_flag >= 5 AND wsti.action_flag <= 6) -- select the move/scrap
        and   wsti.serial_number = msn.serial_number (+)
        and   msn.inventory_item_id (+) = p_inventory_item_id
        and   msn.current_organization_id (+) = p_organization_id;
Line: 3067

        select
        wsti.Serial_Number                     ,
        msn.gen_object_id                      ,
        -- (Gen_object_id --> assembly_item_id No longer used Instead the column will have gen_object_id)
        wsti.header_id                         ,  -- header_id
        wsti.Generate_serial_number            ,
        wsti.Generate_for_qty                  ,
        wsti.Action_flag                       ,
        wsti.Current_wip_entity_name           ,
        wsti.Changed_wip_entity_name           ,
        wsti.Current_wip_entity_id             ,
        wsti.Changed_wip_entity_id             ,
        decode(wsti.serial_attribute_category  , l_null_char, null, null, msn.serial_attribute_category, wsti.serial_attribute_category), -- serial_attribute_category
        decode(wsti.territory_code             , l_null_char, null, null, msn.territory_code           , wsti.territory_code           ), -- territory_code
        decode(wsti.origination_date           , l_null_date, null, null, msn.origination_date         , wsti.origination_date         ), -- origination_date
        decode(wsti.c_attribute1               , l_null_char, null, null, msn.c_attribute1             , wsti.c_attribute1             ), -- c_attribute1
        decode(wsti.c_attribute2               , l_null_char, null, null, msn.c_attribute2             , wsti.c_attribute2             ), -- c_attribute2
        decode(wsti.c_attribute3               , l_null_char, null, null, msn.c_attribute3             , wsti.c_attribute3             ), -- c_attribute3
        decode(wsti.c_attribute4               , l_null_char, null, null, msn.c_attribute4             , wsti.c_attribute4             ), -- c_attribute4
        decode(wsti.c_attribute5               , l_null_char, null, null, msn.c_attribute5             , wsti.c_attribute5             ), -- c_attribute5
        decode(wsti.c_attribute6               , l_null_char, null, null, msn.c_attribute6             , wsti.c_attribute6             ), -- c_attribute6
        decode(wsti.c_attribute7               , l_null_char, null, null, msn.c_attribute7             , wsti.c_attribute7             ), -- c_attribute7
        decode(wsti.c_attribute8               , l_null_char, null, null, msn.c_attribute8             , wsti.c_attribute8             ), -- c_attribute8
        decode(wsti.c_attribute9               , l_null_char, null, null, msn.c_attribute9             , wsti.c_attribute9             ), -- c_attribute9
        decode(wsti.c_attribute10              , l_null_char, null, null, msn.c_attribute10            , wsti.c_attribute10            ), -- c_attribute10
        decode(wsti.c_attribute11              , l_null_char, null, null, msn.c_attribute11            , wsti.c_attribute11            ), -- c_attribute11
        decode(wsti.c_attribute12              , l_null_char, null, null, msn.c_attribute12            , wsti.c_attribute12            ), -- c_attribute12
        decode(wsti.c_attribute13              , l_null_char, null, null, msn.c_attribute13            , wsti.c_attribute13            ), -- c_attribute13
        decode(wsti.c_attribute14              , l_null_char, null, null, msn.c_attribute14            , wsti.c_attribute14            ), -- c_attribute14
        decode(wsti.c_attribute15              , l_null_char, null, null, msn.c_attribute15            , wsti.c_attribute15            ), -- c_attribute15
        decode(wsti.c_attribute16              , l_null_char, null, null, msn.c_attribute16            , wsti.c_attribute16            ), -- c_attribute16
        decode(wsti.c_attribute17              , l_null_char, null, null, msn.c_attribute17            , wsti.c_attribute17            ), -- c_attribute17
        decode(wsti.c_attribute18              , l_null_char, null, null, msn.c_attribute18            , wsti.c_attribute18            ), -- c_attribute18
        decode(wsti.c_attribute19              , l_null_char, null, null, msn.c_attribute19            , wsti.c_attribute19            ), -- c_attribute19
        decode(wsti.c_attribute20              , l_null_char, null, null, msn.c_attribute20            , wsti.c_attribute20            ), -- c_attribute20
        decode(wsti.d_attribute1               , l_null_date, null, null, msn.d_attribute1             , wsti.d_attribute1             ), -- d_attribute1
        decode(wsti.d_attribute2               , l_null_date, null, null, msn.d_attribute2             , wsti.d_attribute2             ), -- d_attribute2
        decode(wsti.d_attribute3               , l_null_date, null, null, msn.d_attribute3             , wsti.d_attribute3             ), -- d_attribute3
        decode(wsti.d_attribute4               , l_null_date, null, null, msn.d_attribute4             , wsti.d_attribute4             ), -- d_attribute4
        decode(wsti.d_attribute5               , l_null_date, null, null, msn.d_attribute5             , wsti.d_attribute5             ), -- d_attribute5
        decode(wsti.d_attribute6               , l_null_date, null, null, msn.d_attribute6             , wsti.d_attribute6             ), -- d_attribute6
        decode(wsti.d_attribute7               , l_null_date, null, null, msn.d_attribute7             , wsti.d_attribute7             ), -- d_attribute7
        decode(wsti.d_attribute8               , l_null_date, null, null, msn.d_attribute8             , wsti.d_attribute8             ), -- d_attribute8
        decode(wsti.d_attribute9               , l_null_date, null, null, msn.d_attribute9             , wsti.d_attribute9             ), -- d_attribute9
        decode(wsti.d_attribute10              , l_null_date, null, null, msn.d_attribute10            , wsti.d_attribute10            ), -- d_attribute10
        decode(wsti.n_attribute1               , l_null_num , null, null, msn.n_attribute1             , wsti.n_attribute1             ), -- n_attribute1
        decode(wsti.n_attribute2               , l_null_num , null, null, msn.n_attribute2             , wsti.n_attribute2             ), -- n_attribute2
        decode(wsti.n_attribute3               , l_null_num , null, null, msn.n_attribute3             , wsti.n_attribute3             ), -- n_attribute3
        decode(wsti.n_attribute4               , l_null_num , null, null, msn.n_attribute4             , wsti.n_attribute4             ), -- n_attribute4
        decode(wsti.n_attribute5               , l_null_num , null, null, msn.n_attribute5             , wsti.n_attribute5             ), -- n_attribute5
        decode(wsti.n_attribute6               , l_null_num , null, null, msn.n_attribute6             , wsti.n_attribute6             ), -- n_attribute6
        decode(wsti.n_attribute7               , l_null_num , null, null, msn.n_attribute7             , wsti.n_attribute7             ), -- n_attribute7
        decode(wsti.n_attribute8               , l_null_num , null, null, msn.n_attribute8             , wsti.n_attribute8             ), -- n_attribute8
        decode(wsti.n_attribute9               , l_null_num , null, null, msn.n_attribute9             , wsti.n_attribute9             ), -- n_attribute9
        decode(wsti.n_attribute10              , l_null_num , null, null, msn.n_attribute10            , wsti.n_attribute10            ), -- n_attribute10
        decode(wsti.status_id                  , l_null_num , null, null, msn.status_id                , wsti.status_id                ), -- status_id
        decode(wsti.time_since_new             , l_null_num , null, null, msn.time_since_new           , wsti.time_since_new           ), -- time_since_new
        decode(wsti.cycles_since_new           , l_null_num , null, null, msn.cycles_since_new         , wsti.cycles_since_new         ), -- cycles_since_new
        decode(wsti.time_since_overhaul        , l_null_num , null, null, msn.time_since_overhaul      , wsti.time_since_overhaul      ), -- time_since_overhaul
        decode(wsti.cycles_since_overhaul      , l_null_num , null, null, msn.cycles_since_overhaul    , wsti.cycles_since_overhaul    ), -- cycles_since_overhaul
        decode(wsti.time_since_repair          , l_null_num , null, null, msn.time_since_repair        , wsti.time_since_repair        ), -- time_since_repair
        decode(wsti.cycles_since_repair        , l_null_num , null, null, msn.cycles_since_repair      , wsti.cycles_since_repair      ), -- cycles_since_repair
        decode(wsti.time_since_visit           , l_null_num , null, null, msn.time_since_visit         , wsti.time_since_visit         ), -- time_since_visit
        decode(wsti.cycles_since_visit         , l_null_num , null, null, msn.cycles_since_visit       , wsti.cycles_since_visit       ), -- cycles_since_visit
        decode(wsti.time_since_mark            , l_null_num , null, null, msn.time_since_mark          , wsti.time_since_mark          ), -- time_since_mark
        decode(wsti.cycles_since_mark          , l_null_num , null, null, msn.cycles_since_mark        , wsti.cycles_since_mark        ), -- cycles_since_mark
        decode(wsti.number_of_repairs          , l_null_num , null, null, msn.number_of_repairs        , wsti.number_of_repairs        ), -- number_of_repairs
        decode(wsti.attribute_category         , l_null_char, l_miss_char , null ,msn.attribute_category   ,wsti.attribute_category    ),
        decode(wsti.attribute1                 , l_null_char ,l_miss_char , wsti.attribute1            ),
        decode(wsti.attribute2                 , l_null_char ,l_miss_char , wsti.attribute2            ),
        decode(wsti.attribute3                 , l_null_char ,l_miss_char , wsti.attribute3            ),
        decode(wsti.attribute4                 , l_null_char ,l_miss_char , wsti.attribute4            ),
        decode(wsti.attribute5                 , l_null_char ,l_miss_char , wsti.attribute5            ),
        decode(wsti.attribute6                 , l_null_char ,l_miss_char , wsti.attribute6            ),
        decode(wsti.attribute7                 , l_null_char ,l_miss_char , wsti.attribute7            ),
        decode(wsti.attribute8                 , l_null_char ,l_miss_char , wsti.attribute8            ),
        decode(wsti.attribute9                 , l_null_char ,l_miss_char , wsti.attribute9            ),
        decode(wsti.attribute10                , l_null_char ,l_miss_char , wsti.attribute10           ),
        decode(wsti.attribute11                , l_null_char ,l_miss_char , wsti.attribute11           ),
        decode(wsti.attribute12                , l_null_char ,l_miss_char , wsti.attribute12           ),
        decode(wsti.attribute13                , l_null_char ,l_miss_char , wsti.attribute13           ),
        decode(wsti.attribute14                , l_null_char ,l_miss_char , wsti.attribute14           ),
        decode(wsti.attribute15                , l_null_char ,l_miss_char , wsti.attribute15           )
        from wsm_serial_txn_interface wsti,
             mtl_serial_numbers       msn
        where wsti.header_id = p_header_id
        and   wsti.transaction_type_id = 2
        and  (nvl(wsti.action_flag,wsti.generate_serial_number) >= 1 AND nvl(wsti.action_flag,wsti.generate_serial_number) <= 3) -- select the move/scrap
        and  wsti.serial_number = msn.serial_number (+)
        and  msn.inventory_item_id (+) = p_inventory_item_id
        and  msn.current_organization_id (+) = p_organization_id
        order by nvl(wsti.action_flag,0) desc; -- Code review remark
Line: 3163

l_row_updated           NUMBER;
Line: 3183

                l_param_tbl.delete;
Line: 3234

                l_row_updated := 0;
Line: 3236

                        update wsm_serial_txn_interface
                        set process_status = wip_constants.error
                        where header_id = p_header_id
                        and transaction_type_id = 2;
Line: 3241

                        l_row_updated := SQL%ROWCOUNT;
Line: 3244

                if l_row_updated > 0 OR p_wsm_serial_nums_tbl.count > 0 then
                        -- return error as interface rows were updated...
                        IF g_log_level_error >= l_log_level OR
                           FND_MSG_PUB.check_msg_level(G_MSG_LVL_ERROR)
                        THEN

                                l_msg_tokens.delete;
Line: 3279

                                l_msg_tokens.delete;
Line: 3313

        l_wsm_serial_nums_tbl.delete;
Line: 3318

                l_row_updated := 0;
Line: 3320

                        update wsm_serial_txn_interface wsti
                        set wsti.process_status = wip_constants.error
                        where wsti.header_id = p_header_id
                        and wsti.transaction_type_id = 2
                        and wsti.action_flag in (5,6);
Line: 3326

                        l_row_updated := SQL%ROWCOUNT;
Line: 3329

                if l_row_updated > 0 or p_wsm_serial_nums_tbl.count > 0 then
                        -- error.. message....
                        l_stmt_num := 80;
Line: 3336

                                l_msg_tokens.delete;
Line: 3353

                        update wsm_serial_txn_interface wsti
                        set wsti.process_status = wip_constants.error
                        where wsti.header_id = p_header_id
                        and wsti.transaction_type_id = 2
                        and wsti.action_flag in (5,6)
                        and not exists( SELECT MSN.serial_number
                                        FROM  MTL_SERIAL_NUMBERS MSN
                                        WHERE MSN.SERIAL_NUMBER                      = wsti.serial_number
                                        AND   MSN.wip_entity_id                      = p_wip_entity_id
                                        AND   MSN.current_organization_id            = p_organization_id
                                        AND   MSN.inventory_item_id                  = p_inventory_item_id
                                        -- AND   MSN.current_status                  = WIP_CONSTANTS.IN_STORES
                                        -- AND   MSN.operation_seq_num                  = p_curr_job_op_seq_num
                                        --AND   MSN.intraoperation_step_type         = p_curr_job_intraop_step
                                        AND    nvl(MSN.intraoperation_step_type,-1)  <> WIP_CONSTANTS.SCRAP
                                       );
Line: 3377

                                        l_msg_tokens.delete;
Line: 3404

                l_msg_tokens.delete;
Line: 3452

                l_msg_tokens.delete;
Line: 3553

                l_param_tbl.delete;
Line: 3600

                        l_msg_tokens.delete;
Line: 3651

                        l_msg_tokens.delete;
Line: 3667

                        UPDATE WSM_LOT_BASED_JOBS
                        SET first_serial_txn_id = p_move_txn_id
                        WHERE wip_entity_id = p_wip_entity_id;
Line: 3672

                        UPDATE WIP_DISCRETE_JOBS
                        SET serialization_start_op = 10
                        WHERE wip_entity_id = p_wip_entity_id;
Line: 3677

                                l_msg_tokens.delete;
Line: 3679

                                                        p_msg_text          => 'Updated WIP_DISCRETE_JOBS to set the serialization_start_op',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 3696

                                l_msg_tokens.delete;
Line: 3734

                        UPDATE WSM_LOT_BASED_JOBS
                        set    first_serial_txn_id = null
                        WHERE  wip_entity_id = p_wip_entity_id
                        AND    first_serial_txn_id = p_old_move_txn_id;
Line: 3740

                                l_msg_tokens.delete;
Line: 3742

                                                        p_msg_text          => 'Updated ' || SQL%ROWCOUNT || ' records in WSM_LOT_BASED_JOBS',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 3831

l_update_serial_attr    NUMBER;
Line: 3841

CURSOR c_job_serials is SELECT serial_number
                        FROM   mtl_serial_numbers msn
                        where  msn.inventory_item_id = p_inventory_item_id
                        and    msn.current_organization_id = p_organization_id
                        and    msn.wip_entity_id = p_wip_entity_id;
Line: 3867

                l_param_tbl.delete;
Line: 3903

                                select charge_jump_from_queue
                                into   l_charge_jump_from_queue
                                from   wsm_parameters
                                where  organization_id = p_organization_id;
Line: 3939

                l_msg_tokens.delete;
Line: 3956

                        l_msg_tokens.delete;
Line: 3974

        SELECT count(*)
        INTO  l_job_serial_count
        FROM  mtl_serial_numbers MSN
        where MSN.wip_entity_id = p_wip_entity_id
        AND   MSN.current_organization_id            = p_organization_id
        AND   MSN.inventory_item_id                  = p_inventory_item_id
        AND   nvl(MSN.intraoperation_step_type,-1)  <> WIP_CONSTANTS.SCRAP;
Line: 3991

                                l_msg_tokens.delete;
Line: 3994

                                select wip_entity_name
                                into   l_msg_tokens(1).TokenValue
                                from   wip_entities
                                where  wip_entity_id = p_wip_entity_id
                                and    organization_id = p_organization_id;
Line: 4021

                        l_msg_tokens.delete;
Line: 4049

                                l_msg_tokens.delete;
Line: 4077

        l_serial_list.delete;
Line: 4080

                l_msg_tokens.delete;
Line: 4105

                                l_msg_tokens.delete;
Line: 4141

                                        select gen_object_id
                                        into   l_gen_object_id
                                        from   mtl_serial_numbers
                                        where  serial_number = p_serial_num_tbl(l_count).serial_number
                                        and    inventory_item_id = p_inventory_item_id
                                        and    current_organization_id   = p_organization_id;
Line: 4153

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATE_DATE          := sysdate;
Line: 4154

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATED_BY           := g_user_id;
Line: 4155

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATED_BY_NAME      := g_user_name;
Line: 4156

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATE_LOGIN         := g_user_login_id;
Line: 4160

                                l_wip_serial_nums_tbl(l_count).PROGRAM_UPDATE_DATE       := sysdate;
Line: 4164

                                l_msg_tokens.delete;
Line: 4166

                                                        p_msg_text          => 'Going to Insert ' || l_count || ' user provided records into wip_serial_move_interface for move and scrap',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 4177

                                insert into wip_serial_move_interface values l_wip_serial_nums_tbl(l_cntr);
Line: 4185

                                INSERT INTO WIP_SERIAL_MOVE_INTERFACE
                                (        TRANSACTION_ID,
                                         ASSEMBLY_SERIAL_NUMBER,
                                         GEN_OBJECT_ID,
                                         LAST_UPDATE_DATE,
                                         LAST_UPDATED_BY,
                                         LAST_UPDATED_BY_NAME,
                                         CREATION_DATE,
                                         CREATED_BY,
                                         CREATED_BY_NAME,
                                         LAST_UPDATE_LOGIN,
                                         REQUEST_ID,
                                         PROGRAM_APPLICATION_ID,
                                         PROGRAM_ID,
                                         PROGRAM_UPDATE_DATE
                                )
                                (
                                SELECT
                                         p_scrap_txn_id,
                                         SERIAL_NUMBER,
                                         gen_object_id,
                                         sysdate,
                                         g_user_id,
                                         g_user_name,
                                         sysdate,
                                         g_user_id,
                                         g_user_name,
                                         g_user_login_id,
                                         g_request_id,
                                         g_program_appl_id,
                                         g_program_id,
                                         sysdate
                                FROM  MTL_SERIAL_NUMBERS MSN
                                WHERE MSN.wip_entity_id = p_wip_entity_id
                                AND   MSN.current_organization_id            = p_organization_id
                                AND   MSN.inventory_item_id                  = p_inventory_item_id
                                -- AND   MSN.current_status                  = WIP_CONSTANTS.IN_STORES
                                -- AND   MSN.operation_seq_num               = p_curr_job_op_seq_num
                                AND    nvl(MSN.intraoperation_step_type,-1)  <> WIP_CONSTANTS.SCRAP
                                AND   NOT EXISTS (select 'Serial Already inserted for move'
                                                   from   WIP_SERIAL_MOVE_INTERFACE
                                                   where  TRANSACTION_ID = p_move_txn_id
                                                   AND    ASSEMBLY_SERIAL_NUMBER = MSN.SERIAL_NUMBER
                                                  )
                                AND   NOT EXISTS (select 'Serial Already inserted for scrap'
                                                   from   WIP_SERIAL_MOVE_INTERFACE
                                                   where  TRANSACTION_ID = p_scrap_txn_id
                                                   AND    ASSEMBLY_SERIAL_NUMBER = MSN.SERIAL_NUMBER
                                                  )
                                );
Line: 4237

                                        l_msg_tokens.delete;
Line: 4239

                                                                p_msg_text          => 'Inserted  ' || SQL%ROWCOUNT || ' records into wip_serial_move_interface for scrap',
                                                                p_stmt_num          => l_stmt_num               ,
                                                                p_msg_tokens        => l_msg_tokens             ,
                                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                                p_run_log_level     => l_log_level
                                                                );
Line: 4273

                                        select gen_object_id
                                        into   l_gen_object_id
                                        from   mtl_serial_numbers
                                        where  serial_number = p_serial_num_tbl(l_count).serial_number
                                        and    inventory_item_id = p_inventory_item_id
                                        and    current_organization_id   = p_organization_id;
Line: 4285

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATE_DATE          := sysdate;
Line: 4286

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATED_BY           := g_user_id;
Line: 4287

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATED_BY_NAME      := g_user_name;
Line: 4288

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATE_LOGIN         := g_user_login_id;
Line: 4292

                                l_wip_serial_nums_tbl(l_count).PROGRAM_UPDATE_DATE       := sysdate;
Line: 4296

                                l_msg_tokens.delete;
Line: 4298

                                                        p_msg_text          => 'Going to Insert ' || l_count || ' user provided records into wip_serial_move_interface for move and scrap',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 4309

                                insert into wip_serial_move_interface values l_wip_serial_nums_tbl(l_cntr);
Line: 4317

                                INSERT INTO WIP_SERIAL_MOVE_INTERFACE
                                (        TRANSACTION_ID,
                                         ASSEMBLY_SERIAL_NUMBER,
                                         gen_object_id,
                                         LAST_UPDATE_DATE,
                                         LAST_UPDATED_BY,
                                         LAST_UPDATED_BY_NAME,
                                         CREATION_DATE,
                                         CREATED_BY,
                                         CREATED_BY_NAME,
                                         LAST_UPDATE_LOGIN,
                                         REQUEST_ID,
                                         PROGRAM_APPLICATION_ID,
                                         PROGRAM_ID,
                                         PROGRAM_UPDATE_DATE
                                )
                                (
                                SELECT
                                         p_move_txn_id,
                                         SERIAL_NUMBER,
                                         gen_object_id,
                                         sysdate,
                                         g_user_id,
                                         g_user_name,
                                         sysdate,
                                         g_user_id,
                                         g_user_name,
                                         g_user_login_id,
                                         g_request_id,
                                         g_program_appl_id,
                                         g_program_id,
                                         sysdate
                                FROM  MTL_SERIAL_NUMBERS MSN
                                WHERE MSN.wip_entity_id = p_wip_entity_id
                                AND   MSN.current_organization_id            = p_organization_id
                                AND   MSN.inventory_item_id                  = p_inventory_item_id
                                -- AND   MSN.current_status                  = WIP_CONSTANTS.IN_STORES
                                -- AND   MSN.operation_seq_num               = p_curr_job_op_seq_num
                                AND    nvl(MSN.intraoperation_step_type,-1)  <> WIP_CONSTANTS.SCRAP
                                AND   NOT EXISTS (select 'Serial Already inserted for move'
                                                   from   WIP_SERIAL_MOVE_INTERFACE
                                                   where  TRANSACTION_ID = p_move_txn_id
                                                   AND    ASSEMBLY_SERIAL_NUMBER = MSN.SERIAL_NUMBER
                                                  )
                                AND   NOT EXISTS (select 'Serial Already inserted for scrap'
                                                   from   WIP_SERIAL_MOVE_INTERFACE
                                                   where  TRANSACTION_ID = p_scrap_txn_id
                                                   AND    ASSEMBLY_SERIAL_NUMBER = MSN.SERIAL_NUMBER
                                                  )
                                );
Line: 4370

                                        l_msg_tokens.delete;
Line: 4372

                                                                p_msg_text          => 'Inserted  ' || SQL%ROWCOUNT || ' records into wip_serial_move_interface for Move',
                                                                p_stmt_num          => l_stmt_num               ,
                                                                p_msg_tokens        => l_msg_tokens             ,
                                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                                p_run_log_level     => l_log_level
                                                                );
Line: 4390

                        INSERT INTO WIP_SERIAL_MOVE_INTERFACE
                        (        TRANSACTION_ID,
                                 ASSEMBLY_SERIAL_NUMBER,
                                 gen_object_id,
                                 LAST_UPDATE_DATE,
                                 LAST_UPDATED_BY,
                                 LAST_UPDATED_BY_NAME,
                                 CREATION_DATE,
                                 CREATED_BY,
                                 CREATED_BY_NAME,
                                 LAST_UPDATE_LOGIN,
                                 REQUEST_ID,
                                 PROGRAM_APPLICATION_ID,
                                 PROGRAM_ID,
                                 PROGRAM_UPDATE_DATE
                        )
                        (
                        SELECT
                                 p_move_txn_id,
                                 SERIAL_NUMBER,
                                 gen_object_id,
                                 sysdate,
                                 g_user_id,
                                 g_user_name,
                                 sysdate,
                                 g_user_id,
                                 g_user_name,
                                 g_user_login_id,
                                 g_request_id,
                                 g_program_appl_id,
                                 g_program_id,
                                 sysdate
                        FROM  MTL_SERIAL_NUMBERS MSN
                        WHERE MSN.wip_entity_id = p_wip_entity_id
                        AND   MSN.current_organization_id            = p_organization_id
                        AND   MSN.inventory_item_id                  = p_inventory_item_id
                        -- AND   MSN.current_status                  = WIP_CONSTANTS.IN_STORES
                        -- AND   MSN.operation_seq_num               = p_curr_job_op_seq_num
                        AND    nvl(MSN.intraoperation_step_type,-1)  <> WIP_CONSTANTS.SCRAP
                        );
Line: 4432

                                l_msg_tokens.delete;
Line: 4434

                                                        p_msg_text          => 'Inserted ' || SQL%ROWCOUNT || ' records into WIP_SERIAL_MOVE_INTERFACE to be moved',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 4448

                        INSERT INTO WIP_SERIAL_MOVE_INTERFACE
                        (        TRANSACTION_ID,
                                 ASSEMBLY_SERIAL_NUMBER,
                                 gen_object_id,
                                 LAST_UPDATE_DATE,
                                 LAST_UPDATED_BY,
                                 LAST_UPDATED_BY_NAME,
                                 CREATION_DATE,
                                 CREATED_BY,
                                 CREATED_BY_NAME,
                                 LAST_UPDATE_LOGIN,
                                 REQUEST_ID,
                                 PROGRAM_APPLICATION_ID,
                                 PROGRAM_ID,
                                 PROGRAM_UPDATE_DATE
                        )
                        (
                        SELECT
                                 p_scrap_txn_id,
                                 SERIAL_NUMBER,
                                 gen_object_id,
                                 sysdate,
                                 g_user_id,
                                 g_user_name,
                                 sysdate,
                                 g_user_id,
                                 g_user_name,
                                 g_user_login_id,
                                 g_request_id,
                                 g_program_appl_id,
                                 g_program_id,
                                 sysdate
                        FROM  MTL_SERIAL_NUMBERS MSN
                        WHERE MSN.wip_entity_id = p_wip_entity_id
                        AND   MSN.current_organization_id            = p_organization_id
                        AND   MSN.inventory_item_id                  = p_inventory_item_id
                        -- AND   MSN.current_status                  = WIP_CONSTANTS.IN_STORES
                        -- AND   MSN.operation_seq_num               = p_curr_job_op_seq_num
                        AND    nvl(MSN.intraoperation_step_type,-1)  <> WIP_CONSTANTS.SCRAP
                        );
Line: 4490

                                l_msg_tokens.delete;
Line: 4492

                                                        p_msg_text          => 'Inserted ' || SQL%ROWCOUNT || ' records into WIP_SERIAL_MOVE_INTERFACE to be scrapped',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 4512

                                        l_msg_tokens.delete;
Line: 4545

                                        select gen_object_id
                                        into   l_gen_object_id
                                        from   mtl_serial_numbers
                                        where  serial_number = p_serial_num_tbl(l_count).serial_number
                                        and    inventory_item_id = p_inventory_item_id
                                        and    current_organization_id   = p_organization_id;
Line: 4557

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATE_DATE          := sysdate;
Line: 4558

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATED_BY           := g_user_id;
Line: 4559

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATED_BY_NAME      := g_user_name;
Line: 4560

                                l_wip_serial_nums_tbl(l_count).LAST_UPDATE_LOGIN         := g_user_login_id;
Line: 4564

                                l_wip_serial_nums_tbl(l_count).PROGRAM_UPDATE_DATE       := sysdate;
Line: 4570

                                l_msg_tokens.delete;
Line: 4572

                                                        p_msg_text          => 'Going to insert ' || l_wip_serial_nums_tbl.count || ' records into WIP_SERIAL_MOVE_INTERFACE to be scrapped',
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 4583

                                insert into wip_serial_move_interface values l_wip_serial_nums_tbl(l_cntr);
Line: 4591

                l_msg_tokens.delete;
Line: 4606

                        l_msg_tokens.delete;
Line: 4608

                                                p_msg_text          => 'Invoking update_serial_attr(1) for ' ||
                                                                       'Serial Attributes updation for serial number '  ||
                                                                       p_serial_num_tbl(l_cntr).serial_number,
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 4618

                update_serial_attr (   p_calling_mode           => p_calling_mode,
                                       p_serial_number_rec      => p_serial_num_tbl(l_cntr),
                                       p_inventory_item_id      => p_inventory_item_id,
                                       p_organization_id        => p_organization_id  ,
                                       p_clear_serial_attr      => null,
                                       p_wlt_txn_type           => null,
                                       p_update_serial_attr     => null,
                                       p_update_desc_attr       => 1,
                                       x_return_status          => x_return_status,
                                       x_error_count            => x_error_count,
                                       x_error_msg              => x_error_msg
                                  );
Line: 4650

                                l_msg_tokens.delete;
Line: 4652

                                                        p_msg_text          => 'Invoking update_serial : ' || l_job_serial_rec.serial_number
                                                                                || ' Operation : ' || p_curr_job_op_seq_num
                                                                                || ' Op Step   : ' || p_curr_job_intraop_step,
                                                        p_stmt_num          => l_stmt_num               ,
                                                        p_msg_tokens        => l_msg_tokens             ,
                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                        p_run_log_level     => l_log_level
                                                        );
Line: 4663

                        update_serial( p_serial_number                => l_job_serial_rec.serial_number ,
                                       p_inventory_item_id            => p_inventory_item_id            ,
                                       p_organization_id              => p_organization_id              ,
                                       p_wip_entity_id                => p_wip_entity_id                ,
                                       p_operation_seq_num            => p_curr_job_op_seq_num          ,
                                       p_intraoperation_step_type     => p_curr_job_intraop_step        ,
                                       x_return_status                => x_return_status                ,
                                       x_error_msg                    => x_error_count                  ,
                                       x_error_count                  => x_error_msg
                                     );
Line: 4743

        SELECT MSN.serial_number,
               MSN.gen_object_id
        FROM   MTL_SERIAL_NUMBERS MSN
        WHERE  MSN.SERIAL_NUMBER IN (select wsmt.assembly_serial_number
                                     FROM   WIP_SERIAL_MOVE_TRANSACTIONS WSMT
                                     WHERE  WSMT.transaction_id = v_txn_id
                                    )
        AND   MSN.current_organization_id            = p_organization_id
        AND   MSN.inventory_item_id                  = p_inventory_item_id
        --AND   MSN.current_status                   = WIP_CONSTANTS.IN_STORES
        FOR   UPDATE NOWAIT;
Line: 4756

        SELECT MSN.serial_number,
               MSN.gen_object_id
        FROM   MTL_SERIAL_NUMBERS MSN
        WHERE  MSN.SERIAL_NUMBER IN (select wsmt.assembly_serial_number
                                     FROM   WIP_SERIAL_MOVE_TRANSACTIONS WSMT
                                     WHERE  WSMT.transaction_id = v_txn_id
                                    )
        AND   MSN.current_organization_id            = p_organization_id
        AND   MSN.inventory_item_id                  = p_inventory_item_id
        --AND   MSN.current_status                   = WIP_CONSTANTS.DEF_NOT_USED
        AND   MSN.wip_entity_id                      = p_wip_entity_id
        FOR   UPDATE NOWAIT;
Line: 4802

                l_param_tbl.delete;
Line: 4843

                l_msg_tokens.delete;
Line: 4864

                        l_msg_tokens.delete;
Line: 4902

                l_msg_tokens.delete;
Line: 4921

                        l_msg_tokens.delete;
Line: 4948

                        l_wip_serial_rows_tbl(l_pos).LAST_UPDATE_DATE       := sysdate              ;
Line: 4949

                        l_wip_serial_rows_tbl(l_pos).LAST_UPDATED_BY        := g_user_id            ;
Line: 4952

                        l_wip_serial_rows_tbl(l_pos).LAST_UPDATE_LOGIN      := g_user_login_id      ;
Line: 4956

                        l_wip_serial_rows_tbl(l_pos).PROGRAM_UPDATE_DATE    := sysdate              ;
Line: 4972

                l_wip_serial_rows_tbl(l_pos).LAST_UPDATE_DATE       := sysdate              ;
Line: 4973

                l_wip_serial_rows_tbl(l_pos).LAST_UPDATED_BY        := g_user_id            ;
Line: 4976

                l_wip_serial_rows_tbl(l_pos).LAST_UPDATE_LOGIN      := g_user_login_id      ;
Line: 4980

                l_wip_serial_rows_tbl(l_pos).PROGRAM_UPDATE_DATE    := sysdate              ;
Line: 4989

                l_msg_tokens.delete;
Line: 4991

                                        p_msg_text          => 'Undo Transaction : Going to insert : ' || l_wip_serial_rows_tbl.count || ' records',
                                        p_stmt_num          => l_stmt_num               ,
                                        p_msg_tokens        => l_msg_tokens             ,
                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                        p_run_log_level     => l_log_level
                                        );
Line: 5000

                insert into wip_serial_move_interface values l_wip_serial_rows_tbl(l_counter);
Line: 5065

        select
        wsti.Serial_Number                     ,
        null                                   ,
        -- (Gen_object_id --> assembly_item_id No longer used Instead the column will have gen_object_id though the name is assembly_item_id)
        wsti.header_id                         ,  -- header_id
        wsti.Generate_serial_number            ,
        wsti.Generate_for_qty                  ,
        wsti.Action_flag                       ,
        wsti.Current_wip_entity_name           ,
        wsti.Changed_wip_entity_name           ,
        wsti.Current_wip_entity_id             ,
        wsti.Changed_wip_entity_id             ,
        decode(wsti.serial_attribute_category  , l_null_char, null, null, msn.serial_attribute_category, wsti.serial_attribute_category), -- serial_attribute_category
        decode(wsti.territory_code             , l_null_char, null, null, msn.territory_code           , wsti.territory_code           ), -- territory_code
        decode(wsti.origination_date           , l_null_date, null, null, msn.origination_date         , wsti.origination_date         ), -- origination_date
        decode(wsti.c_attribute1               , l_null_char, null, null, msn.c_attribute1             , wsti.c_attribute1             ), -- c_attribute1
        decode(wsti.c_attribute2               , l_null_char, null, null, msn.c_attribute2             , wsti.c_attribute2             ), -- c_attribute2
        decode(wsti.c_attribute3               , l_null_char, null, null, msn.c_attribute3             , wsti.c_attribute3             ), -- c_attribute3
        decode(wsti.c_attribute4               , l_null_char, null, null, msn.c_attribute4             , wsti.c_attribute4             ), -- c_attribute4
        decode(wsti.c_attribute5               , l_null_char, null, null, msn.c_attribute5             , wsti.c_attribute5             ), -- c_attribute5
        decode(wsti.c_attribute6               , l_null_char, null, null, msn.c_attribute6             , wsti.c_attribute6             ), -- c_attribute6
        decode(wsti.c_attribute7               , l_null_char, null, null, msn.c_attribute7             , wsti.c_attribute7             ), -- c_attribute7
        decode(wsti.c_attribute8               , l_null_char, null, null, msn.c_attribute8             , wsti.c_attribute8             ), -- c_attribute8
        decode(wsti.c_attribute9               , l_null_char, null, null, msn.c_attribute9             , wsti.c_attribute9             ), -- c_attribute9
        decode(wsti.c_attribute10              , l_null_char, null, null, msn.c_attribute10            , wsti.c_attribute10            ), -- c_attribute10
        decode(wsti.c_attribute11              , l_null_char, null, null, msn.c_attribute11            , wsti.c_attribute11            ), -- c_attribute11
        decode(wsti.c_attribute12              , l_null_char, null, null, msn.c_attribute12            , wsti.c_attribute12            ), -- c_attribute12
        decode(wsti.c_attribute13              , l_null_char, null, null, msn.c_attribute13            , wsti.c_attribute13            ), -- c_attribute13
        decode(wsti.c_attribute14              , l_null_char, null, null, msn.c_attribute14            , wsti.c_attribute14            ), -- c_attribute14
        decode(wsti.c_attribute15              , l_null_char, null, null, msn.c_attribute15            , wsti.c_attribute15            ), -- c_attribute15
        decode(wsti.c_attribute16              , l_null_char, null, null, msn.c_attribute16            , wsti.c_attribute16            ), -- c_attribute16
        decode(wsti.c_attribute17              , l_null_char, null, null, msn.c_attribute17            , wsti.c_attribute17            ), -- c_attribute17
        decode(wsti.c_attribute18              , l_null_char, null, null, msn.c_attribute18            , wsti.c_attribute18            ), -- c_attribute18
        decode(wsti.c_attribute19              , l_null_char, null, null, msn.c_attribute19            , wsti.c_attribute19            ), -- c_attribute19
        decode(wsti.c_attribute20              , l_null_char, null, null, msn.c_attribute20            , wsti.c_attribute20            ), -- c_attribute20
        decode(wsti.d_attribute1               , l_null_date, null, null, msn.d_attribute1             , wsti.d_attribute1             ), -- d_attribute1
        decode(wsti.d_attribute2               , l_null_date, null, null, msn.d_attribute2             , wsti.d_attribute2             ), -- d_attribute2
        decode(wsti.d_attribute3               , l_null_date, null, null, msn.d_attribute3             , wsti.d_attribute3             ), -- d_attribute3
        decode(wsti.d_attribute4               , l_null_date, null, null, msn.d_attribute4             , wsti.d_attribute4             ), -- d_attribute4
        decode(wsti.d_attribute5               , l_null_date, null, null, msn.d_attribute5             , wsti.d_attribute5             ), -- d_attribute5
        decode(wsti.d_attribute6               , l_null_date, null, null, msn.d_attribute6             , wsti.d_attribute6             ), -- d_attribute6
        decode(wsti.d_attribute7               , l_null_date, null, null, msn.d_attribute7             , wsti.d_attribute7             ), -- d_attribute7
        decode(wsti.d_attribute8               , l_null_date, null, null, msn.d_attribute8             , wsti.d_attribute8             ), -- d_attribute8
        decode(wsti.d_attribute9               , l_null_date, null, null, msn.d_attribute9             , wsti.d_attribute9             ), -- d_attribute9
        decode(wsti.d_attribute10              , l_null_date, null, null, msn.d_attribute10            , wsti.d_attribute10            ), -- d_attribute10
        decode(wsti.n_attribute1               , l_null_num , null, null, msn.n_attribute1             , wsti.n_attribute1             ), -- n_attribute1
        decode(wsti.n_attribute2               , l_null_num , null, null, msn.n_attribute2             , wsti.n_attribute2             ), -- n_attribute2
        decode(wsti.n_attribute3               , l_null_num , null, null, msn.n_attribute3             , wsti.n_attribute3             ), -- n_attribute3
        decode(wsti.n_attribute4               , l_null_num , null, null, msn.n_attribute4             , wsti.n_attribute4             ), -- n_attribute4
        decode(wsti.n_attribute5               , l_null_num , null, null, msn.n_attribute5             , wsti.n_attribute5             ), -- n_attribute5
        decode(wsti.n_attribute6               , l_null_num , null, null, msn.n_attribute6             , wsti.n_attribute6             ), -- n_attribute6
        decode(wsti.n_attribute7               , l_null_num , null, null, msn.n_attribute7             , wsti.n_attribute7             ), -- n_attribute7
        decode(wsti.n_attribute8               , l_null_num , null, null, msn.n_attribute8             , wsti.n_attribute8             ), -- n_attribute8
        decode(wsti.n_attribute9               , l_null_num , null, null, msn.n_attribute9             , wsti.n_attribute9             ), -- n_attribute9
        decode(wsti.n_attribute10              , l_null_num , null, null, msn.n_attribute10            , wsti.n_attribute10            ), -- n_attribute10
        decode(wsti.status_id                  , l_null_num , null, null, msn.status_id                , wsti.status_id                ), -- status_id
        decode(wsti.time_since_new             , l_null_num , null, null, msn.time_since_new           , wsti.time_since_new           ), -- time_since_new
        decode(wsti.cycles_since_new           , l_null_num , null, null, msn.cycles_since_new         , wsti.cycles_since_new         ), -- cycles_since_new
        decode(wsti.time_since_overhaul        , l_null_num , null, null, msn.time_since_overhaul      , wsti.time_since_overhaul      ), -- time_since_overhaul
        decode(wsti.cycles_since_overhaul      , l_null_num , null, null, msn.cycles_since_overhaul    , wsti.cycles_since_overhaul    ), -- cycles_since_overhaul
        decode(wsti.time_since_repair          , l_null_num , null, null, msn.time_since_repair        , wsti.time_since_repair        ), -- time_since_repair
        decode(wsti.cycles_since_repair        , l_null_num , null, null, msn.cycles_since_repair      , wsti.cycles_since_repair      ), -- cycles_since_repair
        decode(wsti.time_since_visit           , l_null_num , null, null, msn.time_since_visit         , wsti.time_since_visit         ), -- time_since_visit
        decode(wsti.cycles_since_visit         , l_null_num , null, null, msn.cycles_since_visit       , wsti.cycles_since_visit       ), -- cycles_since_visit
        decode(wsti.time_since_mark            , l_null_num , null, null, msn.time_since_mark          , wsti.time_since_mark          ), -- time_since_mark
        decode(wsti.cycles_since_mark          , l_null_num , null, null, msn.cycles_since_mark        , wsti.cycles_since_mark        ), -- cycles_since_mark
        decode(wsti.number_of_repairs          , l_null_num , null, null, msn.number_of_repairs        , wsti.number_of_repairs        ), -- number_of_repairs
        decode(wsti.attribute_category         , l_null_char, l_miss_char , null ,msn.attribute_category   ,wsti.attribute_category    ),
        decode(wsti.attribute1                 , l_null_char ,l_miss_char , wsti.attribute1            ),
        decode(wsti.attribute2                 , l_null_char ,l_miss_char , wsti.attribute2            ),
        decode(wsti.attribute3                 , l_null_char ,l_miss_char , wsti.attribute3            ),
        decode(wsti.attribute4                 , l_null_char ,l_miss_char , wsti.attribute4            ),
        decode(wsti.attribute5                 , l_null_char ,l_miss_char , wsti.attribute5            ),
        decode(wsti.attribute6                 , l_null_char ,l_miss_char , wsti.attribute6            ),
        decode(wsti.attribute7                 , l_null_char ,l_miss_char , wsti.attribute7            ),
        decode(wsti.attribute8                 , l_null_char ,l_miss_char , wsti.attribute8            ),
        decode(wsti.attribute9                 , l_null_char ,l_miss_char , wsti.attribute9            ),
        decode(wsti.attribute10                , l_null_char ,l_miss_char , wsti.attribute10           ),
        decode(wsti.attribute11                , l_null_char ,l_miss_char , wsti.attribute11           ),
        decode(wsti.attribute12                , l_null_char ,l_miss_char , wsti.attribute12           ),
        decode(wsti.attribute13                , l_null_char ,l_miss_char , wsti.attribute13           ),
        decode(wsti.attribute14                , l_null_char ,l_miss_char , wsti.attribute14           ),
        decode(wsti.attribute15                , l_null_char ,l_miss_char , wsti.attribute15           )
        from wsm_serial_txn_interface wsti,
             mtl_serial_numbers       msn
        where header_id = p_header_id
        and transaction_type_id = 3
        and  wsti.serial_number = msn.serial_number (+)
        and  msn.inventory_item_id (+) = l_inventory_item_id
        and  msn.current_organization_id (+) = p_organization_id
        order by nvl(wsti.action_flag,0) desc; -- Code review remark
Line: 5176

                l_param_tbl.delete;
Line: 5201

                                select we.wip_entity_id,wdj.primary_item_id
                                into   l_wip_entity_id,l_inventory_item_id
                                from   wip_entities we,
                                       wip_discrete_jobs wdj
                                where  we.wip_entity_name = p_wip_entity_name
                                and    we.wip_entity_id = wdj.wip_entity_id
                                and    we.organization_id = p_organization_id;
Line: 5223

                                                l_msg_tokens.delete;
Line: 5242

                                select we.wip_entity_id,wdj.primary_item_id
                                into   l_wip_entity_id,l_inventory_item_id
                                from   wip_entities we,
                                       wip_discrete_jobs wdj
                                where  we.wip_entity_name = nvl(p_wip_entity_name,we.wip_entity_name)
                                and    we.wip_entity_id = wdj.wip_entity_id
                                and    we.wip_entity_id = p_wip_entity_id
                                and    we.organization_id = p_organization_id;
Line: 5267

                                                l_msg_tokens.delete;
Line: 5287

                        l_msg_tokens.delete;
Line: 5297

                update wsm_serial_txn_interface wsti
                set wsti.process_status = wip_constants.error
                where wsti.header_id = p_header_id
                and wsti.transaction_type_id = 3
                and serial_number not in ( SELECT MSN.serial_number
                                           FROM  MTL_SERIAL_NUMBERS MSN
                                           WHERE  MSN.wip_entity_id                  = l_wip_entity_id
                                           AND   MSN.current_organization_id         = p_organization_id
                                           AND   MSN.inventory_item_id               = l_inventory_item_id
                                           -- AND   MSN.current_status               = WIP_CONSTANTS.IN_STORES
                                           -- AND   MSN.operation_seq_num            = l_op_seq_num
                                           -- AND   MSN.intraoperation_step_type     = p_curr_job_intraop_step < not required...>
                                           AND    nvl(MSN.intraoperation_step_type,-1)  <> 5
                                         );
Line: 5318

                                l_msg_tokens.delete;
Line: 5338

        elsif p_wlt_txn_type = (WSMPCNST.UPDATE_QUANTITY) THEN

                l_stmt_num := 60;
Line: 5341

                update wsm_serial_txn_interface wsti
                set wsti.process_status = wip_constants.error
                where wsti.header_id = p_header_id
                and wsti.transaction_type_id = 3
                and action_flag not in (WSM_GASSOC_SERIAL_NUM,WSM_ADD_SERIAL_NUM);
Line: 5354

                                l_msg_tokens.delete;
Line: 5356

                                l_msg_tokens(1).TokenValue := 'Action flag for Update Quantity transaction';
Line: 5420

select serial_number
from   mtl_serial_numbers MSN,
       wip_discrete_jobs WDJ
where  MSN.inventory_item_id = WDJ.primary_item_id
and    MSN.wip_entity_id = p_split_txn_job_id
and    MSN.current_organization_id = WDJ.organization_id
and    WDJ.wip_entity_id = p_split_txn_job_id
and    nvl(MSN.intraoperation_step_type,-1) <> 5;
Line: 5456

                l_msg_tokens.delete;
Line: 5491

                l_msg_tokens.delete;
Line: 5525

Procedure Insert_into_WST ( p_transaction_id            IN              NUMBER          ,
                            p_transaction_type_id       IN              NUMBER          ,
                            p_old_wip_entity_name       IN              VARCHAR2        ,
                            p_new_wip_entity_name       IN              VARCHAR2        ,
                            p_organization_id           IN              NUMBER          ,
                            p_item_id                   IN              NUMBER          ,
                            p_wip_entity_id             IN              NUMBER          ,
                            x_return_status             OUT NOCOPY      VARCHAR2        ,
                            x_error_msg                 OUT NOCOPY      VARCHAR2        ,
                            x_error_count               OUT NOCOPY      NUMBER
                          )
IS

-- Logging variables.....
l_msg_tokens        WSM_Log_PVT.token_rec_tbl;
Line: 5543

l_module            VARCHAR2(100) := 'wsm.plsql.WSM_SERIAL_SUPPORT_PVT.Insert_into_WST';
Line: 5556

                l_param_tbl.delete;
Line: 5577

        insert into wsm_serial_transactions
        (transaction_id                         ,
         transaction_type_id                    ,
         serial_number                          ,
         gen_object_id                          ,
         current_wip_entity_name                       ,
         changed_wip_entity_name                       ,
         current_wip_entity_id                  ,
         changed_wip_entity_id                  ,
         created_by                             ,
         last_update_date                       ,
         last_updated_by                        ,
         creation_date                          ,
         last_update_login                      ,
         request_id                             ,
         program_application_id                 ,
         program_id                             ,
         program_update_date                    ,
         original_system_reference
        )
        select
        p_transaction_id                          ,
        3                                         ,
        MSN.serial_number                         ,
        MSN.gen_object_id                         ,
        p_old_wip_entity_name                     ,
        p_new_wip_entity_name                     ,
        p_wip_entity_id                           ,
        p_wip_entity_id                           ,
        g_user_id                                 ,
        sysdate                                   ,
        g_user_id                                 ,
        sysdate                                   ,
        g_user_login_id                           ,
        g_request_id                              ,
        g_program_appl_id                         ,
        g_program_id                              ,
        sysdate                                   ,
        null
        from mtl_serial_numbers MSN
        where MSN.current_organization_id = p_organization_id
        and   MSN.inventory_item_id = p_item_id
        and   MSN.wip_entity_id = p_wip_entity_id
        and   nvl(MSN.intraoperation_step_type,-1) <> 5;
Line: 5643

END Insert_into_WST;
Line: 5685

        l_update_serial_attr    NUMBER;
Line: 5724

        IS SELECT msn.serial_number
           FROM   MTL_SERIAL_NUMBERS MSN
           WHERE  msn.wip_entity_id = v_wip_entity_id
           AND    msn.inventory_item_id = v_item_id
           AND    nvl(msn.INTRAOPERATION_STEP_TYPE,-1) <> WIP_CONSTANTS.SCRAP
           AND    msn.current_organization_id  = p_organization_id;
Line: 5751

                l_param_tbl.delete;
Line: 5840

                select nvl(op_seq_num_increment, 10)
                into   l_op_seq_incr
                from   wsm_parameters
                where  organization_id = p_organization_id;
Line: 5845

                IF p_wlt_txn_type IN (WSMPCNST.UPDATE_ASSEMBLY,WSMPCNST.UPDATE_ROUTING) THEN
                        l_curr_job_op_seq_num := p_starting_jobs_tbl(l_rep_job_index).operation_seq_num + l_op_seq_incr;
Line: 5859

                l_msg_tokens.delete;
Line: 5882

                                l_msg_tokens.delete;
Line: 5905

                select count(*)
                into   l_serial_num_count
                -- ST : Fix for bug 4910758 (remove usage of wsm_job_serial_numbers_v)
                -- from wsm_job_serial_numbers_v
                from   mtl_serial_numbers
                where  inventory_item_id = l_inventory_item_id
                and    wip_entity_id = l_wip_entity_id
                and    nvl(intraoperation_step_type,-1) <> 5;
Line: 5915

                        l_msg_tokens.delete;
Line: 5936

                                l_msg_tokens.delete;
Line: 5968

                                                l_msg_tokens.delete;
Line: 6039

                                                l_msg_tokens.delete;
Line: 6068

                                l_msg_tokens.delete;
Line: 6100

                        l_update_serial_attr := g_wms_installed;
Line: 6102

                        l_update_serial_attr := g_wms_installed;
Line: 6106

                IF l_update_serial_attr = 1 then

                        l_parent_job_ser_context := null;
Line: 6132

                                        l_msg_tokens.delete;
Line: 6170

                                                        l_msg_tokens.delete;
Line: 6190

                                                l_msg_tokens.delete;
Line: 6233

                                                l_msg_tokens.delete;
Line: 6303

                                                        p_serial_num_tbl.delete(l_index1);
Line: 6335

                                                l_msg_tokens.delete;
Line: 6378

                                                l_msg_tokens.delete;
Line: 6400

                                                l_msg_tokens.delete;
Line: 6436

                                        l_msg_tokens.delete;
Line: 6461

                                        l_msg_tokens.delete;
Line: 6490

                        if p_resulting_jobs_tbl(l_index).split_has_update_assy = 1 then

                                -- During split transaction.. user can provide attributes' information...
                                if l_update_serial_attr = 1 then
                                        -- get the context of the new assembly if no context/different from the existing context then
                                        -- populate message about the serial attributes being cleared...
                                        l_stmt_num := 149;
Line: 6511

                                                        l_msg_tokens.delete;
Line: 6529

                                end if; -- end l_update_serial_attr = 1
Line: 6553

                                                        l_msg_tokens.delete;
Line: 6564

                                                update_serial (  p_serial_number                => p_serial_num_tbl(l_index1).serial_number,
                                                                 p_inventory_item_id            => l_inventory_item_id,
                                                                 p_organization_id              => p_organization_id,
                                                                 p_wip_entity_id                => p_resulting_jobs_tbl(l_index).wip_entity_id,
                                                                 p_operation_seq_num            => l_temp_op_seq_num,
                                                                 p_intraoperation_step_type     => l_temp_op_step,
                                                                 x_return_status                => x_return_status,
                                                                 x_error_msg                    => x_error_msg  ,
                                                                 x_error_count                  => x_error_count
                                                              );
Line: 6593

                                                update_serial_attr ( p_calling_mode             =>  p_calling_mode              ,
                                                                     p_serial_number_rec        =>  p_serial_num_tbl(l_index1)  ,
                                                                     p_inventory_item_id        =>  l_inventory_item_id         ,
                                                                     p_organization_id          =>  p_organization_id           ,
                                                                     p_clear_serial_attr        =>  l_clear_serial_attr         ,
                                                                     p_wlt_txn_type             =>  WSMPCNST.SPLIT              ,
                                                                     p_update_serial_attr       =>  l_update_serial_attr        ,
                                                                     p_update_desc_attr         =>  1                           ,
                                                                     p_serial_attr_context      =>  l_child_job_ser_context     ,
                                                                     x_return_status            =>  x_return_status             ,
                                                                     x_error_count              =>  x_error_count               ,
                                                                     x_error_msg                =>  x_error_msg
                                                                   );
Line: 6623

                                        l_msg_tokens.delete;
Line: 6625

                                                                p_msg_text          => 'Invoking INV_LOT_TRX_VALIDATION_PUB.update_item_serial',
                                                                p_stmt_num          => l_stmt_num               ,
                                                                p_msg_tokens        => l_msg_tokens             ,
                                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                                p_run_log_level     => l_log_level
                                                                );
Line: 6633

                                INV_LOT_TRX_VALIDATION_PUB.update_item_serial( x_msg_count                      => x_error_count                                    ,
                                                                               x_return_status                  => x_return_status                                  ,
                                                                               x_msg_data                       => x_error_msg                                      ,
                                                                               x_validation_status              => l_validation_status                              ,
                                                                               p_org_id                         => p_organization_id                                ,
                                                                               p_item_id                        => l_inventory_item_id                              ,
                                                                               p_to_item_id                     => p_resulting_jobs_tbl(l_index).primary_item_id  ,
                                                                               p_wip_entity_id                  => p_resulting_jobs_tbl(l_index).wip_entity_id      ,
                                                                               p_to_wip_entity_id               => p_resulting_jobs_tbl(l_index).wip_entity_id      ,
                                                                               p_to_operation_sequence          => l_temp_op_seq_num                                ,
                                                                               p_intraoperation_step_type       => l_temp_op_step
                                                                              );
Line: 6670

                                                        l_msg_tokens.delete;
Line: 6681

                                                update_serial (  p_serial_number                => p_serial_num_tbl(l_index1).serial_number     ,
                                                                 p_inventory_item_id            => l_inventory_item_id                          ,
                                                                 p_organization_id              => p_organization_id                            ,
                                                                 p_wip_entity_id                => p_resulting_jobs_tbl(l_index).wip_entity_id  ,
                                                                 p_operation_seq_num            => l_curr_job_op_seq_num                        ,
                                                                 p_intraoperation_step_type     => l_curr_job_op_step                           ,
                                                                 x_return_status                => x_return_status                              ,
                                                                 x_error_msg                    => x_error_msg                                  ,
                                                                 x_error_count                  => x_error_count
                                                              );
Line: 6706

                                                update_serial_attr ( p_calling_mode             =>  p_calling_mode              ,
                                                                     p_serial_number_rec        =>  p_serial_num_tbl(l_index1)  ,
                                                                     p_inventory_item_id        =>  l_inventory_item_id         ,
                                                                     p_organization_id          =>  p_organization_id           ,
                                                                     p_clear_serial_attr        =>  l_clear_serial_attr         ,
                                                                     p_wlt_txn_type             =>  WSMPCNST.SPLIT              ,
                                                                     p_update_serial_attr       =>  l_update_serial_attr        ,
                                                                     p_update_desc_attr         =>  1                           ,
                                                                     x_return_status            =>  x_return_status             ,
                                                                     x_error_count              =>  x_error_count               ,
                                                                     x_error_msg                =>  x_error_msg
                                                                   );
Line: 6738

                insert into wsm_serial_transactions
                (transaction_id                          ,
                 transaction_type_id                     ,
                 serial_number                           ,
                 gen_object_id                           ,
                 current_wip_entity_name                 ,
                 changed_wip_entity_name                 ,
                 current_wip_entity_id                   ,
                 changed_wip_entity_id                   ,
                 created_by                              ,
                 last_update_date                        ,
                 last_updated_by                         ,
                 creation_date                           ,
                 last_update_login                       ,
                 request_id                              ,
                 program_application_id                  ,
                 program_id                              ,
                 program_update_date                     ,
                 original_system_reference
                )
                select
                 p_txn_id                                ,
                 3                                       ,
                 MSN.serial_number                       ,
                 MSN.gen_object_id                       ,
                 WSSJ.wip_entity_name                    ,
                 WSRJ.wip_entity_name                    ,
                 WSSJ.wip_entity_id                      ,
                 WSRJ.wip_entity_id                      ,
                 g_user_id                               ,
                 sysdate                                 ,
                 g_user_id                               ,
                 sysdate                                 ,
                 g_user_login_id                         ,
                 g_request_id                            ,
                 g_program_appl_id                       ,
                 g_program_id                            ,
                 sysdate                                 ,
                 null
                from mtl_serial_numbers MSN             ,
                     wsm_sm_starting_jobs WSSJ          ,
                     wsm_sm_resulting_jobs WSRJ
                where MSN.current_organization_id = p_organization_id
                and   MSN.inventory_item_id = WSRJ.primary_item_id
                and   WSSJ.transaction_id = p_txn_id
                and   WSRJ.transaction_id = p_txn_id
                and   MSN.wip_entity_id = WSRJ.wip_entity_id
                and   nvl(MSN.intraoperation_step_type,-1) <> 5;
Line: 6789

                        update wip_discrete_jobs
                        set    serialization_start_op = 10
                        where  wip_entity_id in (select wip_entity_id
                                                 from wsm_sm_resulting_jobs
                                                 where transaction_id = p_txn_id);
Line: 6796

                        update wsm_lot_based_jobs
                        set    first_serial_txn_id = -1
                        where  wip_entity_id in (select wip_entity_id
                                                 from wsm_sm_resulting_jobs
                                                 where transaction_id = p_txn_id);
Line: 6838

                insert into wsm_serial_transactions
                (transaction_id                          ,
                 transaction_type_id                     ,
                 serial_number                           ,
                 gen_object_id                           ,
                 current_wip_entity_name                        ,
                 changed_wip_entity_name                        ,
                 current_wip_entity_id                   ,
                 changed_wip_entity_id                   ,
                 created_by                              ,
                 last_update_date                        ,
                 last_updated_by                         ,
                 creation_date                           ,
                 last_update_login                       ,
                 request_id                              ,
                 program_application_id                  ,
                 program_id                              ,
                 program_update_date                     ,
                 original_system_reference
                )
                select
                 p_txn_id                                ,
                 3                                       ,
                 MSN.serial_number                       ,
                 MSN.gen_object_id                       ,
                 WSSJ.wip_entity_name                    ,
                 WSRJ.wip_entity_name                    ,
                 WSSJ.wip_entity_id                      ,
                 WSRJ.wip_entity_id                      ,
                 g_user_id                               ,
                 sysdate                                 ,
                 g_user_id                               ,
                 sysdate                                 ,
                 g_user_login_id                         ,
                 g_request_id                            ,
                 g_program_appl_id                       ,
                 g_program_id                            ,
                 sysdate                                 ,
                 null
                from mtl_serial_numbers MSN             ,
                     wsm_sm_starting_jobs WSSJ          ,
                     wsm_sm_resulting_jobs WSRJ
                where MSN.current_organization_id = p_organization_id
                and   MSN.inventory_item_id = WSSJ.primary_item_id
                and   WSSJ.transaction_id = p_txn_id
                and   WSRJ.transaction_id = p_txn_id
                and   MSN.wip_entity_id = WSSJ.wip_entity_id
                and   nvl(MSN.intraoperation_step_type,-1) <> 5;
Line: 6919

                                                                l_msg_tokens.delete;
Line: 6940

                                        l_msg_tokens.delete;
Line: 6942

                                                                p_msg_text          => 'Invoking INV_LOT_TRX_VALIDATION_PUB.update_item_serial : for Res wip_entity_id ' || p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).wip_entity_id,
                                                                p_stmt_num          => l_stmt_num               ,
                                                                p_msg_tokens        => l_msg_tokens             ,
                                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                                p_run_log_level     => l_log_level
                                                                );
Line: 6950

                                INV_LOT_TRX_VALIDATION_PUB.update_item_serial( x_msg_count                      => x_error_count                                    ,
                                                                               x_return_status                  => x_return_status                                  ,
                                                                               x_msg_data                       => x_error_msg                                      ,
                                                                               x_validation_status              => l_validation_status                              ,
                                                                               p_org_id                         => p_organization_id                                ,
                                                                               p_item_id                        => p_starting_jobs_tbl(l_index).primary_item_id     ,
                                                                               p_to_item_id                     => l_inventory_item_id                              ,
                                                                               p_wip_entity_id                  => p_starting_jobs_tbl(l_index).wip_entity_id       ,
                                                                               p_to_wip_entity_id               => p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).wip_entity_id,
                                                                               p_to_operation_sequence          => l_curr_job_op_seq_num                            ,
                                                                               p_intraoperation_step_type       => l_curr_job_op_step
                                                                              );
Line: 6979

                                                l_msg_tokens.delete;
Line: 6981

                                                                        p_msg_text          => 'Invoking INV_LOT_TRX_VALIDATION_PUB.update_item_serial',
                                                                        p_stmt_num          => l_stmt_num               ,
                                                                        p_msg_tokens        => l_msg_tokens             ,
                                                                        p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                                        p_run_log_level     => l_log_level
                                                                        );
Line: 6989

                                        INV_LOT_TRX_VALIDATION_PUB.update_item_serial( x_msg_count                      => x_error_count                                    ,
                                                                                       x_return_status                  => x_return_status                                  ,
                                                                                       x_msg_data                       => x_error_msg                                      ,
                                                                                       x_validation_status              => l_validation_status                              ,
                                                                                       p_org_id                         => p_organization_id                                ,
                                                                                       p_item_id                        => l_inventory_item_id                              ,
                                                                                       p_to_item_id                     => l_inventory_item_id                              ,
                                                                                       p_wip_entity_id                  => l_wip_entity_id                                  ,
                                                                                       p_to_wip_entity_id               => p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).wip_entity_id,
                                                                                       p_to_operation_sequence          => l_curr_job_op_seq_num                            ,
                                                                                       p_intraoperation_step_type       => l_curr_job_op_step
                                                                                     );
Line: 7012

                                                update wip_discrete_jobs
                                                set    serialization_start_op = 10
                                                where  wip_entity_id in (select wip_entity_id
                                                                         from wsm_sm_resulting_jobs
                                                                         where transaction_id = p_txn_id);
Line: 7019

                                                update wsm_lot_based_jobs
                                                set    first_serial_txn_id = -1
                                                where  wip_entity_id in (select wip_entity_id
                                                                         from wsm_sm_resulting_jobs
                                                                         where transaction_id = p_txn_id);
Line: 7033

        ELSIF p_wlt_txn_type = WSMPCNST.UPDATE_ASSEMBLY THEN -- Update Assembly transaction

                l_stmt_num := 210;
Line: 7078

                                        l_msg_tokens.delete;
Line: 7100

                        l_msg_tokens.delete;
Line: 7102

                                                p_msg_text          => 'Invoking INV_LOT_TRX_VALIDATION_PUB.update_item_serial',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 7110

                INV_LOT_TRX_VALIDATION_PUB.update_item_serial( x_msg_count                      => x_error_count                                    ,
                                                               x_return_status                  => x_return_status                                  ,
                                                               x_msg_data                       => x_error_msg                                      ,
                                                               x_validation_status              => l_validation_status                              ,
                                                               p_org_id                         => p_organization_id                                ,
                                                               p_item_id                        => l_inventory_item_id                              ,
                                                               p_to_item_id                     => p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).primary_item_id  ,
                                                               p_wip_entity_id                  => l_wip_entity_id                                  ,
                                                               p_to_wip_entity_id               => l_wip_entity_id                                  ,
                                                               p_to_operation_sequence          => l_curr_job_op_seq_num                            ,
                                                               p_intraoperation_step_type       => l_curr_job_op_step
                                                             );
Line: 7132

                Insert_into_WST (   p_transaction_id             =>  p_txn_id                                                          ,
                                    p_transaction_type_id        =>  WSMPCNST.UPDATE_ASSEMBLY                                          ,
                                    p_old_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                    p_new_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                    p_wip_entity_id              =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_id      ,
                                    p_organization_id            =>  p_organization_id                                                 ,
                                    p_item_id                    =>  p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).primary_item_id  ,
                                    x_return_status              =>  x_return_status                                                   ,
                                    x_error_msg                  =>  x_error_msg                                                       ,
                                    x_error_count                =>  x_error_count
                                );
Line: 7152

        ELSIF p_wlt_txn_type = WSMPCNST.UPDATE_ROUTING THEN -- Update Routing transaction

                l_stmt_num := 250;
Line: 7158

                        l_msg_tokens.delete;
Line: 7160

                                                p_msg_text          => 'Invoking INV_LOT_TRX_VALIDATION_PUB.update_item_serial',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 7168

                INV_LOT_TRX_VALIDATION_PUB.update_item_serial( x_msg_count                      => x_error_count                                    ,
                                                               x_return_status                  => x_return_status                                  ,
                                                               x_msg_data                       => x_error_msg                                      ,
                                                               x_validation_status              => l_validation_status                              ,
                                                               p_org_id                         => p_organization_id                                ,
                                                               p_item_id                        => l_inventory_item_id                              ,
                                                               p_to_item_id                     => l_inventory_item_id                              ,
                                                               p_wip_entity_id                  => l_wip_entity_id                                  ,
                                                               p_to_wip_entity_id               => l_wip_entity_id                                  ,
                                                               p_to_operation_sequence          => l_curr_job_op_seq_num                            ,
                                                               p_intraoperation_step_type       => l_curr_job_op_step
                                                              );
Line: 7191

                Insert_into_WST (   p_transaction_id             =>  p_txn_id                                                          ,
                                    p_transaction_type_id        =>  WSMPCNST.UPDATE_ROUTING                                           ,
                                    p_old_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                    p_new_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                    p_wip_entity_id              =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_id      ,
                                    p_organization_id            =>  p_organization_id                                                 ,
                                    p_item_id                    =>  l_inventory_item_id                                               ,
                                    x_return_status              =>  x_return_status                                                   ,
                                    x_error_msg                  =>  x_error_msg                                                       ,
                                    x_error_count                =>  x_error_count
                                );
Line: 7211

        ELSIF p_wlt_txn_type = WSMPCNST.UPDATE_LOT_NAME THEN -- Update Lot Name transaction

                l_stmt_num := 270;
Line: 7214

                Insert_into_WST (   p_transaction_id             =>  p_txn_id                                                          ,
                                    p_transaction_type_id        =>  WSMPCNST.UPDATE_ROUTING                                           ,
                                    p_old_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                    p_new_wip_entity_name        =>  p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).wip_entity_name  ,
                                    p_wip_entity_id              =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_id      ,
                                    p_organization_id            =>  p_organization_id                                                 ,
                                    p_item_id                    =>  l_inventory_item_id                                               ,
                                    x_return_status              =>  x_return_status                                                   ,
                                    x_error_msg                  =>  x_error_msg                                                       ,
                                    x_error_count                =>  x_error_count
                                );
Line: 7234

        ELSIF p_wlt_txn_type = WSMPCNST.UPDATE_QUANTITY THEN -- Update Quantity transaction

                l_stmt_num := 280;
Line: 7246

                                        l_msg_tokens.delete;
Line: 7261

                                Insert_into_WST (   p_transaction_id             =>  p_txn_id                                                          ,
                                                    p_transaction_type_id        =>  WSMPCNST.UPDATE_QUANTITY                                          ,
                                                    p_old_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                                    p_new_wip_entity_name        =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_name    ,
                                                    p_wip_entity_id              =>  p_starting_jobs_tbl(p_starting_jobs_tbl.first).wip_entity_id      ,
                                                    p_organization_id            =>  p_organization_id                                                 ,
                                                    p_item_id                    =>  p_resulting_jobs_tbl(p_resulting_jobs_tbl.first).primary_item_id  ,
                                                    x_return_status              =>  x_return_status                                                   ,
                                                    x_error_msg                  =>  x_error_msg                                                       ,
                                                    x_error_count                =>  x_error_count
                                                );
Line: 7317

                select count(*)
                into   l_serial_num_count
                -- ST : Fix for bug 4910758 (remove usage of wsm_job_serial_numbers_v)
                -- from wsm_job_serial_numbers_v
                from   mtl_serial_numbers
                where  inventory_item_id = l_inventory_item_id
                and    wip_entity_id = l_wip_entity_id
                and    nvl(intraoperation_step_type,-1) <> 5;
Line: 7334

                                l_msg_tokens.delete;
Line: 7353

                                insert into wsm_serial_transactions
                                (transaction_id                          ,
                                 transaction_type_id                     ,
                                 serial_number                           ,
                                 gen_object_id                           ,
                                 current_wip_entity_name                 ,
                                 changed_wip_entity_name                 ,
                                 current_wip_entity_id                   ,
                                 changed_wip_entity_id                   ,
                                 created_by                              ,
                                 last_update_date                        ,
                                 last_updated_by                         ,
                                 creation_date                           ,
                                 last_update_login                       ,
                                 request_id                              ,
                                 program_application_id                  ,
                                 program_id                              ,
                                 program_update_date                     ,
                                 original_system_reference
                                )
                                select
                                 p_txn_id                               ,
                                 3                                      ,
                                 l_serial_tbl(l_cntr)                   ,
                                 gen_object_id                          ,
                                 null                                   ,
                                 l_wip_entity_name                      ,
                                 null                                   ,
                                 l_wip_entity_id                        ,
                                 g_user_id                               ,
                                 sysdate                                 ,
                                 g_user_id                               ,
                                 sysdate                                 ,
                                 g_user_login_id                         ,
                                 g_request_id                            ,
                                 g_program_appl_id                       ,
                                 g_program_id                            ,
                                 sysdate                                 ,
                                 null
                                 from mtl_serial_numbers
                                 where serial_number = l_serial_tbl(l_cntr)
                                 and   inventory_item_id = l_inventory_item_id
                                 and   current_organization_id = p_organization_id;
Line: 7401

                        insert into wsm_serial_transactions
                        (transaction_id                          ,
                         transaction_type_id                     ,
                         serial_number                           ,
                         gen_object_id                           ,
                         current_wip_entity_name                 ,
                         current_wip_entity_id                   ,
                         changed_wip_entity_name                 ,
                         changed_wip_entity_id                   ,
                         created_by                              ,
                         last_update_date                        ,
                         last_updated_by                         ,
                         creation_date                           ,
                         last_update_login                       ,
                         request_id                              ,
                         program_application_id                  ,
                         program_id                              ,
                         program_update_date                     ,
                         original_system_reference
                        )
                        select
                         p_txn_id                               ,
                         3                                      ,
                         serial_number                          ,
                         gen_object_id                          ,
                         l_wip_entity_name                      ,
                         l_wip_entity_id                        ,
                         l_wip_entity_name                      ,
                         l_wip_entity_id                        ,
                         g_user_id                              ,
                         sysdate                                ,
                         g_user_id                              ,
                         sysdate                                ,
                         g_user_login_id                        ,
                         g_request_id                           ,
                         g_program_appl_id                      ,
                         g_program_id                           ,
                         sysdate                                ,
                         null
                         from mtl_serial_numbers
                         where inventory_item_id = l_inventory_item_id
                         and   current_organization_id = p_organization_id
                         and   wip_entity_id = l_wip_entity_id
                         and   nvl(intraoperation_step_type,-1) <> 5
                         and   serial_number NOT IN (select serial_number
                                                     from wsm_serial_transactions
                                                     where transaction_type_id = 3
                                                     and   transaction_id = p_txn_id);
Line: 7525

        SELECT NVL(SERIAL_NUMBER_CONTROL_CODE,1)
        INTO   l_serial_cntrl_code
        FROM   MTL_SYSTEM_ITEMS
        WHERE  inventory_item_id = p_primary_item_id
        AND    organization_id   = p_organization_id;
Line: 7548

                        l_msg_tokens.delete;
Line: 7574

                        l_msg_tokens.delete;
Line: 7606

                        l_msg_tokens.delete;
Line: 7633

                        l_msg_tokens.delete;
Line: 7691

Procedure Insert_move_attr ( p_group_id         IN         NUMBER       DEFAULT NULL,
                             p_move_txn_id      IN         NUMBER       DEFAULT NULL,
                             p_scrap_txn_id     IN         NUMBER       DEFAULT NULL,
                             x_return_status    OUT NOCOPY VARCHAR2,
                             x_error_count      OUT NOCOPY NUMBER,
                             x_error_msg        OUT NOCOPY VARCHAR2
                           )

IS
-- Logging variables.....
l_msg_tokens        WSM_Log_PVT.token_rec_tbl;
Line: 7705

l_module            VARCHAR2(100) := 'wsm.plsql.WSM_SERIAL_SUPPORT_PVT.Insert_move_attr';
Line: 7719

                l_param_tbl.delete;
Line: 7742

                insert into wsm_serial_txn_interface
                (
                 HEADER_ID                              ,
                 TRANSACTION_TYPE_ID                    ,
                 SERIAL_NUMBER                          ,
                 ASSEMBLY_ITEM_ID                       ,
                 GENERATE_SERIAL_NUMBER                 ,
                 GENERATE_FOR_QTY                       ,
                 ACTION_FLAG                            ,
                 CURRENT_WIP_ENTITY_NAME                ,
                 CHANGED_WIP_ENTITY_NAME                ,
                 CURRENT_WIP_ENTITY_ID                  ,
                 CHANGED_WIP_ENTITY_ID                  ,
                 SERIAL_ATTRIBUTE_CATEGORY              ,
                 TERRITORY_CODE                         ,
                 ORIGINATION_DATE                       ,
                 C_ATTRIBUTE1                           ,
                 C_ATTRIBUTE2                           ,
                 C_ATTRIBUTE3                           ,
                 C_ATTRIBUTE4                           ,
                 C_ATTRIBUTE5                           ,
                 C_ATTRIBUTE6                           ,
                 C_ATTRIBUTE7                           ,
                 C_ATTRIBUTE8                           ,
                 C_ATTRIBUTE9                           ,
                 C_ATTRIBUTE10                          ,
                 C_ATTRIBUTE11                          ,
                 C_ATTRIBUTE12                          ,
                 C_ATTRIBUTE13                          ,
                 C_ATTRIBUTE14                          ,
                 C_ATTRIBUTE15                          ,
                 C_ATTRIBUTE16                          ,
                 C_ATTRIBUTE17                          ,
                 C_ATTRIBUTE18                          ,
                 C_ATTRIBUTE19                          ,
                 C_ATTRIBUTE20                          ,
                 D_ATTRIBUTE1                           ,
                 D_ATTRIBUTE2                           ,
                 D_ATTRIBUTE3                           ,
                 D_ATTRIBUTE4                           ,
                 D_ATTRIBUTE5                           ,
                 D_ATTRIBUTE6                           ,
                 D_ATTRIBUTE7                           ,
                 D_ATTRIBUTE8                           ,
                 D_ATTRIBUTE9                           ,
                 D_ATTRIBUTE10                          ,
                 N_ATTRIBUTE1                           ,
                 N_ATTRIBUTE2                           ,
                 N_ATTRIBUTE3                           ,
                 N_ATTRIBUTE4                           ,
                 N_ATTRIBUTE5                           ,
                 N_ATTRIBUTE6                           ,
                 N_ATTRIBUTE7                           ,
                 N_ATTRIBUTE8                           ,
                 N_ATTRIBUTE9                           ,
                 N_ATTRIBUTE10                          ,
                 STATUS_ID                              ,
                 TIME_SINCE_NEW                         ,
                 CYCLES_SINCE_NEW                       ,
                 TIME_SINCE_OVERHAUL                    ,
                 CYCLES_SINCE_OVERHAUL                  ,
                 TIME_SINCE_REPAIR                      ,
                 CYCLES_SINCE_REPAIR                    ,
                 TIME_SINCE_VISIT                       ,
                 CYCLES_SINCE_VISIT                     ,
                 TIME_SINCE_MARK                        ,
                 CYCLES_SINCE_MARK                      ,
                 NUMBER_OF_REPAIRS                      ,
                 ATTRIBUTE_CATEGORY                     ,
                 ATTRIBUTE1                             ,
                 ATTRIBUTE2                             ,
                 ATTRIBUTE3                             ,
                 ATTRIBUTE4                             ,
                 ATTRIBUTE5                             ,
                 ATTRIBUTE6                             ,
                 ATTRIBUTE7                             ,
                 ATTRIBUTE8                             ,
                 ATTRIBUTE9                             ,
                 ATTRIBUTE10                            ,
                 ATTRIBUTE11                            ,
                 ATTRIBUTE12                            ,
                 ATTRIBUTE13                            ,
                 ATTRIBUTE14                            ,
                 ATTRIBUTE15                            ,
                 CREATED_BY                             ,
                 LAST_UPDATE_DATE                       ,
                 LAST_UPDATED_BY                        ,
                 CREATION_DATE                          ,
                 LAST_UPDATE_LOGIN                      ,
                 REQUEST_ID                             ,
                 PROGRAM_APPLICATION_ID                 ,
                 PROGRAM_ID                             ,
                 PROGRAM_UPDATE_DATE                    ,
                 ORIGINAL_SYSTEM_REFERENCE
                )
                Select
                 WMTI.transaction_id                      ,
                 5                                        , -- for internal use... 5 for Attributes updation..
                 MSN.SERIAL_NUMBER                        ,
                 WMTI.primary_item_id                     ,
                 null                                     ,
                 null                                     ,
                 null                                     ,
                 null                                     ,
                 null                                     ,
                 WMTI.WIP_ENTITY_ID                       ,
                 null                                     ,
                 MSN.SERIAL_ATTRIBUTE_CATEGORY            ,
                 MSN.TERRITORY_CODE                       ,
                 MSN.ORIGINATION_DATE                     ,
                 MSN.C_ATTRIBUTE1                         ,
                 MSN.C_ATTRIBUTE2                         ,
                 MSN.C_ATTRIBUTE3                         ,
                 MSN.C_ATTRIBUTE4                         ,
                 MSN.C_ATTRIBUTE5                         ,
                 MSN.C_ATTRIBUTE6                         ,
                 MSN.C_ATTRIBUTE7                         ,
                 MSN.C_ATTRIBUTE8                         ,
                 MSN.C_ATTRIBUTE9                         ,
                 MSN.C_ATTRIBUTE10                        ,
                 MSN.C_ATTRIBUTE11                        ,
                 MSN.C_ATTRIBUTE12                        ,
                 MSN.C_ATTRIBUTE13                        ,
                 MSN.C_ATTRIBUTE14                        ,
                 MSN.C_ATTRIBUTE15                        ,
                 MSN.C_ATTRIBUTE16                        ,
                 MSN.C_ATTRIBUTE17                        ,
                 MSN.C_ATTRIBUTE18                        ,
                 MSN.C_ATTRIBUTE19                        ,
                 MSN.C_ATTRIBUTE20                        ,
                 MSN.D_ATTRIBUTE1                         ,
                 MSN.D_ATTRIBUTE2                         ,
                 MSN.D_ATTRIBUTE3                         ,
                 MSN.D_ATTRIBUTE4                         ,
                 MSN.D_ATTRIBUTE5                         ,
                 MSN.D_ATTRIBUTE6                         ,
                 MSN.D_ATTRIBUTE7                         ,
                 MSN.D_ATTRIBUTE8                         ,
                 MSN.D_ATTRIBUTE9                         ,
                 MSN.D_ATTRIBUTE10                        ,
                 MSN.N_ATTRIBUTE1                         ,
                 MSN.N_ATTRIBUTE2                         ,
                 MSN.N_ATTRIBUTE3                         ,
                 MSN.N_ATTRIBUTE4                         ,
                 MSN.N_ATTRIBUTE5                         ,
                 MSN.N_ATTRIBUTE6                         ,
                 MSN.N_ATTRIBUTE7                         ,
                 MSN.N_ATTRIBUTE8                         ,
                 MSN.N_ATTRIBUTE9                         ,
                 MSN.N_ATTRIBUTE10                        ,
                 MSN.STATUS_ID                            ,
                 MSN.TIME_SINCE_NEW                       ,
                 MSN.CYCLES_SINCE_NEW                     ,
                 MSN.TIME_SINCE_OVERHAUL                  ,
                 MSN.CYCLES_SINCE_OVERHAUL                ,
                 MSN.TIME_SINCE_REPAIR                    ,
                 MSN.CYCLES_SINCE_REPAIR                  ,
                 MSN.TIME_SINCE_VISIT                     ,
                 MSN.CYCLES_SINCE_VISIT                   ,
                 MSN.TIME_SINCE_MARK                      ,
                 MSN.CYCLES_SINCE_MARK                    ,
                 MSN.NUMBER_OF_REPAIRS                    ,
                 MSN.ATTRIBUTE_CATEGORY                   ,
                 MSN.ATTRIBUTE1                           ,
                 MSN.ATTRIBUTE2                           ,
                 MSN.ATTRIBUTE3                           ,
                 MSN.ATTRIBUTE4                           ,
                 MSN.ATTRIBUTE5                           ,
                 MSN.ATTRIBUTE6                           ,
                 MSN.ATTRIBUTE7                           ,
                 MSN.ATTRIBUTE8                           ,
                 MSN.ATTRIBUTE9                           ,
                 MSN.ATTRIBUTE10                          ,
                 MSN.ATTRIBUTE11                          ,
                 MSN.ATTRIBUTE12                          ,
                 MSN.ATTRIBUTE13                          ,
                 MSN.ATTRIBUTE14                          ,
                 MSN.ATTRIBUTE15                          ,
                 g_user_id                                ,
                 SYSDATE                                  ,
                 g_user_id                                ,
                 SYSDATE                                  ,
                 g_user_login_id                          ,
                 g_request_id                             ,
                 g_program_appl_id                        ,
                 g_program_id                             ,
                 sysdate                                  ,
                 null
                from wip_serial_move_interface WSMI,
                     mtl_serial_numbers        MSN,
                     wip_move_txn_interface    WMTI
                where WMTI.group_id = p_group_id
                and   WMTI.transaction_id = WSMI.transaction_id
                and   MSN.serial_number   = WSMI.assembly_serial_number
                and   MSN.current_organization_id = WMTI.organization_id
                and   MSN.inventory_item_id = WMTI.primary_item_id
                -- ST : Commenting it out...
                -- and   MSN.serial_attribute_category IS NOT NULL -- Desc flex fields are not cleared. Only serial attributes
                and   WMTI.transaction_type IN (2,3); -- Completion/Assembly return
Line: 7944

                        l_msg_tokens.delete;
Line: 7946

                                                p_msg_text          => 'Total Serial Numbers inserted : ' || SQL%ROWCOUNT,
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 7956

                insert into wsm_serial_txn_temp
                (
                 HEADER_ID                              ,
                 TRANSACTION_TYPE_ID                    ,
                 SERIAL_NUMBER                          ,
                 ASSEMBLY_ITEM_ID                       ,
                 GENERATE_SERIAL_NUMBER                 ,
                 GENERATE_FOR_QTY                       ,
                 ACTION_FLAG                            ,
                 CURRENT_WIP_ENTITY_NAME                ,
                 CHANGED_WIP_ENTITY_NAME                ,
                 CURRENT_WIP_ENTITY_ID                  ,
                 CHANGED_WIP_ENTITY_ID                  ,
                 SERIAL_ATTRIBUTE_CATEGORY              ,
                 TERRITORY_CODE                         ,
                 ORIGINATION_DATE                       ,
                 C_ATTRIBUTE1                           ,
                 C_ATTRIBUTE2                           ,
                 C_ATTRIBUTE3                           ,
                 C_ATTRIBUTE4                           ,
                 C_ATTRIBUTE5                           ,
                 C_ATTRIBUTE6                           ,
                 C_ATTRIBUTE7                           ,
                 C_ATTRIBUTE8                           ,
                 C_ATTRIBUTE9                           ,
                 C_ATTRIBUTE10                          ,
                 C_ATTRIBUTE11                          ,
                 C_ATTRIBUTE12                          ,
                 C_ATTRIBUTE13                          ,
                 C_ATTRIBUTE14                          ,
                 C_ATTRIBUTE15                          ,
                 C_ATTRIBUTE16                          ,
                 C_ATTRIBUTE17                          ,
                 C_ATTRIBUTE18                          ,
                 C_ATTRIBUTE19                          ,
                 C_ATTRIBUTE20                          ,
                 D_ATTRIBUTE1                           ,
                 D_ATTRIBUTE2                           ,
                 D_ATTRIBUTE3                           ,
                 D_ATTRIBUTE4                           ,
                 D_ATTRIBUTE5                           ,
                 D_ATTRIBUTE6                           ,
                 D_ATTRIBUTE7                           ,
                 D_ATTRIBUTE8                           ,
                 D_ATTRIBUTE9                           ,
                 D_ATTRIBUTE10                          ,
                 N_ATTRIBUTE1                           ,
                 N_ATTRIBUTE2                           ,
                 N_ATTRIBUTE3                           ,
                 N_ATTRIBUTE4                           ,
                 N_ATTRIBUTE5                           ,
                 N_ATTRIBUTE6                           ,
                 N_ATTRIBUTE7                           ,
                 N_ATTRIBUTE8                           ,
                 N_ATTRIBUTE9                           ,
                 N_ATTRIBUTE10                          ,
                 STATUS_ID                              ,
                 TIME_SINCE_NEW                         ,
                 CYCLES_SINCE_NEW                       ,
                 TIME_SINCE_OVERHAUL                    ,
                 CYCLES_SINCE_OVERHAUL                  ,
                 TIME_SINCE_REPAIR                      ,
                 CYCLES_SINCE_REPAIR                    ,
                 TIME_SINCE_VISIT                       ,
                 CYCLES_SINCE_VISIT                     ,
                 TIME_SINCE_MARK                        ,
                 CYCLES_SINCE_MARK                      ,
                 NUMBER_OF_REPAIRS                      ,
                 ATTRIBUTE_CATEGORY                     ,
                 ATTRIBUTE1                             ,
                 ATTRIBUTE2                             ,
                 ATTRIBUTE3                             ,
                 ATTRIBUTE4                             ,
                 ATTRIBUTE5                             ,
                 ATTRIBUTE6                             ,
                 ATTRIBUTE7                             ,
                 ATTRIBUTE8                             ,
                 ATTRIBUTE9                             ,
                 ATTRIBUTE10                            ,
                 ATTRIBUTE11                            ,
                 ATTRIBUTE12                            ,
                 ATTRIBUTE13                            ,
                 ATTRIBUTE14                            ,
                 ATTRIBUTE15                            ,
                 CREATED_BY                             ,
                 LAST_UPDATE_DATE                       ,
                 LAST_UPDATED_BY                        ,
                 CREATION_DATE                          ,
                 LAST_UPDATE_LOGIN                      ,
                 REQUEST_ID                             ,
                 PROGRAM_APPLICATION_ID                 ,
                 PROGRAM_ID                             ,
                 PROGRAM_UPDATE_DATE                    ,
                 ORIGINAL_SYSTEM_REFERENCE
                )
                Select
                 WMTI.transaction_id                      ,
                 5                                        , -- for internal use... 5 for Attributes updation..
                 MSN.SERIAL_NUMBER                        ,
                 WMTI.primary_item_id                     ,
                 null                                     ,
                 null                                     ,
                 null                                     ,
                 null                                     ,
                 null                                     ,
                 WMTI.WIP_ENTITY_ID                       ,
                 null                                     ,
                 MSN.SERIAL_ATTRIBUTE_CATEGORY            ,
                 MSN.TERRITORY_CODE                       ,
                 MSN.ORIGINATION_DATE                     ,
                 MSN.C_ATTRIBUTE1                         ,
                 MSN.C_ATTRIBUTE2                         ,
                 MSN.C_ATTRIBUTE3                         ,
                 MSN.C_ATTRIBUTE4                         ,
                 MSN.C_ATTRIBUTE5                         ,
                 MSN.C_ATTRIBUTE6                         ,
                 MSN.C_ATTRIBUTE7                         ,
                 MSN.C_ATTRIBUTE8                         ,
                 MSN.C_ATTRIBUTE9                         ,
                 MSN.C_ATTRIBUTE10                        ,
                 MSN.C_ATTRIBUTE11                        ,
                 MSN.C_ATTRIBUTE12                        ,
                 MSN.C_ATTRIBUTE13                        ,
                 MSN.C_ATTRIBUTE14                        ,
                 MSN.C_ATTRIBUTE15                        ,
                 MSN.C_ATTRIBUTE16                        ,
                 MSN.C_ATTRIBUTE17                        ,
                 MSN.C_ATTRIBUTE18                        ,
                 MSN.C_ATTRIBUTE19                        ,
                 MSN.C_ATTRIBUTE20                        ,
                 MSN.D_ATTRIBUTE1                         ,
                 MSN.D_ATTRIBUTE2                         ,
                 MSN.D_ATTRIBUTE3                         ,
                 MSN.D_ATTRIBUTE4                         ,
                 MSN.D_ATTRIBUTE5                         ,
                 MSN.D_ATTRIBUTE6                         ,
                 MSN.D_ATTRIBUTE7                         ,
                 MSN.D_ATTRIBUTE8                         ,
                 MSN.D_ATTRIBUTE9                         ,
                 MSN.D_ATTRIBUTE10                        ,
                 MSN.N_ATTRIBUTE1                         ,
                 MSN.N_ATTRIBUTE2                         ,
                 MSN.N_ATTRIBUTE3                         ,
                 MSN.N_ATTRIBUTE4                         ,
                 MSN.N_ATTRIBUTE5                         ,
                 MSN.N_ATTRIBUTE6                         ,
                 MSN.N_ATTRIBUTE7                         ,
                 MSN.N_ATTRIBUTE8                         ,
                 MSN.N_ATTRIBUTE9                         ,
                 MSN.N_ATTRIBUTE10                        ,
                 MSN.STATUS_ID                            ,
                 MSN.TIME_SINCE_NEW                       ,
                 MSN.CYCLES_SINCE_NEW                     ,
                 MSN.TIME_SINCE_OVERHAUL                  ,
                 MSN.CYCLES_SINCE_OVERHAUL                ,
                 MSN.TIME_SINCE_REPAIR                    ,
                 MSN.CYCLES_SINCE_REPAIR                  ,
                 MSN.TIME_SINCE_VISIT                     ,
                 MSN.CYCLES_SINCE_VISIT                   ,
                 MSN.TIME_SINCE_MARK                      ,
                 MSN.CYCLES_SINCE_MARK                    ,
                 MSN.NUMBER_OF_REPAIRS                    ,
                 MSN.ATTRIBUTE_CATEGORY                   ,
                 MSN.ATTRIBUTE1                           ,
                 MSN.ATTRIBUTE2                           ,
                 MSN.ATTRIBUTE3                           ,
                 MSN.ATTRIBUTE4                           ,
                 MSN.ATTRIBUTE5                           ,
                 MSN.ATTRIBUTE6                           ,
                 MSN.ATTRIBUTE7                           ,
                 MSN.ATTRIBUTE8                           ,
                 MSN.ATTRIBUTE9                           ,
                 MSN.ATTRIBUTE10                          ,
                 MSN.ATTRIBUTE11                          ,
                 MSN.ATTRIBUTE12                          ,
                 MSN.ATTRIBUTE13                          ,
                 MSN.ATTRIBUTE14                          ,
                 MSN.ATTRIBUTE15                          ,
                 g_user_id                                ,
                 SYSDATE                                  ,
                 g_user_id                                ,
                 SYSDATE                                  ,
                 g_user_login_id                          ,
                 g_request_id                             ,
                 g_program_appl_id                        ,
                 g_program_id                             ,
                 sysdate                                  ,
                 null
                from wip_serial_move_interface WSMI,
                     mtl_serial_numbers        MSN,
                     wip_move_txn_interface    WMTI
                where WMTI.transaction_id in (p_move_txn_id,p_scrap_txn_id)
                and   WMTI.transaction_id = WSMI.transaction_id
                and   MSN.serial_number   = WSMI.assembly_serial_number
                and   MSN.current_organization_id = WMTI.organization_id
                and   MSN.inventory_item_id = WMTI.primary_item_id
                -- ST : Commenting it out...
                -- and   MSN.serial_attribute_category IS NOT NULL -- Desc flex fields are not cleared. Only serial attributes
                and   WMTI.transaction_type IN (2,3); -- Completion/Assembly return
Line: 8158

                        l_msg_tokens.delete;
Line: 8160

                                                p_msg_text          => 'Total Serial Numbers inserted : ' || SQL%ROWCOUNT,
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 8169

END Insert_move_attr;
Line: 8172

Procedure Update_attr_move ( p_group_id                  IN         NUMBER      DEFAULT NULL,  -- for interface...
                             p_internal_group_id         IN         NUMBER      DEFAULT NULL,  -- for interface...
                             p_move_txn_id               IN         NUMBER      DEFAULT NULL,  -- for forms...
                             p_scrap_txn_id              IN         NUMBER      DEFAULT NULL,  -- for forms...
                             p_organization_id           IN         NUMBER      ,
                             x_return_status             OUT NOCOPY VARCHAR2    ,
                             x_error_count               OUT NOCOPY NUMBER      ,
                             x_error_msg                 OUT NOCOPY VARCHAR2
                           )

IS
        -- This cursor fetches the serials whose op info need to be cleared...but havent been cleared by WIP
        -- Possible when the serial tracking doesnt start with the move tranaction's from op seq num as 10 and step as Queue
        -- This is because we fill the serial start op as 10 always in WDJ
        -- So the reverse doesnt happen (ie) WIP clears the op info when it has to be present as there is
        -- no possible step prior to 10 Queue
        -- Or it is also possible if a pure scrap transaction triggered the serial tracking.
        cursor c_serials_intf is
        select msn.serial_number,
               msn.inventory_item_id,
               msn.current_organization_id,
               wmt.wip_entity_id
        from   mtl_serial_numbers msn,
               wip_move_transactions wmt,
               wsm_lot_move_txn_interface wlmti,
               wsm_lot_based_jobs wlbj
        where  wlmti.group_id = p_group_id
        and    wlmti.internal_group_id = p_internal_group_id
        and    wlmti.wip_entity_id = wmt.wip_entity_id
        and    wmt.group_id = p_internal_group_id
        and    wlmti.status = WIP_CONSTANTS.COMPLETED
        and    wmt.wip_entity_id = wlbj.wip_entity_id
        and    wlbj.first_serial_txn_id IS NULL
        and    msn.inventory_item_id = wmt.primary_item_id
        and    msn.current_organization_id = wmt.organization_id
        and    msn.wip_entity_id = wmt.wip_entity_id
        and    msn.operation_seq_num IS NOT NULL;
Line: 8212

        select msn.serial_number,
               msn.inventory_item_id,
               msn.current_organization_id,
               wdj.wip_entity_id
        from   mtl_serial_numbers msn,
               wsm_lot_move_txn_interface wlmti,
               wip_discrete_jobs wdj,
               wsm_lot_based_jobs wlbj
        where  wlmti.group_id = p_group_id
        and    wlmti.internal_group_id = p_internal_group_id
        and    wlmti.wip_entity_id = wdj.wip_entity_id
        and    wlmti.status = WIP_CONSTANTS.COMPLETED
        and    wdj.wip_entity_id = wlbj.wip_entity_id
        and    wlbj.first_serial_txn_id = -1 -- It will be set to -1 only for those jobs created through Lot Creation form..
        and    msn.inventory_item_id = wdj.primary_item_id
        and    msn.current_organization_id = wdj.organization_id
        and    msn.wip_entity_id = wdj.wip_entity_id
        and    msn.operation_seq_num IS NULL; -- This will be set when the jobs created Lot Creation reach operation 10..
Line: 8235

        select msn.serial_number,
               msn.inventory_item_id,
               msn.current_organization_id,
               wmt.wip_entity_id
        from   mtl_serial_numbers msn,
               wip_move_transactions wmt,
               wsm_lot_based_jobs wlbj
        where  wmt.transaction_id in (p_move_txn_id, p_scrap_txn_id)
        and    wmt.wip_entity_id = wlbj.wip_entity_id
        and    wlbj.first_serial_txn_id IS NULL
        and    msn.inventory_item_id = wmt.primary_item_id
        and    msn.current_organization_id = wmt.organization_id
        and    msn.wip_entity_id = wmt.wip_entity_id
        and    msn.operation_seq_num IS NOT NULL;
Line: 8252

        select msn.serial_number,
               msn.inventory_item_id,
               msn.current_organization_id,
               wmt.wip_entity_id
        from   mtl_serial_numbers msn,
               wip_move_transactions wmt,
               wip_serial_move_transactions wsmt,
               wsm_lot_based_jobs wlbj
        where  wmt.transaction_id in (p_move_txn_id, p_scrap_txn_id)
        and    wmt.wip_entity_id = wlbj.wip_entity_id
        and    wmt.transaction_id = wsmt.transaction_id
        and    wlbj.first_serial_txn_id = -1 -- It will be set to -1 only for those jobs created through Lot Creation form..
        and    msn.serial_number = wsmt.assembly_serial_number
        and    msn.inventory_item_id = wmt.primary_item_id
        and    msn.current_organization_id = wmt.organization_id
        and    msn.wip_entity_id = wmt.wip_entity_id
        and    msn.operation_seq_num IS NULL;
Line: 8273

        select
        Serial_Number                   ,
        assembly_item_id                ,  -- assembly_item_id
        header_id                       ,  -- header_id
        Generate_serial_number          ,
        Generate_for_qty                ,
        Action_flag                     ,
        Current_wip_entity_name         ,
        Changed_wip_entity_name         ,
        Current_wip_entity_id           ,
        Changed_wip_entity_id           ,
        serial_attribute_category       ,
        territory_code                  ,
        origination_date                ,
        c_attribute1                    ,
        c_attribute2                    ,
        c_attribute3                    ,
        c_attribute4                    ,
        c_attribute5                    ,
        c_attribute6                    ,
        c_attribute7                    ,
        c_attribute8                    ,
        c_attribute9                    ,
        c_attribute10                   ,
        c_attribute11                   ,
        c_attribute12                   ,
        c_attribute13                   ,
        c_attribute14                   ,
        c_attribute15                   ,
        c_attribute16                   ,
        c_attribute17                   ,
        c_attribute18                   ,
        c_attribute19                   ,
        c_attribute20                   ,
        d_attribute1                    ,
        d_attribute2                    ,
        d_attribute3                    ,
        d_attribute4                    ,
        d_attribute5                    ,
        d_attribute6                    ,
        d_attribute7                    ,
        d_attribute8                    ,
        d_attribute9                    ,
        d_attribute10                   ,
        n_attribute1                    ,
        n_attribute2                    ,
        n_attribute3                    ,
        n_attribute4                    ,
        n_attribute5                    ,
        n_attribute6                    ,
        n_attribute7                    ,
        n_attribute8                    ,
        n_attribute9                    ,
        n_attribute10                   ,
        status_id                       ,
        time_since_new                  ,
        cycles_since_new                ,
        time_since_overhaul             ,
        cycles_since_overhaul           ,
        time_since_repair               ,
        cycles_since_repair             ,
        time_since_visit                ,
        cycles_since_visit              ,
        time_since_mark                 ,
        cycles_since_mark               ,
        number_of_repairs               ,
        attribute_category              ,
        attribute1                      ,
        attribute2                      ,
        attribute3                      ,
        attribute4                      ,
        attribute5                      ,
        attribute6                      ,
        attribute7                      ,
        attribute8                      ,
        attribute9                      ,
        attribute10                     ,
        attribute11                     ,
        attribute12                     ,
        attribute13                     ,
        attribute14                     ,
        attribute15
        from wsm_serial_txn_interface wsti
        where header_id IN (Select wmt.transaction_id
                            from   wip_move_transactions wmt,
                                   wsm_lot_move_txn_interface wlmti
                            where  wlmti.group_id = p_group_id
                            and    wlmti.internal_group_id = p_internal_group_id
                            and    wlmti.wip_entity_id = wmt.wip_entity_id
                            and    wlmti.status = WIP_CONSTANTS.COMPLETED
                            )
        and transaction_type_id = 5;
Line: 8368

        select
        Serial_Number                   ,
        assembly_item_id                ,  -- assembly_item_id
        header_id                       ,  -- header_id
        Generate_serial_number          ,
        Generate_for_qty                ,
        Action_flag                     ,
        Current_wip_entity_name         ,
        Changed_wip_entity_name         ,
        Current_wip_entity_id           ,
        Changed_wip_entity_id           ,
        serial_attribute_category       ,
        territory_code                  ,
        origination_date                ,
        c_attribute1                    ,
        c_attribute2                    ,
        c_attribute3                    ,
        c_attribute4                    ,
        c_attribute5                    ,
        c_attribute6                    ,
        c_attribute7                    ,
        c_attribute8                    ,
        c_attribute9                    ,
        c_attribute10                   ,
        c_attribute11                   ,
        c_attribute12                   ,
        c_attribute13                   ,
        c_attribute14                   ,
        c_attribute15                   ,
        c_attribute16                   ,
        c_attribute17                   ,
        c_attribute18                   ,
        c_attribute19                   ,
        c_attribute20                   ,
        d_attribute1                    ,
        d_attribute2                    ,
        d_attribute3                    ,
        d_attribute4                    ,
        d_attribute5                    ,
        d_attribute6                    ,
        d_attribute7                    ,
        d_attribute8                    ,
        d_attribute9                    ,
        d_attribute10                   ,
        n_attribute1                    ,
        n_attribute2                    ,
        n_attribute3                    ,
        n_attribute4                    ,
        n_attribute5                    ,
        n_attribute6                    ,
        n_attribute7                    ,
        n_attribute8                    ,
        n_attribute9                    ,
        n_attribute10                   ,
        status_id                       ,
        time_since_new                  ,
        cycles_since_new                ,
        time_since_overhaul             ,
        cycles_since_overhaul           ,
        time_since_repair               ,
        cycles_since_repair             ,
        time_since_visit                ,
        cycles_since_visit              ,
        time_since_mark                 ,
        cycles_since_mark               ,
        number_of_repairs               ,
        attribute_category              ,
        attribute1                      ,
        attribute2                      ,
        attribute3                      ,
        attribute4                      ,
        attribute5                      ,
        attribute6                      ,
        attribute7                      ,
        attribute8                      ,
        attribute9                      ,
        attribute10                     ,
        attribute11                     ,
        attribute12                     ,
        attribute13                     ,
        attribute14                     ,
        attribute15
        from wsm_serial_txn_temp wsti
        where header_id IN (p_move_txn_id, p_scrap_txn_id)
        and transaction_type_id = 5;
Line: 8477

l_module            VARCHAR2(100) := 'wsm.plsql.WSM_SERIAL_SUPPORT_PVT.update_attr_move';
Line: 8489

                l_param_tbl.delete;
Line: 8527

                                l_msg_tokens.delete;
Line: 8548

                                update_serial(   p_serial_number                =>  l_serial_info_tbl(l_cntr).serial_number         ,
                                                 p_inventory_item_id            =>  l_serial_info_tbl(l_cntr).inventory_item_id     ,
                                                 p_organization_id              =>  l_serial_info_tbl(l_cntr).organization_id       ,
                                                 p_wip_entity_id                =>  l_serial_info_tbl(l_cntr).wip_entity_id         ,
                                                 p_operation_seq_num            =>  null                                            ,
                                                 p_intraoperation_step_type     =>  null                                            ,
                                                 x_return_status                =>  x_return_status                                 ,
                                                 x_error_msg                    =>  x_error_msg                                     ,
                                                 x_error_count                  =>  x_error_count
                                              );
Line: 8582

                        l_msg_tokens.delete;
Line: 8598

                        update_serial(   p_serial_number                =>  l_serial_info_tbl(l_cntr).serial_number         ,
                                         p_inventory_item_id            =>  l_serial_info_tbl(l_cntr).inventory_item_id     ,
                                         p_organization_id              =>  l_serial_info_tbl(l_cntr).organization_id       ,
                                         p_wip_entity_id                =>  l_serial_info_tbl(l_cntr).wip_entity_id         ,
                                         p_operation_seq_num            =>  null                                            ,
                                         p_intraoperation_step_type     =>  null                                            ,
                                         x_return_status                =>  x_return_status                                 ,
                                         x_error_msg                    =>  x_error_msg                                     ,
                                         x_error_count                  =>  x_error_count
                                      );
Line: 8642

                                l_msg_tokens.delete;
Line: 8663

                                update_serial(   p_serial_number                =>  l_serial_info_tbl(l_cntr).serial_number         ,
                                                 p_inventory_item_id            =>  l_serial_info_tbl(l_cntr).inventory_item_id     ,
                                                 p_organization_id              =>  l_serial_info_tbl(l_cntr).organization_id       ,
                                                 p_wip_entity_id                =>  l_serial_info_tbl(l_cntr).wip_entity_id         ,
                                                 p_operation_seq_num            =>  10                                              ,
                                                 p_intraoperation_step_type     =>  WIP_CONSTANTS.QUEUE                             ,
                                                 x_return_status                =>  x_return_status                                 ,
                                                 x_error_msg                    =>  x_error_msg                                     ,
                                                 x_error_count                  =>  x_error_count
                                              );
Line: 8697

                        l_msg_tokens.delete;
Line: 8713

                        update_serial(   p_serial_number                =>  l_serial_info_tbl(l_cntr).serial_number         ,
                                         p_inventory_item_id            =>  l_serial_info_tbl(l_cntr).inventory_item_id     ,
                                         p_organization_id              =>  l_serial_info_tbl(l_cntr).organization_id       ,
                                         p_wip_entity_id                =>  l_serial_info_tbl(l_cntr).wip_entity_id         ,
                                         p_operation_seq_num            =>  10                                              ,
                                         p_intraoperation_step_type     =>  WIP_CONSTANTS.QUEUE                             ,
                                         x_return_status                =>  x_return_status                                 ,
                                         x_error_msg                    =>  x_error_msg                                     ,
                                         x_error_count                  =>  x_error_count
                                      );
Line: 8754

                                l_msg_tokens.delete;
Line: 8774

                                update_serial_attr (   p_calling_mode           =>  1                                                                 ,
                                                       p_serial_number_rec      =>  l_wsm_serial_attrs_tbl(l_cntr)                                    ,
                                                       p_inventory_item_id      =>  l_wsm_serial_attrs_tbl(l_cntr).assembly_item_id                   ,
                                                       p_organization_id        =>  nvl(p_organization_id,l_wsm_serial_attrs_tbl(l_cntr).action_flag) ,
                                                       p_clear_serial_attr      =>  null                                                              ,
                                                       p_wlt_txn_type           =>  null                                                              ,
                                                       p_update_serial_attr     =>  1                                                                 ,
                                                       p_update_desc_attr       =>  null                                                              ,
                                                       x_return_status          =>  x_return_status                                                   ,
                                                       x_error_count            =>  x_error_count                                                     ,
                                                       x_error_msg              =>  x_error_msg
                                                   );
Line: 8805

                                delete from wsm_serial_txn_interface
                                where  header_id = l_serial_txn_tbl(l_header)
                                and    transaction_type_id = 5;
Line: 8819

                        l_msg_tokens.delete;
Line: 8837

                        update_serial_attr (   p_calling_mode           =>  2                                                  ,
                                               p_serial_number_rec      =>  l_wsm_serial_attrs_tbl(l_cntr)                     ,
                                               p_inventory_item_id      =>  l_wsm_serial_attrs_tbl(l_cntr).assembly_item_id    ,
                                               p_organization_id        =>  p_organization_id                                  ,
                                               p_clear_serial_attr      =>  null                                               ,
                                               p_wlt_txn_type           =>  null                                               ,
                                               p_update_serial_attr     =>  1                                                  ,
                                               p_update_desc_attr       =>  null                                               ,
                                               x_return_status          =>  x_return_status                                    ,
                                               x_error_count            =>  x_error_count                                      ,
                                               x_error_msg              =>  x_error_msg
                                           );
Line: 8863

                delete from wsm_serial_txn_temp
                where  header_id IN (p_move_txn_id,p_scrap_txn_id)
                and    transaction_type_id = 5;
Line: 8868

                        l_msg_tokens.delete;
Line: 8870

                                                p_msg_text          => 'Deleted ' || SQL%ROWCOUNT || ' records inserted for attributes reason',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 8881

                l_msg_tokens.delete;
Line: 8927

END Update_attr_move;
Line: 9009

        select
        Serial_Number                   ,
        gen_object_id                   ,  -- (Gen_object_id --> assembly_item_id No longer used Instead the column will have gen_object_id)
        header_id                       ,  -- header_id
        Generate_serial_number          ,
        Generate_for_qty                ,
        Action_flag                     ,
        Current_wip_entity_name         ,
        Changed_wip_entity_name         ,
        Current_wip_entity_id           ,
        Changed_wip_entity_id           ,
        serial_attribute_category       ,
        territory_code                  ,
        origination_date                ,
        c_attribute1                    ,
        c_attribute2                    ,
        c_attribute3                    ,
        c_attribute4                    ,
        c_attribute5                    ,
        c_attribute6                    ,
        c_attribute7                    ,
        c_attribute8                    ,
        c_attribute9                    ,
        c_attribute10                   ,
        c_attribute11                   ,
        c_attribute12                   ,
        c_attribute13                   ,
        c_attribute14                   ,
        c_attribute15                   ,
        c_attribute16                   ,
        c_attribute17                   ,
        c_attribute18                   ,
        c_attribute19                   ,
        c_attribute20                   ,
        d_attribute1                    ,
        d_attribute2                    ,
        d_attribute3                    ,
        d_attribute4                    ,
        d_attribute5                    ,
        d_attribute6                    ,
        d_attribute7                    ,
        d_attribute8                    ,
        d_attribute9                    ,
        d_attribute10                   ,
        n_attribute1                    ,
        n_attribute2                    ,
        n_attribute3                    ,
        n_attribute4                    ,
        n_attribute5                    ,
        n_attribute6                    ,
        n_attribute7                    ,
        n_attribute8                    ,
        n_attribute9                    ,
        n_attribute10                   ,
        status_id                       ,
        time_since_new                  ,
        cycles_since_new                ,
        time_since_overhaul             ,
        cycles_since_overhaul           ,
        time_since_repair               ,
        cycles_since_repair             ,
        time_since_visit                ,
        cycles_since_visit              ,
        time_since_mark                 ,
        cycles_since_mark               ,
        number_of_repairs               ,
        attribute_category              ,
        attribute1                      ,
        attribute2                      ,
        attribute3                      ,
        attribute4                      ,
        attribute5                      ,
        attribute6                      ,
        attribute7                      ,
        attribute8                      ,
        attribute9                      ,
        attribute10                     ,
        attribute11                     ,
        attribute12                     ,
        attribute13                     ,
        attribute14                     ,
        attribute15
        from wsm_serial_txn_temp
        where header_id = p_move_txn_id
        and transaction_type_id = 2
        and action_flag IN (5,6); -- select the move/scrap
Line: 9117

                l_msg_tokens.delete;
Line: 9160

                        l_msg_tokens.delete;
Line: 9170

                select  max(wmt.transaction_id)
                into    l_old_move_txn_id
                from    wip_move_transactions wmt
                where   wmt.organization_id = p_organization_id
                and     wmt.wip_entity_id = p_wip_entity_id
                and     wmt.wsm_undo_txn_id IS NULL
                and     wmt.transaction_id = wmt.batch_id;
Line: 9179

                         select max(transaction_id)
                         into   l_old_scrap_txn_id
                         from   wip_move_transactions
                         where  organization_id = p_organization_id
                         and    wip_entity_id = p_wip_entity_id
                         and    batch_id = l_old_move_txn_id
                         and    transaction_id <> batch_id;
Line: 9193

                l_msg_tokens.delete;
Line: 9238

                        l_msg_tokens.delete;
Line: 9240

                                                p_msg_text          => 'Invoking WSM_Serial_support_PVT.Insert_move_attr',
                                                p_stmt_num          => l_stmt_num               ,
                                                p_msg_tokens        => l_msg_tokens             ,
                                                p_fnd_log_level     => G_LOG_LEVEL_STATEMENT    ,
                                                p_run_log_level     => l_log_level
                                                );
Line: 9249

                WSM_Serial_support_PVT.Insert_move_attr ( p_group_id            => null                         ,
                                                          p_move_txn_id         => p_move_txn_id                ,
                                                          p_scrap_txn_id        => p_scrap_txn_id               ,
                                                          x_return_status       => x_return_status              ,
                                                          x_error_count         => x_error_count                ,
                                                          x_error_msg           => x_error_msg
                                                         );
Line: 9267

                l_msg_tokens.delete;
Line: 9351

                l_param_tbl.delete;
Line: 9376

                        l_message_tbl.delete;