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     *

 *  G. Muratore   19-MAR-2010  Bug 8751983
 *     Added logic to allow a different sort for resource transactions.
 *     Also, use IB date entered by user for resource transaction reversals when necessary.
 *     PROCEDURES: consolidate_batch_resources and fetch_active_resources

 *  G. Muratore   20-APR-2010  Bug 9506856
 *     Make call to insert data to GMF layer tables since these apis insert
 *     directly into gme transaction tables bypassing the gtmp table.
 *     PROCEDURES: insert_incr_actual_rsrc_txn and insert_timed_actual_rsrc_txn

 *  G. Muratore   20-APR-2010  Bug 12576806
 *     Initialize organization_id when inserting a new resource.
 *     PROCEDURES: resource_dtl_process

 *  G. Muratore   14-NOV-2011  Bug 13345631
 *     Date Validations commented out to allow transactions after completion date.
 *     PROCEDURES: validate_rsrc_txn_param

 *  G. Muratore   21-MAR-2013  Bug 16327528
 *     Use a different function to check for closed period.
 *     PROCEDURES: consolidate_batch_resources
 *****************************************************************
*/
/*  Global variables   */
   g_debug               VARCHAR2 (5)  := fnd_profile.VALUE ('AFLOG_LEVEL');
Line: 121

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

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

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

      /* 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: 204

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

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

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

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

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

   END delete_resource_trans;
Line: 299

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

      /* 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: 334

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

   END update_resource_trans;
Line: 384

        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.

  19-MAR-2010  G. Muratore     Bug 8751983
         Use IB date entered by user for resource transaction reversals when necessary.

  21-MAR-2013  G. Muratore     Bug 16327528
         Use a different function to check for closed period
=============================================================================================*/
   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: 412

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

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

      insert_failure        EXCEPTION;
Line: 436

      update_failure        EXCEPTION;
Line: 518

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

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

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

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

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

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

                  l_tran_rec.delete_mark := 1;
Line: 685

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

         /* 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: 1267

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

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

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

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

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

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

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

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

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

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

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

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

      /* 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: 1403

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

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

      /*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: 1443

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

	     /* 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: 1460

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

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

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

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

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

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

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

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

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

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

      /* 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: 2015

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

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

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

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

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

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

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

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

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

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

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

      asqc_update_rsrc_api_error    EXCEPTION;
Line: 2323

      /* 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: 2329

      /* 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: 2359

            RAISE asqc_update_rsrc_api_error;
Line: 2563

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

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

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

      rsrc_update_err       EXCEPTION;
Line: 2657

      rsrc_txn_insert_err   EXCEPTION;
Line: 2659

      update_rsrc_txn_err   EXCEPTION;
Line: 2669

       /*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: 2756

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

            RAISE update_rsrc_txn_err;
Line: 2788

      l_rsrc_txn_rec.delete_mark := 0;
Line: 2832

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

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

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

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

   END update_actual_resource_usage;
Line: 2890

      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

     20-APR-2010    G. Muratore     Bug 9506856
        Make call to insert data to GMF layer tables since this api inserts
        directly into gme transaction tables bypassing the gtmp table.
=============================================================================================*/
   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: 2953

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

      rsrc_update_err            EXCEPTION;
Line: 2960

      rsrc_txn_insert_err        EXCEPTION;
Line: 2979

      /*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: 3068

      l_rsrc_txn_rec.delete_mark := 0;
Line: 3079

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

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

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

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

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

   END insert_incr_actual_rsrc_txn;
Line: 3176

      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

     16-APR-2010    G. Muratore     Bug 9506856
        Make call to insert data to GMF layer tables since this api inserts
        directly into gme transaction tables bypassing the gtmp table.
=============================================================================================*/
   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: 3242

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

      rsrc_update_err          EXCEPTION;
Line: 3251

      rsrc_txn_insert_err      EXCEPTION;
Line: 3270

       /*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: 3400

      l_rsrc_txn_rec.delete_mark := 0;
Line: 3411

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

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

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

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

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

   END insert_timed_actual_rsrc_txn;
Line: 3513

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

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

      rsrc_txn_insert_err   EXCEPTION;
Line: 3571

      /*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: 3674

      l_rsrc_txn_rec.delete_mark := 0;
Line: 3684

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

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

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

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

      rsrc_update_err          EXCEPTION;
Line: 3814

       /*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: 3837

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

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

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

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

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

      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;