DBA Data[Home] [Help]

APPS.GME_RESOURCE_ENGINE_PVT SQL Statements

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

Line: 9

 *          UPDATE_PENDING_TRANS                                 *
 *          DELETE_PENDING_TRANS                                 *
 *          FETCH_ALL_RESOURCES                                  *
 *          BUILD_RESOURCE_TRAN               *
 *     FETCH_ACTIVE_RESOURCES           *
 *                                                               *
 * Use      This is the private layer of the GME Resource        *
 *          Transaction Processor.                               *
 *                                                               *
 * History
 * 17-JAN-2006 Susruth D. Bug#4917189                            *
 *       Added Update statements instead of dbl for updating     *
 *       the reverse_id in CONSOLIDATE_BATCH_RESOURCES.          *
 * 09-JUN-2006 SivakumarG Bug#5231180                            *
 *       Code added to resource_dtl_process to recalculate charge*
 *       if there is any insertion/updation/deletion if resouces *
 *  27-SEP-2007 Swapna K Bug#6154309
 *    Added the condition to check for ASQC batch before assigning the *
 *     overrided_protected_ind column of the resource transactions.    *
 *  07-NOV-2007 Swapna K Bug#6607524
 *     Changed the hardcoded organization id to that of the batch      *
 *      header's organization id in resource_dtl_process procedure     *
 *****************************************************************
*/
/*  Global variables   */
   g_debug               VARCHAR2 (5)  := fnd_profile.VALUE ('AFLOG_LEVEL');
Line: 99

          FOR    ' SELECT * FROM GME_RESOURCE_TXNS_GTMP
            WHERE '
              || l_where USING p_resource_rec.poc_trans_id;
Line: 104

          FOR    ' SELECT * FROM GME_RESOURCE_TXNS_GTMP
            WHERE '
              || l_where USING p_resource_rec.doc_id;
Line: 152

  x_tran_rec         The resource transaction rec with the updated poc trans id
  x_return_status    outcome of the API call
            S - Success
            E - Error
            U - Unexpected error
=============================================================================================*/
   PROCEDURE create_resource_trans (
      p_tran_rec        IN              gme_resource_txns_gtmp%ROWTYPE
     ,x_tran_rec        OUT NOCOPY      gme_resource_txns_gtmp%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)          := 'CREATE_RESOURCE_TRANS';
Line: 174

      /* Now Call the INSERT rec DML Layer */
      IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
         gme_debug.put_line ('Calling Insert Resource TXNS rec');
Line: 182

      IF NOT gme_resource_txns_gtmp_dbl.insert_row
                                           (p_resource_txns      => l_gme_tran_rec
                                           ,x_resource_txns      => x_tran_rec) THEN
         RAISE fnd_api.g_exc_error;
Line: 214

  delete_resource_trans
Description
  This particular procedure is used to delete pending or completed resource transactions
Parameters
  p_resource_rec     The resource transaction rec
  x_return_status    outcome of the API call
            S - Success
            E - Error
            U - Unexpected error
