DBA Data[Home] [Help]

APPS.GME_BATCHSTEP_RSRC_PVT SQL Statements

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

Line: 7

 * Contents INSERT RESOURCE                                      *
 *          UPDATE RESOURCE                                      *
 *          DELETE RESOURCE                                      *
 *                                                               *
 * Use      This is the private layer of the GME Batch Step      *
 *          Resources.                                           *
 *                                                               *
 * History                                                       *
 *          K.Y.Hunt                                             *
 *          Reworked for Inventory Convergence.   02-APR-2005    *
 * Pawan Kumar 	10-Oct-2005 Bug-4175041		                 *
 * Added the interdependency validation for the resource count   *
 * and resource usage in update_batchstep_resource procedure     *

   G. Muratore    15-APR-2009  Bug 8335046
      Update the last_update_date for locking issues at the step level.
      PROCEDURE: update_batchstep_rsrc

   G. Muratore    16-MAY-2012  Bug 14037157
      Initialize variables properly so that UPDATE action works correctly.
      PROCEDURE: validate_rsrc_param
 *****************************************************************
*/
/*  Global variables   */
   g_pkg_name   CONSTANT VARCHAR2 (30) := 'GME_BATCHSTEP_RSRC_PVT';
Line: 73

         SELECT bh.organization_id, bh.batch_id, bh.batch_type
           FROM gme_batch_header bh, mtl_parameters mp
          WHERE mp.organization_code = v_organization_code
            AND mp.organization_id = bh.organization_id
            AND bh.batch_no = v_batch_no
            AND batch_type = 0;
Line: 82

         SELECT batchstep_id, step_status
           FROM gme_batch_steps
          WHERE batch_id = v_batch_id AND batchstep_no = v_batchstep_no;
Line: 91

         SELECT batchstep_activity_id
           FROM gme_batch_step_activities
          WHERE batchstep_id = v_step_id
            AND batch_id = v_batch_id
            AND activity = v_activity;
Line: 99

         SELECT batchstep_resource_id
           FROM gme_batch_step_resources
          WHERE batchstep_activity_id = v_activity_id
            AND resources = v_resource;
Line: 312

        Initialize variables properly so that UPDATE action works correctly.
=============================================================================================*/
   PROCEDURE validate_rsrc_param (
      p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_activity_id              IN              NUMBER
     ,p_ignore_qty_below_cap     IN              VARCHAR2
            DEFAULT fnd_api.g_false
     ,p_validate_flexfield       IN              VARCHAR2
            DEFAULT fnd_api.g_false
     ,p_action                   IN              VARCHAR2
     ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_step_status              OUT NOCOPY      NUMBER
     ,x_return_status            OUT NOCOPY      VARCHAR2)
   IS
      l_api_name            CONSTANT VARCHAR2 (30)   := 'validate_rsrc_param';
Line: 335

      l_field_updated                BOOLEAN                         := FALSE;
Line: 346

         SELECT a.step_status, a.batch_id, a.step_qty_um
           FROM gme_batch_steps a, gme_batch_step_activities b
          WHERE b.batchstep_activity_id = v_act_id
            AND a.batch_id = b.batch_id
            AND a.batchstep_id = b.batchstep_id;
Line: 354

         SELECT DECODE (v_status
                       ,1, plan_activity_factor
                       ,actual_activity_factor)
               ,plan_start_date, plan_cmplt_date, actual_start_date
               ,actual_cmplt_date
           FROM gme_batch_step_activities
          WHERE batchstep_activity_id = v_activity_id;
Line: 364

         SELECT plan_start_date, plan_cmplt_date
           FROM gme_batch_step_activities
          WHERE batchstep_activity_id = v_activity_id;
Line: 370

         SELECT automatic_step_calculation
           FROM gme_batch_header
          WHERE batch_id = v_batch_id;
Line: 376

         SELECT 1
           FROM cm_cmpt_mst
          WHERE cost_cmpntcls_id = v_cost_cmpntcls_id;
Line: 382

         SELECT 1
           FROM cm_alys_mst
          WHERE cost_analysis_code = v_cost_analysis_code;
Line: 425

      IF p_action = 'INSERT' THEN
         /* Validations for Insert processing */
         --check analysis code
         IF g_debug <= gme_debug.g_log_procedure THEN
            gme_debug.put_line (   g_pkg_name
                                || '.'
                                || l_api_name
                                || ' validate cost analysis code '
                                || p_batchstep_resource_rec.cost_analysis_code);
Line: 924

         /* Additional Validations for action INSERT */
         IF l_batchstep_resource_rec.offset_interval IS NULL THEN
            l_batchstep_resource_rec.offset_interval := 0;
Line: 956

      ELSIF p_action = 'UPDATE' THEN
/* ============================ */
 --NULL;
Line: 1022

            l_field_updated := TRUE;
Line: 1052

            l_field_updated := TRUE;
Line: 1071

            l_field_updated := TRUE;
Line: 1090

            l_field_updated := TRUE;
Line: 1123

               l_field_updated := TRUE;