=============================================================================================*/
   PROCEDURE delete_resource_trans (
      p_tran_rec        IN              gme_resource_txns_gtmp%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_gme_tran_rec        gme_resource_txns_gtmp%ROWTYPE;
Line: 229

      l_api_name   CONSTANT VARCHAR2 (30)          := 'DELETE_RESOURCE_TRANS';
Line: 240

         DELETE FROM gme_resource_txns_gtmp
               WHERE poc_trans_id = p_tran_rec.poc_trans_id;
Line: 245

         IF NOT gme_resource_txns_gtmp_dbl.update_row
                                           (p_resource_txns      => l_gme_tran_rec) THEN
            RAISE fnd_api.g_exc_error;
Line: 273

   END delete_resource_trans;
Line: 277

  update_resource_trans
Description
  This particular procedure is used to update pending or completed resource transactions
Parameters
  p_resource_rec     The resource transaction rec
  x_return_status    outcome of the API call
            S - Success
            E - Error
            U - Unexpected error
=============================================================================================*/
   PROCEDURE update_resource_trans (
      p_tran_rec        IN              gme_resource_txns_gtmp%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)          := 'UPDATE_RESOURCE_TRANS';
Line: 306

      /* Now Call the UPDATE rec DML Layer */
      IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
         gme_debug.put_line (   'Calling UPDATE rec trans id:'
                             || TO_CHAR (p_tran_rec.poc_trans_id) );
Line: 312

      IF NOT gme_resource_txns_gtmp_dbl.update_row
                                            (p_resource_txns      => l_gme_tran_rec) THEN
         RAISE fnd_api.g_exc_error;
Line: 339

   END update_resource_trans;
Line: 362

        these attributes are updated by users manually and then
        if they change the transaction on the screen, attributes
        are lost.
  10-AUG-2004 Rishi Varma B3818266/3759970
        Added code to populate the reverse_id.
  02-SEP-2004 Rishi Varma B3856541
         Made changes for the rsrc txns in closed period ME.
  17-JAN-2006 Susruth D. Bug#4917189
         Added Update statements instead of dbl for updating the reverse_id
         in CONSOLIDATE_BATCH_RESOURCES.
=============================================================================================*/
   PROCEDURE consolidate_batch_resources (
      p_batch_id        IN              NUMBER
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)    := 'CONSOLIDATE_BATCH_RESOURCES';
Line: 384

         SELECT *
           FROM gme_resource_txns
          WHERE poc_trans_id = v_poc_id;
Line: 401

         SELECT organization_id
           FROM gme_batch_header
          WHERE batch_id = v_batch_id;
Line: 406

      insert_failure        EXCEPTION;
Line: 407

      update_failure        EXCEPTION;
Line: 465

            IF NOT gme_resource_txns_dbl.insert_row (l_tran_rec, l_tran_rec) THEN
               RAISE insert_failure;
Line: 529

               IF NOT gme_resource_txns_dbl.insert_row (l_prev_rec
                                                       ,l_prev_rec) THEN
                  RAISE insert_failure;
Line: 546

                  IF NOT gme_resource_txns_dbl.update_row (l_in_tran_rec) THEN
                     RAISE update_failure;
Line: 549

                  UPDATE gme_resource_txns
                  SET reverse_id = l_prev_rec.poc_trans_id
                  WHERE poc_trans_id = l_in_tran_rec.poc_trans_id;
Line: 587

               IF NOT gme_resource_txns_dbl.insert_row (l_tran_rec
                                                       ,l_tran_rec) THEN
                  RAISE insert_failure;
Line: 612

            ELSIF NOT gme_resource_txns_dbl.update_row (l_tran_rec) THEN
               RAISE update_failure;
Line: 618

                  l_tran_rec.delete_mark := 1;
Line: 620

                  IF NOT gme_resource_txns_dbl.delete_row (l_tran_rec) THEN
                     RAISE update_failure;
Line: 657

                  IF NOT gme_resource_txns_dbl.insert_row (l_tran_rec
                                                          ,l_tran_rec) THEN
                     RAISE insert_failure;
Line: 674

                     /*IF NOT gme_resource_txns_dbl.update_row (l_in_tran_rec) THEN
                        RAISE update_failure;
Line: 677

                     UPDATE gme_resource_txns
                     SET reverse_id = l_tran_rec.poc_trans_id
                     WHERE poc_trans_id = l_in_tran_rec.poc_trans_id;
Line: 703

               IF NOT gme_resource_txns_dbl.delete_row (l_tran_rec) THEN
                  RAISE update_failure;
Line: 722

      WHEN insert_failure THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 724

      WHEN update_failure THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 781

      p_resource_rec.last_update_date 	:= gme_common_pvt.g_timestamp;
Line: 783

      p_resource_rec.last_updated_by 	:= gme_common_pvt.g_user_ident;
Line: 784

      p_resource_rec.last_update_login 	:= gme_common_pvt.g_login_id;
Line: 785

      p_resource_rec.delete_mark 	:= p_tmp_rec.delete_mark;
Line: 922

         || ' AND delete_mark <> 1 ';
Line: 932

          FOR    ' SELECT * FROM GME_RESOURCE_TXNS_GTMP
            WHERE '
              || l_where USING p_resource_rec.poc_trans_id;
Line: 937

          FOR    ' SELECT * FROM GME_RESOURCE_TXNS_GTMP
            WHERE '
              || l_where USING p_resource_rec.line_id;
Line: 942

          FOR    ' SELECT * FROM GME_RESOURCE_TXNS_GTMP
            WHERE '
              || l_where USING p_resource_rec.doc_id;
Line: 995

  Bharati Satpute   Bug2188136  21/03/2002 Added code for action_code 'INSERT'

=============================================================================================*/
   PROCEDURE resource_dtl_process (
      p_step_resources_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_action_code          IN              VARCHAR2
     ,p_check_prim_rsrc      IN              BOOLEAN := FALSE
     ,x_step_resources_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_return_status        OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)           := 'resource_dtl_process';
Line: 1022

         SELECT NVL (SUM (resource_usage), 0)
           FROM gme_resource_txns_gtmp
          WHERE line_id = v_batchstep_resource_id
            AND completed_ind = v_completed
            AND (v_completed = 1 OR sequence_dependent_ind = 0);
Line: 1031

      SELECT max_capacity, capacity_um
        FROM cr_rsrc_mst
        WHERE resources = v_rsrc
        AND capacity_constraint = 1;
Line: 1038

      SELECT 1
        FROM DUAL
       WHERE EXISTS (SELECT 1
                      FROM gme_batch_step_charges
		     WHERE batchstep_id = v_step_id
		       AND resources    = v_rsrc);
Line: 1095

      IF     (p_action_code = 'INSERT')
         AND (l_batch_header.automatic_step_calculation = 1) THEN
         /* If the step  status is greater than pending then */
         /* we have to calculate the actual quantities       */
         IF l_batch_step.step_status > 2 THEN
            x_step_resources_rec.actual_rsrc_qty :=
                                                 l_batch_step.actual_step_qty;
Line: 1125

         /* If the step status is pending then we have to update the plan quantities */
         ELSIF l_batch_step.step_status = 1 THEN
            x_step_resources_rec.plan_rsrc_qty := l_batch_step.plan_step_qty;
Line: 1151

      END IF;                                /* IF p_action_code = 'INSERT' */
Line: 1160

      IF p_action_code IN ('INSERT', 'UPDATE') THEN
         validate_resource (p_batch_step_rec          => l_batch_step
                           ,p_step_activity_rec       => l_step_activity
                           ,p_step_resources_rec      => x_step_resources_rec
                           ,p_check_prim_rsrc         => p_check_prim_rsrc
                           ,x_return_status           => l_return_status);
Line: 1177

      IF p_action_code = 'INSERT' THEN
         -- Shikha Nagar - added check to prevent second instance of primary rsrc from getting inserted
         -- for an activity
         --rishi 3446787 03/03/04
         -- commented the call to check_primary_resorce as it is already being called
         -- by validate_resource above.
         /*
         GME_RESOURCE_ENGINE_PVT.check_primary_resource (p_step_resources_rec => x_step_resources_rec
                                                        ,x_return_status  => l_return_status);
Line: 1190

         IF NOT (gme_batch_step_resources_dbl.insert_row
                              (p_batch_step_resources      => x_step_resources_rec
                              ,x_batch_step_resources      => x_step_resources_rec) ) THEN
            RAISE fnd_api.g_exc_error;
Line: 1197

      IF p_action_code IN ('INSERT', 'UPDATE') THEN
         IF l_batch_header.update_inventory_ind = 'Y' THEN
            IF l_batch_step.step_status = 1 THEN
               gme_update_step_qty_pvt.adjust_pending_usage
                         (p_batch_step_resources_rec      => x_step_resources_rec
                         ,x_return_status                 => l_return_status);
Line: 1209

               gme_update_step_qty_pvt.adjust_actual_usage
                         (p_batch_step_resources_rec      => x_step_resources_rec
                         ,x_return_status                 => l_return_status);
Line: 1217

         END IF;            /* IF l_batch_header.update_inventory_ind = 'Y' */
Line: 1222

         IF p_action_code = 'INSERT' THEN
            GMF_VIB.Update_Batch_Requirements
            ( p_api_version   =>    1.0,
              p_init_msg_list =>    FND_API.G_FALSE,
              p_batch_id      =>    l_batch_header.batch_id,
              x_return_status =>    l_return_status,
              x_msg_count     =>    l_message_count,
              x_msg_data      =>    l_message_list);
Line: 1238

      ELSIF p_action_code = 'DELETE' THEN
         /* Remove this call as per Resource TD page 57                               */
         /* Call to be made from GME_API_PUB.save_batch                               */
         /*
         GME_RESOURCE_ENGINE_PVT.check_primary_resource (p_step_resources_rec => x_step_resources_rec
                                                        ,x_return_status  => l_return_status);
Line: 1248

         gme_delete_batch_step_pvt.delete_resource
                         (p_batch_step_resources_rec      => x_step_resources_rec
                         ,x_return_status                 => l_return_status);
Line: 1258

         GMF_VIB.Update_Batch_Requirements
         ( p_api_version   =>    1.0,
           p_init_msg_list =>    FND_API.G_FALSE,
           p_batch_id      =>    l_batch_header.batch_id,
           x_return_status =>    l_return_status,
           x_msg_count     =>    l_message_count,
           x_msg_data      =>    l_message_list);
Line: 1272

      END IF;                   /* IF p_action_code IN ('INSERT', 'UPDATE') */
Line: 1274

      /* Update has to be done after updating the transactions as the adjust actual */
      /* usage logic depends on the previous actual usage to deduce the usage to be */
      /* deducted from the pending resource transactions                            */
      IF p_action_code = 'UPDATE' THEN
         IF NOT (gme_batch_step_resources_dbl.update_row
                               (p_batch_step_resources      => x_step_resources_rec) ) THEN
            RAISE fnd_api.g_exc_error;
Line: 1283

         x_step_resources_rec.last_updated_by := gme_common_pvt.g_user_ident;
Line: 1284

         x_step_resources_rec.last_update_date := gme_common_pvt.g_timestamp;
Line: 1287

      /*Bug#5231180 resource insertion and deletion might result in the max step capacity
        if the resource is capacity constrained then we need to recalculate charges
	if the resource is not capacity constrained then there is no need to recalculate charges */
        /*Bug#6607524 Changed the hard coded 1381 to the batch header's organization id*/
       gme_common_pvt.g_setup_done :=
         gme_common_pvt.setup (p_org_id        => l_batch_header.ORGANIZATION_ID --1381
                              ,p_org_code      => NULL);
Line: 1323

         IF p_action_code = 'UPDATE' THEN
	   /* check whether resource is the one that determines charges */
	   OPEN cur_get_charge_rsrc(l_batch_step.batchstep_id,x_step_resources_rec.resources);
Line: 1329

	     /* this rsrc is determining resource since scale type is not By Charge delete the charge details */
	     gme_batch_step_chg_pvt.clear_charges(
                      p_batch_id        => l_batch_step.batch_id
                     ,p_batchstep_id    => l_batch_step.batchstep_id
                     ,x_return_status   => l_return_status);
Line: 1340

         ELSIF p_action_code IN ('INSERT', 'DELETE') THEN
	   --call recalculate charges procedure with R as p_cal_type
	   gme_update_step_qty_pvt.recalculate_charges(
	       p_batchstep_rec => l_batch_step
              ,p_cal_type      => 'R'
              ,x_batchstep_rec => x_batch_step
              ,x_return_status => l_return_status );
Line: 1392

 Bharati Satpute  Bug 2165993  1/09/2002 Incomprehensible error message when inserting a resource
=============================================================================================*/
   PROCEDURE validate_resource (
      p_batch_step_rec       IN              gme_batch_steps%ROWTYPE
     ,p_step_activity_rec    IN              gme_batch_step_activities%ROWTYPE
     ,p_step_resources_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_check_prim_rsrc      IN              BOOLEAN := FALSE
     ,x_return_status        OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30) := 'validate_resource';
Line: 1573

         SELECT COUNT (1)
           FROM gme_batch_step_resources
          WHERE batchstep_resource_id <> NVL (v_batchstep_resource_id, -1)
            AND batchstep_activity_id = v_batchstep_activity_id
            AND prim_rsrc_ind = 1;
Line: 1582

         SELECT activity
           FROM gme_batch_step_activities
          WHERE batchstep_activity_id = v_batchstep_activity_id;
Line: 1588

         SELECT batchstep_id
           FROM gme_batch_step_activities
          WHERE batchstep_activity_id = v_batchstep_activity_id;
Line: 1594

         SELECT batchstep_no
           FROM gme_batch_steps
          WHERE batchstep_id = v_batchstep_id;
Line: 1709

         SELECT batch_id, batchstep_no, batchstep_id
           FROM gme_batch_steps
          WHERE batch_id = p_batch_id
            AND batchstep_id = NVL (p_batchstep_id, batchstep_id);
Line: 1718

         SELECT activity, batchstep_activity_id
           FROM gme_batch_step_activities
          WHERE batch_id = v_batch_id AND batchstep_id = v_batchstep_id;
Line: 1724

         SELECT COUNT (1)
           FROM gme_batch_step_resources
          WHERE batchstep_activity_id = v_batchstep_activity_id
            AND prim_rsrc_ind = 1;
Line: 1801

         SELECT step_status
           FROM gme_batch_steps
          WHERE batchstep_id = p_step_resources_rec.batchstep_id;
Line: 1805

      /* Bug 2651477 added delete_mark condition */
      CURSOR cur_get_usage (v_completed_ind NUMBER)
      IS
         SELECT SUM (resource_usage)
           FROM gme_resource_txns_gtmp
          WHERE line_id = p_step_resources_rec.batchstep_resource_id
            AND completed_ind = v_completed_ind
            AND (v_completed_ind = 1 OR sequence_dependent_ind = 0)
            AND action_code <> 'DEL'
            AND NVL (delete_mark, 0) <> 1;
Line: 1895

     p_reason_code                reason to insert a completed rsrc txn
     p_instance_id                instance_id of the instance of rsrc txn(for WPS)
     p_instance_no                instance_no of the instance of rsrc txn(for WPS)
     x_return_status              reflects return status of the API
   HISTORY
     09JULY03 BUG#3041697  V. Ajay Kumar
     Port bug 2965879 to 11.5.10K.
     Modified code such that an error is not raised if the
     reason code is not entered.
     02-SEP-2004 Rishi Varma  B3856541
     Made changes for the rsrc txns in closed period ME.Added an extra parameter x_trans_date
     and replaced the gmi call with call to the new grp layer procedure.
=============================================================================================*/
   PROCEDURE validate_rsrc_txn_param (
      p_called_from         IN              NUMBER
     ,p_batchstep_rsrc_id   IN              NUMBER
     ,p_org_code            IN              VARCHAR2
     ,p_batch_no            IN              VARCHAR2 := NULL
     ,p_batchstep_no        IN              NUMBER := NULL
     ,p_activity            IN              VARCHAR2 := NULL
     ,p_resource            IN              VARCHAR2 := NULL
     ,p_trans_date          IN              DATE
     ,p_start_date          IN              DATE
     ,p_end_date            IN              DATE
     ,p_usage               IN              NUMBER
     ,p_reason_name         IN              VARCHAR2
     ,p_reason_id           IN              NUMBER
     ,p_instance_id         IN              NUMBER
     ,p_instance_no         IN              NUMBER
     ,x_line_id             OUT NOCOPY      NUMBER
     ,x_step_status         OUT NOCOPY      NUMBER
     ,x_batch_header_rec    OUT NOCOPY      gme_batch_header%ROWTYPE
     ,x_instance_id         OUT NOCOPY      NUMBER
     ,x_reason_id           OUT NOCOPY      NUMBER
     ,x_return_status       OUT NOCOPY      VARCHAR2
     ,
      --Rishi Varma B3856541 02-09-2004 start
      x_trans_date          OUT NOCOPY      DATE)
   IS
      CURSOR cur_get_batch_id (v_org_id VARCHAR2, v_batch_no VARCHAR2)
      IS
         SELECT batch_id
           FROM gme_batch_header
         WHERE  organization_id = v_org_id
            AND batch_no = v_batch_no
            AND batch_type = 0;
Line: 1944

         SELECT batchstep_id
           FROM gme_batch_steps
          WHERE batch_id = v_batch_id AND batchstep_no = v_batchstep_no;
Line: 1950

         SELECT a.batch_id, a.resources
           FROM gme_batch_step_resources a
          WHERE a.batchstep_resource_id = v_resource_id;
Line: 1960

         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: 1968

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

         SELECT step_status
           FROM gme_batch_steps a, gme_batch_step_resources b
          WHERE a.batchstep_id = b.batchstep_id
            AND b.batchstep_resource_id = v_line_id;
Line: 1982

         SELECT instance_id
           FROM gmp_resource_instances i, cr_rsrc_dtl r
          WHERE r.resource_id = i.resource_id
            AND r.resources = v_resource
            AND instance_number = v_instance_no;
Line: 1992

         SELECT 1
           FROM gmp_resource_instances i, cr_rsrc_dtl r
          WHERE r.resource_id = i.resource_id
            AND r.resources = v_resource
            AND instance_id = v_instance_id;
Line: 2000

         SELECT actual_start_date, actual_cmplt_date
           FROM gme_batch_step_resources
          WHERE batchstep_resource_id = v_line_id;
Line: 2006

         SELECT reason_id
           FROM mtl_transaction_reasons
          WHERE NVL (disable_date, SYSDATE + 1) > SYSDATE
            AND reason_id = v_reason_id;
Line: 2013

         SELECT reason_id
           FROM mtl_transaction_reasons
          WHERE NVL (disable_date, SYSDATE + 1) > SYSDATE
            AND reason_name = v_reason_name;
Line: 2062

      asqc_update_rsrc_api_error    EXCEPTION;
Line: 2203

      /* We cannot insert allocations for an FPO */
      IF l_batch_header.batch_type = 10 THEN
         gme_common_pvt.log_message ('GME_RTXN_FOR_FPO_NT_ALWD');
Line: 2209

      /* We cannot insert txns if the batch does not support txns*/
      IF l_batch_header.update_inventory_ind = 'N' THEN
         gme_common_pvt.log_message ('GME_RTXN_FOR_UPDINV_NT_ALWD');
Line: 2239

            RAISE asqc_update_rsrc_api_error;
Line: 2440

      WHEN invalid_date OR close_period_err OR step_status_asqc_error OR asqc_update_rsrc_api_error OR asqc_ovrd_end_txn_api_error OR fnd_api.g_exc_error THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 2472

      update_actual_resource_usage
   Description
     This particular procedure is used to insert completed rsrc txn rec for a resource and deletes
     all other existing rsrc txns.
   Parameters
     (p_org_code,p_batch_no,step_no,activity and resource)   to uniquely identify a resource
     p_trans_date                 transaction date of resource txn
     p_start_date                 start date of resource txn
     p_end_date                   end date of resource txn
     p_usage                      resource usage of the txns and resource
     p_reason_code                reason to insert a completed rsrc txn
     p_instance_id                instance_id of the instance of rsrc txn(for WPS)
     p_instance_no                instance_no of the instance of rsrc txn(for WPS)
     x_return_status              reflects return status of the API
     02-SEP-04 Rishi Varma B3856541
      Added the new parameter to the validate_rsrc_param procedure call.
     01-OCT-04 Rishi Varma 3896510/3865212
       Made changes for bug 3896510

       16-March-2005 Punit Kumar
       Convergence changes
=============================================================================================*/
   PROCEDURE update_actual_resource_usage (
      p_org_code        IN              VARCHAR2
     ,p_batch_no        IN              VARCHAR2 := NULL
     ,p_batchstep_no    IN              NUMBER := NULL
     ,p_activity        IN              VARCHAR2 := NULL
     ,p_resource        IN              VARCHAR2 := NULL
     ,p_reason_name     IN              VARCHAR2,
      p_instance_no     IN              NUMBER
     ,p_rsrc_txn_rec    IN              gme_resource_txns%ROWTYPE
     ,x_rsrc_txn_rec    IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)       := 'UPDATE_ACTUAL_RSRC_USAGE';
Line: 2527

         SELECT resources, usage_um
           FROM gme_batch_step_resources
          WHERE batchstep_resource_id = v_line_id;
Line: 2533

      rsrc_update_err       EXCEPTION;
Line: 2534

      rsrc_txn_insert_err   EXCEPTION;
Line: 2536

      update_rsrc_txn_err   EXCEPTION;
Line: 2546

       /*siva commented following IF condition to allow insertion of flexfileds
        without validation when p_validate_flexfields is FALSE */
      --IF gme_common_pvt.g_flex_validate_prof = 1 THEN
         /*Validate Flexfields using the new procedure gme_api_validate_flex_fld_pvt.validate_rsrc_txn_flex */
         gme_validate_flex_fld_pvt.validate_rsrc_txn_flex
                                       (p_resource_txn_rec      => p_rsrc_txn_rec
                                       ,x_resource_txn_rec      => x_rsrc_txn_rec
                                       ,x_return_status         => l_return_status);
Line: 2633

         delete_resource_trans (p_tran_rec           => l_resource_tbl (i)
                               ,x_return_status      => l_return_status);
Line: 2637

            RAISE update_rsrc_txn_err;
Line: 2665

      l_rsrc_txn_rec.delete_mark := 0;
Line: 2709

      IF NOT (gme_resource_txns_gtmp_dbl.insert_row (l_rsrc_txn_rec
                                                    ,l_rsrc_txn_rec) ) THEN
         RAISE rsrc_txn_insert_err;
Line: 2731

      IF NOT gme_batch_step_resources_dbl.update_row
                                   (p_batch_step_resources      => l_step_resources) THEN
         RAISE rsrc_update_err;
Line: 2747

      WHEN update_rsrc_txn_err OR rsrc_txn_insert_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 2749

      WHEN rsrc_fetch_err OR rsrc_update_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 2763

   END update_actual_resource_usage;
Line: 2767

      insert_incr_actual_rsrc_txn
   Description
     This particular procedure is used to insert incrementally a completed rsrc txn rec
   Parameters
     (p_org_code,p_batch_no,step_no,activity and resource)   to uniquely identify a resource
     p_trans_date                 transaction date of resource txn
     p_start_date                 start date of resource txn
     p_end_date                   end date of resource txn
     p_usage                      resource usage of the txns and resource
     p_reason_code                reason to insert a completed rsrc txn
     p_instance_id                instance_id of the instance of rsrc txn(for WPS)
     p_instance_no                instance_no of the instance of rsrc txn(for WPS)
     x_return_status              reflects return status of the API
     02-SEP-04 Rishi Varma B3856541
      Added the new parameter to the validate_rsrc_param procedure call.

      16-March-2005  Punit Kumar
      Convergenc changes
=============================================================================================*/
   PROCEDURE insert_incr_actual_rsrc_txn (
      p_org_code        IN              VARCHAR2
     /*inventory organization under which the batch was created.*/
     ,p_batch_no        IN              VARCHAR2 := NULL
     ,p_batchstep_no    IN              NUMBER := NULL
     ,p_activity        IN              VARCHAR2 := NULL
     ,p_resource        IN              VARCHAR2 := NULL
     ,p_reason_name     IN              VARCHAR2
     ,p_instance_no     IN              NUMBER
     ,p_rsrc_txn_rec    IN              gme_resource_txns%ROWTYPE
     ,x_rsrc_txn_rec    IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name        CONSTANT VARCHAR2 (30)
                                             := 'insert_incr_actual_rsrc_txn';
Line: 2826

         SELECT resources, usage_um
           FROM gme_batch_step_resources
          WHERE batchstep_resource_id = v_line_id;
Line: 2832

      rsrc_update_err            EXCEPTION;
Line: 2833

      rsrc_txn_insert_err        EXCEPTION;
Line: 2845

      /*siva commented following IF condition to allow insertion of flexfileds
        without validation when p_validate_flexfields is FALSE */
      --IF gme_common_pvt.g_flex_validate_prof = 1 THEN
         /*Validate Flexfields using the new procedure gme_api_validate_flex_fld_pvt.validate_rsrc_txn_flex */
         gme_validate_flex_fld_pvt.validate_rsrc_txn_flex
                                       (p_resource_txn_rec      => p_rsrc_txn_rec
                                       ,x_resource_txn_rec      => x_rsrc_txn_rec
                                       ,x_return_status         => x_return_status);
Line: 2934

      l_rsrc_txn_rec.delete_mark := 0;
Line: 2945

      IF NOT (gme_resource_txns_dbl.insert_row (l_rsrc_txn_rec
                                               ,x_rsrc_txn_rec) ) THEN
         RAISE rsrc_txn_insert_err;
Line: 2976

         gme_update_step_qty_pvt.reduce_pending_usage
                              (p_batch_step_resources_rec      => l_step_resources
                              ,x_return_status                 => x_return_status);
Line: 2985

      IF NOT gme_batch_step_resources_dbl.update_row
                                   (p_batch_step_resources      => l_step_resources) THEN
         RAISE rsrc_update_err;
Line: 2997

      WHEN validation_failure OR error_load_trans OR rsrc_txn_insert_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 2999

      WHEN rsrc_fetch_err OR rsrc_update_err OR reduce_pend_usage_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 3013

   END insert_incr_actual_rsrc_txn;
Line: 3017

      insert_timed_actual_rsrc_txn
   Description
     This particular procedure is used to insert completed rsrc txn rec and calculates the usage             from provided txn dates
   Parameters
     (p_org_code,p_batch_no,step_no,activity and resource)   to uniquely identify a resource
     p_trans_date                 transaction date of resource txn
     p_start_date                 start date of resource txn
     p_end_date                   end date of resource txn
     p_reason_code                reason to insert a completed rsrc txn
     p_instance_id                instance_id of the instance of rsrc txn(for WPS)
     p_instance_no                instance_no of the instance of rsrc txn(for WPS)
     x_return_status              reflects return status of the API
   History
     09JULY03 BUG#3041705  V. Ajay Kumar
     Port bug 2965882 to 11.5.10K.
     Modified code such that the difference in start date and end date
     is calculated in hours.
     02-SEP-04 Rishi Varma B3856541
      Added the new parameter to the validate_rsrc_param procedure call.

      15-March-2005 Punit Kumar
      Convergence changes
=============================================================================================*/
   PROCEDURE insert_timed_actual_rsrc_txn (
      p_org_code        IN              VARCHAR2
     ,p_batch_no        IN              VARCHAR2 := NULL
     ,p_batchstep_no    IN              NUMBER := NULL
     ,p_activity        IN              VARCHAR2 := NULL
     ,p_resource        IN              VARCHAR2 := NULL
     ,p_reason_name     IN              VARCHAR2,
      p_instance_no     IN              NUMBER
     ,p_rsrc_txn_rec    IN              gme_resource_txns%ROWTYPE
     ,x_rsrc_txn_rec    IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name      CONSTANT VARCHAR2 (30)
                                            := 'insert_timed_actual_rsrc_txn';
Line: 3079

         SELECT resources, usage_um
           FROM gme_batch_step_resources
          WHERE batchstep_resource_id = v_line_id;
Line: 3087

      rsrc_update_err          EXCEPTION;
Line: 3088

      rsrc_txn_insert_err      EXCEPTION;
Line: 3100

       /*siva commented following IF condition to allow insertion of flexfileds
        without validation when p_validate_flexfields is FALSE */
      --IF gme_common_pvt.g_flex_validate_prof = 1 THEN
         /*Validate Flexfields using the new procedure gme_api_validate_flex_fld_pvt.validate_rsrc_txn_flex */
         gme_validate_flex_fld_pvt.validate_rsrc_txn_flex
                                       (p_resource_txn_rec      => p_rsrc_txn_rec
                                       ,x_resource_txn_rec      => x_rsrc_txn_rec
                                       ,x_return_status         => l_return_status);
Line: 3230

      l_rsrc_txn_rec.delete_mark := 0;
Line: 3241

      IF NOT (gme_resource_txns_dbl.insert_row (l_rsrc_txn_rec
                                               ,x_rsrc_txn_rec) ) THEN
         RAISE rsrc_txn_insert_err;
Line: 3272

         gme_update_step_qty_pvt.reduce_pending_usage
                              (p_batch_step_resources_rec      => l_step_resources
                              ,x_return_status                 => x_return_status);
Line: 3281

      IF NOT gme_batch_step_resources_dbl.update_row
                                   (p_batch_step_resources      => l_step_resources) THEN
         RAISE rsrc_update_err;
Line: 3294

      WHEN validation_failure OR missing_profile_option OR error_load_trans OR rsrc_txn_insert_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 3296

      WHEN rsrc_fetch_err OR rsrc_update_err OR reduce_pend_usage_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 3312

   END insert_timed_actual_rsrc_txn;
Line: 3318

     This particular procedure is used to insert a start completed rsrc txn rec
   Parameters
     (p_org_code,p_batch_no,step_no,activity and resource)   to uniquely identify a resource
     p_trans_date                 transaction date of resource txn
     p_start_date                 start date of resource txn
     p_reason_code                reason to insert a completed rsrc txn
     p_instance_id                instance_id of the instance of rsrc txn(for WPS)
     p_instance_no                instance_no of the instance of rsrc txn(for WPS)
     x_return_status              reflects return status of the API
     02-SEP-04 Rishi Varma B3856541
      Added the new parameter to the validate_rsrc_param procedure call.
=============================================================================================*/
   PROCEDURE start_cmplt_actual_rsrc_txn (
      /* inventory organization under which the batch was created */
      p_org_code        IN              VARCHAR2
     ,p_batch_no        IN              VARCHAR2 := NULL
     ,p_batchstep_no    IN              NUMBER := NULL
     ,p_activity        IN              VARCHAR2 := NULL
     ,p_resource        IN              VARCHAR2 := NULL
     ,p_reason_name     IN              VARCHAR2
     ,p_instance_no     IN              NUMBER
     ,p_rsrc_txn_rec    IN              gme_resource_txns%ROWTYPE
     ,x_rsrc_txn_rec    IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)    := 'start_cmplt_actual_rsrc_txn';
Line: 3359

         SELECT resources, usage_um
           FROM gme_batch_step_resources
          WHERE batchstep_resource_id = v_line_id;
Line: 3366

      rsrc_txn_insert_err   EXCEPTION;
Line: 3376

      /*siva commented following IF condition to allow insertion of flexfileds
        without validation when p_validate_flexfields is FALSE */
     -- IF gme_common_pvt.g_flex_validate_prof = 1 THEN
         --Validate Flexfields using the new procedure
         gme_validate_flex_fld_pvt.validate_rsrc_txn_flex
                                       (p_resource_txn_rec      => p_rsrc_txn_rec
                                       ,x_resource_txn_rec      => x_rsrc_txn_rec
                                       ,x_return_status         => x_return_status);
Line: 3479

      l_rsrc_txn_rec.delete_mark := 0;
Line: 3489

      IF NOT (gme_resource_txns_dbl.insert_row (l_rsrc_txn_rec
                                               ,x_rsrc_txn_rec) ) THEN
         RAISE rsrc_txn_insert_err;
Line: 3498

      WHEN validation_failure OR rsrc_txn_insert_err THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 3524

     p_reason_name                reason to insert a completed rsrc txn
     p_instance_id                instance_id of the instance of rsrc txn(for WPS)
     p_instance_no                instance_no of the instance of rsrc txn(for WPS)
     x_return_status              reflects return status of the API
   History
     09JULY03 BUG#3041705  V. Ajay Kumar
     Port bug 2965882 to 11.5.10K.
     Modified code such that the difference in start date and end date
     is calculated in hours.
     RajaSekhar Reddy 21-MAY-2004 BUG#3610141
     Added code  to assign plan_rsrc_count to actual_rsrc_count if actual_rsrc_count is NULL.
     02-SEP-04 Rishi Varma B3856541
     Added the new parameter to the validate_rsrc_param procedure call.

     14th March 2005 Punit kumar
     Convergence changes
=============================================================================================*/
   PROCEDURE end_cmplt_actual_rsrc_txn (
      p_rsrc_txn_rec    IN              gme_resource_txns%ROWTYPE
     ,p_reason_name     IN              VARCHAR2
     ,p_instance_no     IN              NUMBER
     ,x_rsrc_txn_rec    IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_return_status   OUT NOCOPY      VARCHAR2)
   IS
      l_api_name      CONSTANT VARCHAR2 (30)   := 'end_cmplt_actual_rsrc_txn';
Line: 3577

         SELECT 1
           FROM gme_resource_txns
          WHERE poc_trans_id = v_poc_trans_id;
Line: 3587

      rsrc_update_err          EXCEPTION;
Line: 3619

       /*siva commented following IF condition to allow insertion of flexfileds
        without validation when p_validate_flexfields is FALSE */
      --IF gme_common_pvt.g_flex_validate_prof = 1 THEN
         /* Validate Flexfields using the new procedure  */
         gme_validate_flex_fld_pvt.validate_rsrc_txn_flex
                                       (p_resource_txn_rec      => p_rsrc_txn_rec
                                       ,x_resource_txn_rec      => x_rsrc_txn_rec
                                       ,x_return_status         => x_return_status);
Line: 3642

          OR (l_rsrc_txn_rec.delete_mark <> 0) ) THEN
         gme_common_pvt.log_message ('GME_INVALID_TXN_FOR_END');
Line: 3815

         IF NOT (gme_resource_txns_dbl.insert_row (l_rsrc_txn_rec, l_tran_rec) ) THEN
            RAISE rsrc_txn_ins_err;
Line: 3823

         IF NOT (gme_resource_txns_dbl.update_row (l_rsrc_txn_rec) ) THEN
            RAISE rsrc_txn_upd_err;
Line: 3873

         gme_update_step_qty_pvt.reduce_pending_usage
                              (p_batch_step_resources_rec      => l_step_resources
                              ,x_return_status                 => x_return_status);
Line: 3882

      IF NOT gme_batch_step_resources_dbl.update_row
                                   (p_batch_step_resources      => l_step_resources) THEN
         RAISE rsrc_update_err;
Line: 3902

      WHEN rsrc_fetch_err OR rsrc_txn_fetch_err OR rsrc_update_err OR reduce_pend_usage_err THEN
         x_return_status := fnd_api.g_ret_sts_error;