Line: 1152

               l_field_updated := TRUE;
Line: 1157

         /* When the actual resource count is null in the database and we are trying to update actual resource usage without the
         actual resource count, then user will be given error message that actual resource count is required.*/
         ELSE
           IF (l_batchstep_resource_rec.actual_rsrc_count IS NULL AND p_batchstep_resource_rec.actual_rsrc_usage IS NOT NULL) THEN
             gme_common_pvt.log_message('GME_FIELD_VALUE_REQUIRED','FIELD_NAME', 'actual_rsrc_count');
Line: 1185

               l_field_updated := TRUE;
Line: 1212

               l_field_updated := TRUE;
Line: 1217

         /* When the actual resource count is null in the database and we are trying to update actual resource usage without the
         actual resource count, then user will be given error message that actual resource count is required.*/
         ELSE
           IF (l_batchstep_resource_rec.actual_rsrc_count IS NULL AND p_batchstep_resource_rec.actual_rsrc_usage IS NOT NULL) THEN
             gme_common_pvt.log_message('GME_FIELD_VALUE_REQUIRED','FIELD_NAME', 'actual_rsrc_count');
Line: 1257

               l_field_updated := TRUE;
Line: 1282

               l_field_updated := TRUE;
Line: 1318

               l_field_updated := TRUE;
Line: 1333

               l_field_updated := TRUE;
Line: 1356

                  l_field_updated := TRUE;
Line: 1380

                  l_field_updated := TRUE;
Line: 1415

                  l_field_updated := TRUE;
Line: 1438

                  l_field_updated := TRUE;
Line: 1478

                     l_field_updated := TRUE;
Line: 1512

                     l_field_updated := TRUE;
Line: 1528

                     l_field_updated := TRUE;
Line: 1535

                     l_field_updated := TRUE;
Line: 1615

      insert_batchstep_rsrc
   Description
     Procedure is used to insert rsrc for an activity
   Parameters
     p_batchstep_resource_rec     Input  Row from GME_BATCH_STEP_RESOURCES
     x_batchstep_resource_rec     Output Row from GME_BATCH_STEP_RESOURCES
     x_return_status              reflects return status of the API
=============================================================================================*/
   PROCEDURE insert_batchstep_rsrc (
      p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_return_status            OUT NOCOPY      VARCHAR2)
   IS
      l_api_name            CONSTANT VARCHAR2 (30) := 'insert_batchstep_rsrc';
Line: 1641

         SELECT max_step_capacity
           FROM gme_batch_steps
          WHERE batchstep_id = v_batchstep_id;
Line: 1647

         SELECT capacity_constraint
           FROM cr_rsrc_mst
          WHERE resources = v_resources;
Line: 1652

      rsrc_insert_failure            EXCEPTION;
Line: 1682

      IF l_batch_header.update_inventory_ind = 'Y' THEN
         gme_trans_engine_util.load_rsrc_trans
                                      (p_batch_row          => l_batch_header
                                      ,x_rsc_row_count      => l_rsrc_trans_count
                                      ,x_return_status      => l_return_status);
Line: 1695

                        ,p_action_code             => 'INSERT'
                        ,p_check_prim_rsrc         => TRUE
                        ,x_step_resources_rec      => l_batchstep_resource_out_rec
                        ,x_return_status           => l_return_status);
Line: 1701

         gme_debug.put_line ('after insert ' || l_return_status);
Line: 1705

         RAISE rsrc_insert_failure;
Line: 1737

            UPDATE gme_batch_steps
               SET max_step_capacity = l_batchstep_resource_rec.max_capacity
                  ,last_update_date = gme_common_pvt.g_timestamp
                  ,last_updated_by = gme_common_pvt.g_user_ident
                  ,last_update_login = gme_common_pvt.g_login_id
             WHERE batchstep_id = l_batchstep_resource_rec.batchstep_id
               AND batch_id = l_batchstep_resource_rec.batch_id;
Line: 1756

      WHEN validation_failure OR rsrc_not_found OR rsrc_insert_failure OR error_condition THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 1761

   END insert_batchstep_rsrc;
Line: 1765

      update_batchstep_rsrc
   Description
     Procedure to update resource for an activity
   Parameters
     p_batchstep_resource_rec     Input  Row from GME_BATCH_STEP_RESOURCES
     x_batchstep_resource_rec     Output Row from GME_BATCH_STEP_RESOURCES
     x_return_status              reflects return status of the API
   History
     Inventory Convergence Project - March 2005

     G. Muratore    15-APR-2009  Bug 8335046
        Update the last_update_date for locking issues at the step level.
=============================================================================================*/
   PROCEDURE update_batchstep_rsrc (
      p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_return_status            OUT NOCOPY      VARCHAR2)
   IS
      l_api_name            CONSTANT VARCHAR2 (30) := 'update_batchstep_rsrc';
Line: 1795

      l_field_updated                BOOLEAN                         := FALSE;
Line: 1808

      l_update_capacity             NUMBER;
Line: 1814

         SELECT a.batchstep_id, a.step_status, b.batchstep_activity_id
               ,a.batch_id, b.resources
           FROM gme_batch_steps a, gme_batch_step_resources b
          WHERE b.batchstep_resource_id = v_resource_id
            AND a.batch_id = b.batch_id
            AND a.batchstep_id = b.batchstep_id;
Line: 1823

         SELECT max_step_capacity
           FROM gme_batch_steps;
Line: 1828

         SELECT capacity_constraint
           FROM cr_rsrc_dtl
          WHERE resources = v_resources AND orgn_code = v_orgn_code;
Line: 1834

         SELECT capacity_constraint
           FROM cr_rsrc_mst
          WHERE resources = v_resources;
Line: 1840

         SELECT 1
           FROM gme_batch_header a, gme_batch_step_resources b
          WHERE a.batch_id = b.batch_id
            AND b.batchstep_resource_id = v_rsrc_id
            AND a.batch_type = 10;
Line: 1846

      rsrc_update_failure            EXCEPTION;
Line: 1913

      IF l_batch_header.update_inventory_ind = 'Y' THEN
         gme_trans_engine_util.load_rsrc_trans
                                      (p_batch_row          => l_batch_header
                                      ,x_rsc_row_count      => l_rsrc_trans_count
                                      ,x_return_status      => l_return_status);
Line: 1926

                        ,p_action_code             => 'UPDATE'
                        ,p_check_prim_rsrc         => TRUE
                        ,x_step_resources_rec      => l_batchstep_resource_out_rec
                        ,x_return_status           => l_return_status);
Line: 1936

         RAISE rsrc_update_failure;
Line: 1979

         l_update_capacity := 0;
Line: 1982

            l_update_capacity := 1;
Line: 1986

         UPDATE gme_batch_steps
            SET max_step_capacity = DECODE(l_update_capacity, 1, l_batchstep_resource_out_rec.max_capacity, max_step_capacity),
                last_update_date = l_batchstep_resource_out_rec.last_update_date
          WHERE batchstep_id = l_batchstep_id AND batch_id = l_batch_id;
Line: 2003

      WHEN rsrc_not_valid OR rsrc_update_failure OR input_param_missing THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 2010

   END update_batchstep_rsrc;
Line: 2014

      delete_batchstep_rsrc
   Description
     Procedure to delete batchstep resource
   Parameters
     p_batchstep_resource_rec     batchstep resource row targetted for deletion
     x_return_status              reflects return status of the API
=============================================================================================*/
   PROCEDURE delete_batchstep_rsrc (
      p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,x_return_status            OUT NOCOPY      VARCHAR2)
   IS
      l_api_name        CONSTANT VARCHAR2 (30)     := 'delete_batchstep_rsrc';
Line: 2049

      IF l_batch_header.update_inventory_ind = 'Y' THEN
         gme_trans_engine_util.load_rsrc_trans
                                      (p_batch_row          => l_batch_header
                                      ,x_rsc_row_count      => l_rsrc_trans_count
                                      ,x_return_status      => l_return_status);
Line: 2062

                            ,p_action_code             => 'DELETE'
                            ,p_check_prim_rsrc         => TRUE
                            ,x_step_resources_rec      => l_batchstep_resource_rec
                            ,x_return_status           => l_return_status);
Line: 2068

         gme_debug.put_line (   'delete batchsetp resource returns '
                             || l_return_status);
Line: 2088

   END delete_batchstep_rsrc;
Line: 2104

         SELECT plan_start_date, plan_cmplt_date, actual_start_date
               ,actual_cmplt_date
           FROM gme_batch_step_activities
          WHERE batchstep_activity_id = p_batchstep_activity_id;
Line: 2169

         SELECT 1
           FROM gem_lookups
          WHERE lookup_type = p_lookup_type AND lookup_code = p_lookup_code;
Line: 2199

     Move input attribute values into the output record structure prior to validation or update
     processing.
     If p_validate_flexfield is TRUE, just move the value. The validation processing will
     do the rest.
     If flexfield validation is FALSE, then interpret the input values according to these rules
       NULL        means update value not supplied so retain the original (old) value
       G_MISS_???  means update with a NULL value
       NOT NULL    update with the supplied value
   Parameters
     p_new_batchstep_resource_rec   input record with values to be applied as updates
     p_old_batchstep_resource_rec   original record retrieved from the database
     p_validate_flexfield           indicates whethere validation required or not
     x_batchstep_resource_rec       Consolidation of the inputs above
     x_return_status                Return status
=============================================================================================*/
   PROCEDURE consolidate_flexfields (
      p_new_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_old_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_validate_flexfield           IN              VARCHAR2
            DEFAULT fnd_api.g_false
     ,x_batchstep_resource_rec       OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_return_status                OUT NOCOPY      VARCHAR2)
   IS
      l_api_name        CONSTANT VARCHAR2 (30)    := 'consolidate_flexfields';
Line: 2525

         /* On this basis, retain the new update values                                       */
         l_batchstep_resource_rec.attribute_category :=
                              p_new_batchstep_resource_rec.attribute_category;