DBA Data[Home] [Help]

APPS.GME_API_PUB SQL Statements

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

Line: 74

         SELECT DISTINCT doc_id batch_id
                    FROM gme_resource_txns_gtmp
                ORDER BY batch_id;
Line: 120

            delete from gme_resource_txns_gtmp
                  where doc_id = header_row.batch_id;
Line: 228

         SELECT inventory_item_id
           FROM gmd_recipe_validity_rules
          WHERE recipe_validity_rule_id = v_vrule_id;
Line: 234

        SELECT inventory_item_id
	  FROM mtl_system_items_kfv
	 WHERE concatenated_segments = v_item_no;
Line: 240

         SELECT 1
           FROM DUAL
          WHERE EXISTS (SELECT 1
                          FROM mtl_units_of_measure
                         WHERE uom_code = v_uom_code);
Line: 1053

   #  update_actual_rsrc_usage
   # DESCRIPTION
   #
   # HISTORY :
   #  10-MAR-2005  Punit Kumar  Convergence changes
   #########################################################################*/
   PROCEDURE update_actual_rsrc_usage (
      p_api_version           IN              NUMBER := 2.0
     ,p_validation_level      IN              NUMBER := gme_common_pvt.g_max_errors
     ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                IN              VARCHAR2 := fnd_api.g_false
     ,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_instance_no           IN              NUMBER := NULL
     ,p_reason_name           IN              VARCHAR2 := NULL
     ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
     ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
     ,x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2)
   IS
      l_api_name       CONSTANT  VARCHAR2(30) := 'UPDATE_ACTUAL_RSRC_USAGE';
Line: 1092

         SELECT r.*
           FROM gme_resource_txns_gtmp t, gme_resource_txns r
          WHERE action_code = 'NONE' AND t.line_id = v_line_id
            AND t.poc_trans_id = r.poc_trans_id;
Line: 1097

      update_rsrc_usage          EXCEPTION;
Line: 1100

      SAVEPOINT update_actual_rsrc_usage;
Line: 1102

         gme_debug.log_initialize ('UpdateResource');
Line: 1132

                                         ,'update_actual_resource_usage'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 1147

            ||'BEFORE CALLING gme_resource_engine_pvt.update_actual_resource_usagep ' );
Line: 1150

      gme_resource_engine_pvt.update_actual_resource_usage
                                           (p_org_code           => p_org_code
                                           ,p_batch_no           => p_batch_no
                                           ,p_batchstep_no       => p_batchstep_no
                                           ,p_activity           => p_activity
                                           ,p_resource           => p_resource
                                           ,p_instance_no        => p_instance_no
                                           ,p_reason_name        => p_reason_name
                                           ,p_rsrc_txn_rec       => p_rsrc_txn_rec
                                           ,x_rsrc_txn_rec       => x_rsrc_txn_rec
                                           ,x_return_status      => x_return_status);
Line: 1180

         RAISE update_rsrc_usage;
Line: 1216

         ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
Line: 1220

      WHEN update_rsrc_usage THEN
         ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
Line: 1226

         ROLLBACK TO SAVEPOINT update_actual_rsrc_usage;
Line: 1231

   END update_actual_rsrc_usage;
Line: 1235

   #   insert_incr_actual_rsrc_txn
   # DESCRIPTION
   # HISTORY
   #  10-MAR-2005  Punit Kumar
   #    Convergence changes
   #########################################################################*/
   PROCEDURE insert_incr_actual_rsrc_txn (
      p_api_version           IN              NUMBER := 2.0
     ,p_validation_level      IN              NUMBER  := gme_common_pvt.g_max_errors
     ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                IN              VARCHAR2 := fnd_api.g_false
     ,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_instance_no           IN              NUMBER := NULL
     ,p_reason_name           IN              VARCHAR2 := NULL
     ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
     ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
     ,x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2)
   IS
      l_api_name       CONSTANT  VARCHAR2(30) := 'INSERT_INCR_ACTUAL_RSRC_TXN';
Line: 1265

      SAVEPOINT insert_incr_actual_rsrc_txn;
Line: 1268

         gme_debug.log_initialize ('InsertIncr');
Line: 1297

                                         ,'insert_incr_actual_rsrc_txn'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 1312

            ||'BEFORE CALLING gme_resource_engine_pvt.insert_incr_actual_rsrc_txnp ' );
Line: 1314

      gme_resource_engine_pvt.insert_incr_actual_rsrc_txn
                                           (p_org_code           => p_org_code
                                           ,p_batch_no           => p_batch_no
                                           ,p_batchstep_no       => p_batchstep_no
                                           ,p_activity           => p_activity
                                           ,p_resource           => p_resource
                                           ,p_instance_no        => p_instance_no
                                           ,p_reason_name        => p_reason_name
                                           ,p_rsrc_txn_rec       => p_rsrc_txn_rec
                                           ,x_rsrc_txn_rec       => x_rsrc_txn_rec
                                           ,x_return_status      => x_return_status);
Line: 1347

         gme_debug.put_line (   'Insert Incr Actual rsrc usage at '
                             || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
Line: 1358

         ROLLBACK TO SAVEPOINT insert_incr_actual_rsrc_txn;
Line: 1363

         ROLLBACK TO SAVEPOINT insert_incr_actual_rsrc_txn;
Line: 1368

   END insert_incr_actual_rsrc_txn;
Line: 1372

   #   insert_timed_actual_rsrc_txn
   # DESCRIPTION
   #   This procedure calculates the resource usage based on
   #   difference of p_end_date and p_start_date converted in resource UOM.
   # HISTORY
   # 10-MAR-2005  Punit Kumar
   #   Convergence changes
   #########################################################################*/
   PROCEDURE insert_timed_actual_rsrc_txn (
      p_api_version           IN              NUMBER := 2.0
     ,p_validation_level      IN              NUMBER  := gme_common_pvt.g_max_errors
     ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                IN              VARCHAR2 := fnd_api.g_false
     ,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_instance_no           IN              NUMBER := NULL
     ,p_reason_name           IN              VARCHAR2 := NULL
     ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
     ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
     ,x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2)
   IS
      l_api_name       CONSTANT VARCHAR2(30) := 'INSERT_TIMED_ACTUAL_RSRC_TXN';
Line: 1405

      SAVEPOINT insert_timed_actual_rsrc_txn;
Line: 1409

         gme_debug.log_initialize ('InsertTimed');
Line: 1437

                                         ,'insert_timed_actual_rsrc_txn'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 1453

            ||'BEFORE CALLING gme_resource_engine_pvt.insert_timed_actual_rsrc_txnp ');
Line: 1456

      gme_resource_engine_pvt.insert_timed_actual_rsrc_txn
                                           (p_org_code           => p_org_code
                                           ,p_batch_no           => p_batch_no
                                           ,p_batchstep_no       => p_batchstep_no
                                           ,p_activity           => p_activity
                                           ,p_resource           => p_resource
                                           ,p_instance_no        => p_instance_no
                                           ,p_reason_name        => p_reason_name
                                           ,p_rsrc_txn_rec       => p_rsrc_txn_rec
                                           ,x_rsrc_txn_rec       => x_rsrc_txn_rec
                                           ,x_return_status      => x_return_status);
Line: 1489

         gme_debug.put_line (   'Insert timed Actual rsrc usage at '
                             || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
Line: 1500

         ROLLBACK TO SAVEPOINT insert_timed_actual_rsrc_txn;
Line: 1505

         ROLLBACK TO SAVEPOINT insert_timed_actual_rsrc_txn;
Line: 1510

   END insert_timed_actual_rsrc_txn;
Line: 1518

   #    At a later time this transaction is updated with the usage
   #    by calling gme_api_pub.end_cmplt_actual_rsrc_txn (It passes
   #    the end date and the usage is calculated as diferrence between
   #    end_date and start_date)
   # HISTORY
   #   10-MAR-2005  Punit Kumar
   #     Convergence changes
   #    Pawan kumar corrected check for organization_id and various parameters
   #########################################################################*/
   PROCEDURE start_cmplt_actual_rsrc_txn (
      p_api_version           IN              NUMBER := 2.0
     ,p_validation_level      IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                IN              VARCHAR2 := fnd_api.g_false
     ,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_instance_no           IN              NUMBER
     ,p_reason_name           IN              VARCHAR2 := NULL
     ,p_rsrc_txn_rec          IN              gme_resource_txns%ROWTYPE
     ,p_validate_flexfields   IN              VARCHAR2 := fnd_api.g_false
     ,x_rsrc_txn_rec          IN OUT NOCOPY   gme_resource_txns%ROWTYPE
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2)
   IS
      l_api_name       CONSTANT  VARCHAR2(30) := 'START_CMPLT_ACTUAL_RSRC_TXN';
Line: 1764

         gme_debug.put_line (   'Insert Incr Actual rsrc usage at '
                             || TO_CHAR (SYSDATE, 'MM/DD/YYYY HH24:MI:SS') );
Line: 2441

                                         ,'insert_batchstep_resource'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 2559

                                         ,'insert_batchstep_resource'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 2608

      /* Verify that update_inventory is permitted for this batch */
      IF l_batch_header_rec.update_inventory_ind <> 'Y' THEN
         gme_common_pvt.log_message ('GME_INVENTORY_UPDATE_BLOCKED');
Line: 2668

   PROCEDURE insert_process_parameter (
      p_api_version           IN              NUMBER := 2.0
     ,p_validation_level      IN              NUMBER
     ,p_init_msg_list         IN              VARCHAR2
     ,p_commit                IN              VARCHAR2
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2
     ,p_batch_no              IN              VARCHAR2
     ,p_org_code              IN              VARCHAR2
     ,p_validate_flexfields   IN              VARCHAR2
     ,p_batchstep_no          IN              NUMBER
     ,p_activity              IN              VARCHAR2
     ,p_parameter             IN              VARCHAR2
     ,p_process_param_rec     IN              gme_process_parameters%ROWTYPE
     ,x_process_param_rec     OUT NOCOPY      gme_process_parameters%ROWTYPE)
   IS
      insert_parameter_failed   EXCEPTION;
Line: 2686

      l_api_name       CONSTANT VARCHAR2 (30) := 'INSERT_PROCESS_PARAMETER';
Line: 2694

      SAVEPOINT insert_process_parameter;
Line: 2697

         gme_debug.log_initialize ('InsertProcessParameters');
Line: 2709

                                         ,'Insert_process_parameter'
                                         ,g_pkg_name) THEN
         x_return_status := fnd_api.g_ret_sts_error;
Line: 2727

         gme_debug.put_line ('Calling Insert process parameters');
Line: 2731

      gme_process_parameters_pvt.insert_process_parameter
                              (p_batch_no                 => p_batch_no
                              ,p_org_code                 => p_org_code
                              ,p_validate_flexfields      => p_validate_flexfields
                              ,p_batchstep_no             => p_batchstep_no
                              ,p_activity                 => p_activity
                              ,p_parameter                => p_parameter
                              ,p_process_param_rec        => p_process_param_rec
                              ,x_process_param_rec        => x_process_param_rec
                              ,x_return_status            => x_return_status);
Line: 2744

               (   'Came back from Pvt insert process parameter with status '
                || x_return_status);
Line: 2754

         RAISE insert_parameter_failed;
Line: 2769

         ROLLBACK TO SAVEPOINT insert_process_parameter;
Line: 2773

      WHEN insert_parameter_failed THEN
         ROLLBACK TO SAVEPOINT insert_process_parameter;
Line: 2779

        ROLLBACK TO SAVEPOINT insert_process_parameter;
Line: 2784

   END insert_process_parameter;
Line: 2787

   PROCEDURE update_process_parameter (
      p_api_version           IN              NUMBER
     ,p_validation_level      IN              NUMBER
     ,p_init_msg_list         IN              VARCHAR2
     ,p_commit                IN              VARCHAR2
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2
     ,p_batch_no              IN              VARCHAR2
     ,p_org_code              IN              VARCHAR2
     ,p_validate_flexfields   IN              VARCHAR2
     ,p_batchstep_no          IN              NUMBER
     ,p_activity              IN              VARCHAR2
     ,p_parameter             IN              VARCHAR2
     ,p_process_param_rec     IN              gme_process_parameters%ROWTYPE
     ,x_process_param_rec     OUT NOCOPY      gme_process_parameters%ROWTYPE)
   IS
      update_parameter_failed   EXCEPTION;
Line: 2805

      l_api_name       CONSTANT VARCHAR2 (30) := 'UPDATE_PROCESS_PARAMETER';
Line: 2813

      SAVEPOINT update_process_parameter;
Line: 2816

         gme_debug.log_initialize ('UpdateProcessParameter');
Line: 2830

                                         ,'Insert_process_parameter'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 2845

      gme_process_parameters_pvt.update_process_parameter
                              (p_batch_no                 => p_batch_no
                              ,p_org_code                 => p_org_code
                              ,p_validate_flexfields      => p_validate_flexfields
                              ,p_batchstep_no             => p_batchstep_no
                              ,p_activity                 => p_activity
                              ,p_parameter                => p_parameter
                              ,p_process_param_rec        => p_process_param_rec
                              ,x_process_param_rec        => x_process_param_rec
                              ,x_return_status            => x_return_status);
Line: 2858

               (   'Came back from Pvt update process parameter with status '
                || x_return_status);
Line: 2868

         RAISE update_parameter_failed;
Line: 2884

         ROLLBACK TO SAVEPOINT update_process_parameter;
Line: 2888

      WHEN update_parameter_failed THEN
         ROLLBACK TO SAVEPOINT update_process_parameter;
Line: 2894

        ROLLBACK TO SAVEPOINT update_process_parameter;
Line: 2899

   END update_process_parameter;
Line: 2902

   PROCEDURE delete_process_parameter (
      p_api_version         IN              NUMBER
     ,p_validation_level    IN              NUMBER
     ,p_init_msg_list       IN              VARCHAR2
     ,p_commit              IN              VARCHAR2
     ,x_message_count       OUT NOCOPY      NUMBER
     ,x_message_list        OUT NOCOPY      VARCHAR2
     ,x_return_status       OUT NOCOPY      VARCHAR2
     ,p_batch_no            IN              VARCHAR2
     ,p_org_code            IN              VARCHAR2
     ,p_batchstep_no        IN              NUMBER
     ,p_activity            IN              VARCHAR2
     ,p_parameter           IN              VARCHAR2
     ,p_process_param_rec   IN              gme_process_parameters%ROWTYPE)
   IS
      delete_parameter_failed   EXCEPTION;
Line: 2918

      l_api_name       CONSTANT VARCHAR2 (30) := 'DELETE_PROCESS_PARAMETER';
Line: 2926

      SAVEPOINT delete_process_parameter;
Line: 2929

         gme_debug.log_initialize ('DeleteProcessParameter');
Line: 2943

                                         ,'Insert_process_parameter'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 2960

         gme_debug.put_line ('Calling Insert process parameters');
Line: 2964

      gme_process_parameters_pvt.delete_process_parameter
                                  (p_batch_no               => p_batch_no
                                  ,p_org_code               => p_org_code
                                  ,p_batchstep_no           => p_batchstep_no
                                  ,p_activity               => p_activity
                                  ,p_parameter              => p_parameter
                                  ,p_process_param_rec      => p_process_param_rec
                                  ,x_return_status          => x_return_status);
Line: 2975

               (   'Came back from Pvt delete process parameter with status '
                || x_return_status);
Line: 2985

         RAISE delete_parameter_failed;
Line: 2996

         ROLLBACK TO SAVEPOINT delete_process_parameter;
Line: 3000

      WHEN delete_parameter_failed THEN
         ROLLBACK TO SAVEPOINT delete_process_parameter;
Line: 3006

         ROLLBACK TO SAVEPOINT delete_process_parameter;
Line: 3011

   END delete_process_parameter;
Line: 3014

   PROCEDURE delete_step (
      p_api_version        IN              NUMBER := 2.0
     ,p_validation_level   IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
     ,p_commit             IN              VARCHAR2
     ,p_org_code           IN              VARCHAR2
     ,p_batch_no           IN              VARCHAR2
     ,x_message_count      OUT NOCOPY      NUMBER
     ,x_message_list       OUT NOCOPY      VARCHAR2
     ,x_return_status      OUT NOCOPY      VARCHAR2
     ,p_batch_step_rec     IN              gme_batch_steps%ROWTYPE)
   IS
      l_api_name   CONSTANT VARCHAR2 (30) := 'DELETE_STEP';
Line: 3029

      delete_step_failed    EXCEPTION;
Line: 3035

      SAVEPOINT delete_step;
Line: 3055

                                         ,'delete_step'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 3060

      gme_api_main.delete_step (p_validation_level      => p_validation_level
                               ,p_init_msg_list         => fnd_api.g_false
                               ,x_message_count         => x_message_count
                               ,x_message_list          => x_message_list
                               ,x_return_status         => x_return_status
                               ,p_batch_header_rec      => l_batch_header_rec
                               ,p_batch_step_rec        => p_batch_step_rec);
Line: 3069

         RAISE delete_step_failed;
Line: 3091

         ROLLBACK TO SAVEPOINT delete_step;
Line: 3096

      WHEN delete_step_failed THEN
         ROLLBACK TO SAVEPOINT delete_step;
Line: 3102

          ROLLBACK TO SAVEPOINT delete_step;
Line: 3107

   END delete_step;
Line: 3111

    *    insert_step
    * History
    * Punit Kumar 07-Apr-2005
    *   Convergence Changes
    * SivakumarG 16-NOV-2005 FPBug#4395561
    *  Added new argument p_validate_flexfields
   /*************************************************************************/
   PROCEDURE insert_step (
      p_api_version         IN              NUMBER := 2.0
     ,p_validation_level    IN              NUMBER  := gme_common_pvt.g_max_errors
     ,p_init_msg_list       IN              VARCHAR2 := fnd_api.g_false
     ,p_commit              IN              VARCHAR2
     ,p_org_code            IN              VARCHAR2
     ,p_validate_flexfields IN              VARCHAR2 := fnd_api.g_false
     ,p_oprn_no             IN              VARCHAR2
     ,p_oprn_vers           IN              NUMBER
     ,p_batch_header_rec    IN              gme_batch_header%ROWTYPE
     ,p_batch_step_rec      IN              gme_batch_steps%ROWTYPE
     ,x_batch_step_rec      OUT NOCOPY      gme_batch_steps%ROWTYPE
     ,x_message_count       OUT NOCOPY      NUMBER
     ,x_message_list        OUT NOCOPY      VARCHAR2
     ,x_return_status       OUT NOCOPY      VARCHAR2)
   IS
      l_api_name         CONSTANT VARCHAR2 (30)              := 'INSERT_STEP';
Line: 3135

      insert_step_failed          EXCEPTION;
Line: 3146

         SELECT oprn_no, oprn_vers
           FROM gmd_operations_b
          WHERE oprn_id = l_oprn_id;
Line: 3155

         SELECT 1
           FROM DUAL
          WHERE EXISTS (
                   SELECT 1
                     FROM gmd_operations_b
                    WHERE oprn_no = l_oprn_no
                      AND oprn_vers = l_oprn_vers
                      AND owner_organization_id = l_org_id);
Line: 3168

      SAVEPOINT insert_step;
Line: 3186

                                         ,'insert_step'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 3206

      /* Bug 2766460 Added check not to allow insert step if batch is completed/closed or cancelled */
      IF (l_batch_header_rec.batch_status IN (gme_common_pvt.g_batch_cancelled,
                                              gme_common_pvt.g_batch_completed,
                                              gme_common_pvt.g_batch_closed) ) THEN
         gme_common_pvt.log_message ('GME_INV_STATUS_INSERT_STEP');
Line: 3231

         gme_common_pvt.log_message ('GME_INV_STATUS_INSERT_STEP');
Line: 3255

             RAISE insert_step_failed;
Line: 3275

               RAISE insert_step_failed;
Line: 3283

            RAISE insert_step_failed;
Line: 3292

       gme_api_main.insert_step (p_validation_level      => p_validation_level
                               ,p_init_msg_list         => fnd_api.g_false
                               ,x_message_count         => x_message_count
                               ,x_message_list          => x_message_list
                               ,x_return_status         => x_return_status
                               ,p_batch_header_rec      => l_batch_header_rec
                               ,p_batch_step_rec        => p_batch_step_rec
                               ,x_batch_step            => x_batch_step_rec);
Line: 3304

         RAISE insert_step_failed;
Line: 3330

         ROLLBACK TO SAVEPOINT insert_step;
Line: 3335

      WHEN insert_step_failed THEN
         ROLLBACK TO SAVEPOINT insert_step;
Line: 3342

         ROLLBACK TO SAVEPOINT insert_step;
Line: 3348

   END insert_step;
Line: 3352

      insert_material_line
    Description
      This procedure is used to insert a material line

    Parameters
      p_batch_header_rec (R)          batch for which material line has to be updated
      p_material_detail_rec (R)       material line details that has to be inserted
      p_locator_code (O)              Default Consumption/Yield Locator Code
      p_org_code (O)                  organization code
      p_batchstep_no(O)               batch step no
      p_validate_flexfields (O)       Whether to validate the flexfields
      x_material_detail_rec           inserted material detail record
      x_return_status                 outcome of the API call
                                      S - Success
                                      E - Error
                                      U - Unexpected Error
    HISTORY
     SivakumarG Bug#5078853 02-MAR-2006
      Procedure Created

     G. Muratore    12-JUN-2009   Bug 7562848
        Allow users to insert material lines on phantom batches.
        Added parameter p_check_phantom when calling validate_batch.
  ================================================================================*/
    PROCEDURE insert_material_line (
         p_api_version           IN           NUMBER := 2.0
        ,p_validation_level      IN           NUMBER := gme_common_pvt.g_max_errors
        ,p_init_msg_list         IN           VARCHAR2 DEFAULT fnd_api.g_false
        ,p_commit                IN           VARCHAR2 DEFAULT fnd_api.g_false
        ,p_batch_header_rec      IN           gme_batch_header%ROWTYPE
        ,p_material_detail_rec   IN           gme_material_details%ROWTYPE
        ,p_locator_code          IN           VARCHAR2
        ,p_org_code              IN           VARCHAR2
        ,p_batchstep_no          IN           NUMBER := NULL
        ,p_validate_flexfields   IN           VARCHAR2 DEFAULT fnd_api.g_false
        ,x_material_detail_rec   OUT NOCOPY   gme_material_details%ROWTYPE
        ,x_message_count         OUT NOCOPY   NUMBER
        ,x_message_list          OUT NOCOPY   VARCHAR2
        ,x_return_status         OUT NOCOPY   VARCHAR2 )
    IS
    /* get the locator id */
    CURSOR c_get_locator(v_org_id NUMBER,v_sub_inv VARCHAR2) IS
     SELECT inventory_location_id locator_id
       FROM mtl_item_locations_kfv
      WHERE organization_id = v_org_id
        AND subinventory_code = v_sub_inv
        AND concatenated_segments = p_locator_code;
Line: 3400

    l_api_name                    CONSTANT VARCHAR2 (30) := 'INSERT_MATERIAL_LINE';
Line: 3412

         gme_debug.log_initialize ('INSERT_MATERIAL_LINE');
Line: 3423

       SAVEPOINT insert_material_line;
Line: 3428

                                           ,'insert_material_line'
                                           ,g_pkg_name) THEN
          gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 3529

       gme_api_main.insert_material_line (
          p_validation_level    => p_validation_level
         ,p_init_msg_list       => p_init_msg_list
         ,x_message_count       => x_message_count
         ,x_message_list        => x_message_list
         ,x_return_status       => x_return_status
         ,p_batch_header_rec    => l_batch_header_rec
         ,p_material_detail_rec => l_material_detail_rec
         ,p_batch_step_rec      => l_batch_step_rec
         ,p_trans_id            => NULL
         ,x_transacted          => x_transacted
         ,x_material_detail_rec => x_material_detail_rec);
Line: 3567

          ROLLBACK TO SAVEPOINT insert_material_line;
Line: 3574

          ROLLBACK TO SAVEPOINT insert_material_line;
Line: 3580

    END insert_material_line;
Line: 3584

          update_material_line
        Description
          This procedure is used to update a material line

        Parameters
          p_batch_header_rec (R)          batch for which material line has to be updated
          p_material_detail_rec (R)       material line that has to be updated
          p_locator_code (O)              Default Consumption/Yield Locator Code
          p_org_code (O)                  organization code
          p_scale_phantom (O)             to scale phantom product only or total batch
          p_validate_flexfields (O)       Whether to validate the flexfields
          x_material_detail_rec           updated material detail record
          x_return_status                 outcome of the API call
                                          S - Success
                                          E - Error
                                          U - Unexpected Error
        HISTORY
         SivakumarG Bug#5078853 02-MAR-2006
          Procedure Created
      ================================================================================*/
    PROCEDURE update_material_line (
          p_api_version           IN           NUMBER := 2.0
         ,p_validation_level      IN           NUMBER := gme_common_pvt.g_max_errors
         ,p_init_msg_list         IN           VARCHAR2 DEFAULT fnd_api.g_false
         ,p_commit                IN           VARCHAR2 DEFAULT fnd_api.g_false
         ,p_batch_header_rec      IN           gme_batch_header%ROWTYPE
         ,p_material_detail_rec   IN           gme_material_details%ROWTYPE
         ,p_locator_code          IN           VARCHAR2
         ,p_org_code              IN           VARCHAR2
         ,p_scale_phantom         IN           VARCHAR2 DEFAULT fnd_api.g_false
         ,p_validate_flexfields   IN           VARCHAR2 DEFAULT fnd_api.g_false
         ,x_material_detail_rec   OUT NOCOPY   gme_material_details%ROWTYPE
         ,x_message_count         OUT NOCOPY   NUMBER
         ,x_message_list          OUT NOCOPY   VARCHAR2
         ,x_return_status         OUT NOCOPY   VARCHAR2 )
    IS
      /* get the locator id */
      CURSOR c_get_locator(v_org_id NUMBER,v_sub_inv VARCHAR2,v_locator VARCHAR2) IS
       SELECT inventory_location_id locator_id
         FROM mtl_item_locations_kfv
        WHERE organization_id = v_org_id
          AND subinventory_code = v_sub_inv
          AND concatenated_segments = v_locator;
Line: 3629

       SELECT batchstep_id
         FROM gme_batch_step_items
        WHERE material_detail_id = v_mat_id;
Line: 3633

      l_api_name                   CONSTANT VARCHAR2 (30) := 'UPDATE_MATERIAL_LINE';
Line: 3661

       SAVEPOINT update_material_line;
Line: 3666

                                           ,'update_material_line'
                                           ,g_pkg_name) THEN
          gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 3777

       gme_api_main.update_material_line (
          p_validation_level             => p_validation_level
         ,p_init_msg_list                => p_init_msg_list
         ,x_message_count                => x_message_count
         ,x_message_list                 => x_message_list
         ,x_return_status                => x_return_status
         ,p_batch_header_rec             => l_batch_header_rec
         ,p_material_detail_rec          => l_material_detail_rec
         ,p_stored_material_detail_rec   => l_stored_material_detail_rec
         ,p_batch_step_rec               => l_batch_step_rec
         ,p_scale_phantom                => p_scale_phantom
         ,p_trans_id                     => NULL
         ,x_transacted                   => x_transacted
         ,x_material_detail_rec          => x_material_detail_rec);
Line: 3819

          ROLLBACK TO SAVEPOINT update_material_line;
Line: 3826

          ROLLBACK TO SAVEPOINT update_material_line;
Line: 3832

    END update_material_line;
Line: 3836

          delete_material_line
        Description
          This procedure is used to delete a material line

        Parameters
          p_batch_header_rec (R)          batch for which material line has to be updated
          p_material_detail_rec (R)       material line that has to be updated
          p_org_code (O)                  organization code
          x_return_status                 outcome of the API call
                                          S - Success
                                          E - Error
                                          U - Unexpected Error
        HISTORY
         SivakumarG Bug#5078853 02-MAR-2006
          Procedure Created
    ================================================================================*/
    PROCEDURE delete_material_line (
          p_api_version           IN           NUMBER := 2.0
         ,p_validation_level      IN           NUMBER := gme_common_pvt.g_max_errors
         ,p_init_msg_list         IN           VARCHAR2 DEFAULT fnd_api.g_false
         ,p_commit                IN           VARCHAR2 DEFAULT fnd_api.g_false
         ,p_batch_header_rec      IN           gme_batch_header%ROWTYPE
         ,p_material_detail_rec   IN           gme_material_details%ROWTYPE
         ,p_org_code              IN           VARCHAR2
         ,x_message_count         OUT NOCOPY   NUMBER
         ,x_message_list          OUT NOCOPY   VARCHAR2
         ,x_return_status         OUT NOCOPY   VARCHAR2 )
    IS
      CURSOR c_get_step_id(v_mat_id NUMBER) IS
       SELECT batchstep_id
         FROM gme_batch_step_items
        WHERE material_detail_id = v_mat_id;
Line: 3869

      l_api_name         CONSTANT VARCHAR2 (30) := 'DELETE_MATERIAL_LINE';
Line: 3881

         gme_debug.log_initialize ('DELETE_MATERIAL_LINE');
Line: 3891

       SAVEPOINT delete_material_line;
Line: 3896

                                           ,'delete_material_line'
                                           ,g_pkg_name) THEN
          gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 3952

       gme_api_main.delete_material_line (
          p_validation_level    => p_validation_level
         ,p_init_msg_list       => p_init_msg_list
         ,x_message_count       => x_message_count
         ,x_message_list        => x_message_list
         ,x_return_status       => x_return_status
         ,p_batch_header_rec    => l_batch_header_rec
         ,p_material_detail_rec => l_material_detail_rec
         ,p_batch_step_rec      => l_batch_step_rec
         ,x_transacted          => x_transacted );
Line: 3974

          ROLLBACK TO SAVEPOINT delete_material_line;
Line: 3980

          ROLLBACK TO SAVEPOINT delete_material_line;
Line: 3985

    END delete_material_line;
Line: 4029

         SELECT  COUNT(1)
         FROM mtl_material_transactions mmt, gme_material_details mtl
         WHERE NVL(transfer_lpn_id,0) > 0
           AND TRANSACTION_SOURCE_ID = p_batch_id
           AND transaction_action_id = 31
           AND transaction_type_id IN (44, 1002)
           AND mmt.transaction_source_id = mtl.batch_id
           AND mmt.inventory_item_id = mtl.inventory_item_id
           AND mmt.transaction_id NOT IN (
           SELECT transaction_id1
                    FROM gme_transaction_pairs
                    WHERE batch_id = p_batch_id
                    AND pair_type = 1);
Line: 4514

     ,p_delete_pending     IN              VARCHAR2 := fnd_api.g_false
     ,p_org_code           IN              VARCHAR2
     ,p_batch_no           IN              VARCHAR2
     ,x_batch_step_rec     OUT NOCOPY      gme_batch_steps%ROWTYPE)
   IS
      l_api_name      CONSTANT VARCHAR2 (30)              := 'CLOSE_STEP';
Line: 4602

                              ,p_delete_pending        => p_delete_pending
                              ,x_batch_step_rec        => x_batch_step_rec);
Line: 5055

         SELECT *
           FROM mtl_system_items_b
          WHERE inventory_item_id = v_item_id AND organization_id = v_org_id;
Line: 5061

         SELECT *
           FROM mtl_material_transactions
          WHERE transaction_set_id = v_header_id;
Line: 5587

   PROCEDURE update_material_txn (
      p_api_version           IN              NUMBER := 2.0
     ,p_validation_level      IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list         IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                IN              VARCHAR2 := fnd_api.g_false
     ,x_message_count         OUT NOCOPY      NUMBER
     ,x_message_list          OUT NOCOPY      VARCHAR2
     ,x_return_status         OUT NOCOPY      VARCHAR2
     ,p_transaction_id        IN              NUMBER
     ,p_mmti_rec              IN              mtl_transactions_interface%ROWTYPE
     ,p_mmli_tbl              IN              gme_common_pvt.mtl_trans_lots_inter_tbl
     ,p_create_lot            IN              VARCHAR2 := NULL
     ,p_generate_lot          IN              VARCHAR2 := NULL
     ,p_generate_parent_lot   IN              VARCHAR2 := NULL
     ,x_mmt_rec               OUT NOCOPY      mtl_material_transactions%ROWTYPE
     ,x_mmln_tbl              OUT NOCOPY      gme_common_pvt.mtl_trans_lots_num_tbl)
   IS
      CURSOR cur_get_item_rec (v_item_id NUMBER, v_org_id NUMBER)
      IS
         SELECT *
           FROM mtl_system_items_b
          WHERE inventory_item_id = v_item_id AND organization_id = v_org_id;
Line: 5613

         SELECT *
           FROM mtl_material_transactions
          WHERE transaction_set_id = v_header_id;
Line: 5619

         SELECT organization_id, transaction_source_id, trx_source_line_id, transaction_type_id
           FROM mtl_material_transactions
          WHERE transaction_id = v_transaction_id;
Line: 5623

      l_api_name   CONSTANT VARCHAR2 (30)            := 'UPDATE_MATERIAL_TXN';
Line: 5648

      update_txn_fail       EXCEPTION;
Line: 5649

      update_txn_mismatch   EXCEPTION;
Line: 5652

         gme_debug.log_initialize ('UpdateTxn');
Line: 5661

      SAVEPOINT update_transaction;
Line: 5671

                                         ,'update_material_txn'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 5712

        RAISE update_txn_mismatch;
Line: 5857

      gme_transactions_pvt.update_material_txn
                                        (p_transaction_id      => p_transaction_id
                                        ,p_mmti_rec            => l_mmti_rec
                                        ,p_mmli_tbl            => l_mmli_tbl
                                        ,x_return_status       => l_return_status);
Line: 5884

         RAISE update_txn_fail;
Line: 5910

      WHEN update_txn_mismatch THEN
        ROLLBACK TO SAVEPOINT update_transaction;
Line: 5912

        gme_common_pvt.log_message('GME_TXN_UPDATE_MISMATCH');
Line: 5917

      WHEN update_txn_fail THEN
         ROLLBACK TO SAVEPOINT update_transaction;
Line: 5923

         ROLLBACK TO SAVEPOINT update_transaction;
Line: 5933

   END update_material_txn;
Line: 5936

   PROCEDURE delete_material_txn (
      p_api_version        IN              NUMBER := 2.0
     ,p_validation_level   IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list      IN              VARCHAR2 := fnd_api.g_false
     ,p_commit             IN              VARCHAR2 := fnd_api.g_false
     ,x_message_count      OUT NOCOPY      NUMBER
     ,x_message_list       OUT NOCOPY      VARCHAR2
     ,x_return_status      OUT NOCOPY      VARCHAR2
     ,p_transaction_id     IN              NUMBER)
   IS
      l_api_name   CONSTANT VARCHAR2 (30)   := 'DELETE_MATERIAL_TXN';
Line: 5960

      delete_txn_fail       EXCEPTION;
Line: 5965

         SELECT organization_id
           FROM mtl_material_transactions
          WHERE transaction_id = v_transaction_id;
Line: 5970

         gme_debug.log_initialize ('DeleteTxn');
Line: 5979

      SAVEPOINT delete_transaction;
Line: 5990

                                         ,'delete_material_txn'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 6022

      gme_transactions_pvt.delete_material_txn
                                        (p_transaction_id      => l_transaction_id
                                        ,x_return_status       => x_return_status);
Line: 6041

         RAISE delete_txn_fail;
Line: 6049

      WHEN delete_txn_fail THEN
         ROLLBACK TO SAVEPOINT delete_transaction;
Line: 6055

         ROLLBACK TO SAVEPOINT delete_transaction;
Line: 6065

   END delete_material_txn;
Line: 6535

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

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

         SELECT *
           FROM mtl_reservations
          WHERE reservation_id = v_reservation_id;
Line: 7006

   PROCEDURE insert_batchstep_resource (
      p_api_version              IN              NUMBER
     ,p_validation_level         IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
     ,p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_org_code                 IN              VARCHAR2 := NULL
     ,p_batch_no                 IN              VARCHAR2 := NULL
     ,p_batchstep_no             IN              NUMBER := NULL
     ,p_activity                 IN              VARCHAR2 := NULL
     ,p_ignore_qty_below_cap     IN              VARCHAR2 := fnd_api.g_false
     ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
     ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_message_count            OUT NOCOPY      NUMBER
     ,x_message_list             OUT NOCOPY      VARCHAR2
     ,x_return_status            OUT NOCOPY      VARCHAR2)
   IS
      l_api_name            CONSTANT VARCHAR2 (30)
                                               := 'INSERT_BATCHSTEP_RESOURCE';
Line: 7035

      l_delete_mark                  NUMBER;
Line: 7045

      insert_rsrc_failed             EXCEPTION;
Line: 7050

         SELECT batchstep_id, batch_id
           FROM gme_batch_step_activities
          WHERE batchstep_activity_id = v_activity_id;
Line: 7056

         SELECT 1
           FROM gme_batch_header a, gme_batch_step_activities b
          WHERE a.batch_id = b.batch_id
            AND b.batchstep_activity_id = v_activity_id
            AND a.batch_type = 10;
Line: 7064

         SELECT min_capacity, max_capacity, capacity_constraint, capacity_um
               ,usage_uom, delete_mark, capacity_tolerance
           FROM cr_rsrc_dtl
          WHERE resources = v_resources
                AND organization_id = v_organization_id;
Line: 7072

         SELECT min_capacity, max_capacity, capacity_constraint, capacity_um
               ,std_usage_uom, delete_mark, capacity_tolerance
           FROM cr_rsrc_mst
          WHERE resources = v_resources;
Line: 7079

         SELECT step_status
           FROM gme_batch_steps
          WHERE batch_id = v_batch_id AND batchstep_id = v_batchstep_id;
Line: 7084

         gme_debug.log_initialize ('InsertBatchstepResource');
Line: 7093

      SAVEPOINT insert_batchstep_rsrc;
Line: 7101

                                         ,'insert_batchstep_resource'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 7261

           ,l_capacity_um, l_usage_uom, l_delete_mark, l_capacity_tolerance;
Line: 7268

              ,l_capacity_um, l_usage_uom, l_delete_mark
              ,l_capacity_tolerance;
Line: 7275

         IF cur_get_rsrc_hdr%NOTFOUND OR l_delete_mark = 1 THEN
            CLOSE cur_get_rsrc_dtl;
Line: 7339

             ,p_action                      => 'INSERT'
             ,x_batchstep_resource_rec      => l_batchstep_resource_rec_out
             ,x_step_status                 => l_step_status
             ,x_return_status               => l_return_status);
Line: 7388

                             || ' invoke private layer insert_batchstep_rsrc');
Line: 7391

      gme_batchstep_rsrc_pvt.insert_batchstep_rsrc
                        (p_batchstep_resource_rec      => l_batchstep_resource_rec
                        ,x_batchstep_resource_rec      => x_batchstep_resource_rec
                        ,x_return_status               => x_return_status);
Line: 7398

         insert_batchstep_rsrc returns '|| x_return_status);
Line: 7423

         RAISE insert_rsrc_failed;
Line: 7436

      WHEN insert_rsrc_failed THEN
         ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
Line: 7443

         ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
Line: 7448

        ROLLBACK TO SAVEPOINT insert_batchstep_rsrc;
Line: 7453

   END insert_batchstep_resource;
Line: 7456

   PROCEDURE update_batchstep_resource (
      p_api_version              IN              NUMBER
     ,p_validation_level         IN              NUMBER   := gme_common_pvt.g_max_errors
     ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
     ,p_batchstep_resource_rec   IN              gme_batch_step_resources%ROWTYPE
     ,p_org_code                 IN              VARCHAR2 := NULL
     ,p_batch_no                 IN              VARCHAR2 := NULL
     ,p_batchstep_no             IN              NUMBER := NULL
     ,p_activity                 IN              VARCHAR2 := NULL
     ,p_ignore_qty_below_cap     IN              VARCHAR2 := fnd_api.g_false
     ,p_validate_flexfields      IN              VARCHAR2 := fnd_api.g_false
     ,x_batchstep_resource_rec   OUT NOCOPY      gme_batch_step_resources%ROWTYPE
     ,x_message_count            OUT NOCOPY      NUMBER
     ,x_message_list             OUT NOCOPY      VARCHAR2
     ,x_return_status            OUT NOCOPY      VARCHAR2)
   IS
      l_api_name             CONSTANT VARCHAR2 (30)
                                               := 'UPDATE_BATCHSTEP_RESOURCE';
Line: 7486

         SELECT step_status
           FROM gme_batch_steps
          WHERE batchstep_id = v_batchstep_id AND batch_id = v_batch_id;
Line: 7490

      update_rsrc_failed              EXCEPTION;
Line: 7493

      SAVEPOINT update_batchstep_rsrc;
Line: 7496

         gme_debug.log_initialize ('UpdateBatchstepResource');
Line: 7510

                                         ,'update_batchstep_resource'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 7527

      /* Retrieve the row to be updated              */
      IF g_debug <= gme_debug.g_log_statement THEN
         gme_debug.put_line (   g_pkg_name
                             || '.'
                             || l_api_name
                             || 'Invoke get_batchstep_rsrc');
Line: 7554

      /* Don't overwrite any other input data which carries the updates    */
      l_batchstep_resource_rec.organization_id :=
                                  l_batchstep_resource_rec_out.organization_id;
Line: 7651

             ,p_action                      => 'UPDATE'
             ,x_batchstep_resource_rec      => l_batchstep_resource_rec_out
             ,x_step_status                 => l_step_status
             ,x_return_status               => l_return_status);
Line: 7674

                       || ' Invoke gme_batchstep_rsrc_pvt.update_batchstep_rsrc');
Line: 7677

      gme_batchstep_rsrc_pvt.update_batchstep_rsrc
                        (p_batchstep_resource_rec      => l_batchstep_resource_rec
                        ,x_batchstep_resource_rec      => x_batchstep_resource_rec
                        ,x_return_status               => x_return_status);
Line: 7686

                             || ' update_batchstep_rsrc returns '
                             || x_return_status);
Line: 7717

         RAISE update_rsrc_failed;
Line: 7730

      WHEN update_rsrc_failed THEN
         ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
Line: 7737

         ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
Line: 7742

         ROLLBACK TO SAVEPOINT update_batchstep_rsrc;
Line: 7747

   END update_batchstep_resource;
Line: 7750

   PROCEDURE delete_batchstep_resource (
      p_api_version             IN              NUMBER := 2.0
     ,p_validation_level        IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list           IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                  IN              VARCHAR2 := fnd_api.g_false
     ,p_batchstep_resource_id   IN              NUMBER := NULL
     ,p_org_code                IN              VARCHAR2 := NULL
     ,p_batch_no                IN              VARCHAR2 := NULL
     ,p_batchstep_no            IN              NUMBER := NULL
     ,p_activity                IN              VARCHAR2 := NULL
     ,p_resource                IN              VARCHAR2 := NULL
     ,x_message_count           OUT NOCOPY      NUMBER
     ,x_message_list            OUT NOCOPY      VARCHAR2
     ,x_return_status           OUT NOCOPY      VARCHAR2)
   IS
      l_api_name        CONSTANT VARCHAR2 (30) := 'DELETE_BATCHSTEP_RESOURCE';
Line: 7780

         SELECT c.organization_id, a.step_status, a.batch_id, a.batchstep_id
               ,b.batchstep_activity_id, c.batch_status
           FROM gme_batch_steps a
               ,gme_batch_step_resources b
               ,gme_batch_header c
          WHERE a.batch_id = b.batch_id
            AND a.batchstep_id = b.batchstep_id
            AND b.batchstep_resource_id = v_batchstep_rsrc_id
            AND a.batch_id = c.batch_id;
Line: 7792

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

      delete_rsrc_failed         EXCEPTION;
Line: 7801

      SAVEPOINT delete_batchstep_rsrc;
Line: 7804

         gme_debug.log_initialize ('DeleteBatchstepResource');
Line: 7818

                                         ,'delete_batchstep_resource'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 8008

         			' invoke gme_batchstep_rsrc_pvt.delete_batchstep_rsrc ');
Line: 8021

      gme_batchstep_rsrc_pvt.delete_batchstep_rsrc
                        (p_batchstep_resource_rec      => l_batchstep_resource_rec
                        ,x_return_status               => x_return_status);
Line: 8027

         			status from delete is ' || x_return_status);
Line: 8052

         RAISE delete_rsrc_failed;
Line: 8064

      WHEN delete_rsrc_failed THEN
         ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
Line: 8071

         ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
Line: 8076

         ROLLBACK TO SAVEPOINT delete_batchstep_rsrc;
Line: 8081

   END delete_batchstep_resource;
Line: 8107

         SELECT *
           FROM mtl_reservations
          WHERE reservation_id = v_reservation_id;
Line: 8373

     /* Verify that update_inventory is permitted for this batch */
     IF l_batch_header_rec.update_inventory_ind <> 'Y' THEN
       gme_common_pvt.log_message ('GME_INVENTORY_UPDATE_BLOCKED');
Line: 8449

      insert_batchstep_activity
    Description
      This procedure is used to insert an activity for a step

    Parameters
      p_batchstep_activity_rec (R)    activity to be inserted for a step
      p_batchstep_resource_tbl (R) one or more resources to be inserted for the activity
      p_org_code (O)              organization code
      p_batch_no (O)              batch number
      p_batchstep_no(O)           batch step number
      p_ignore_qty_below_cap (O)  controls - allow rsrc_qty going below rsrc capacity
      p_validate_flexfield (O)    Whether to validate the flexfields
      x_batchstep_activity_rec        newly inserted activity row, can be used for update etc
      x_return_status             outcome of the API call
                                  S - Success
                                  E - Error
                                  U - Unexpected Error
    HISTORY
     Sivakumar.G FPBug#4395561 16-NOV-2005
     Code changes made to set global flex field validate flag

      13-MAY-2010  G. Muratore     Bug 13072622
        Conditionalize call to save batch using p_commit value.
================================================================================*/
   PROCEDURE insert_batchstep_activity (
      p_api_version              IN              NUMBER ,
      p_validation_level         IN              NUMBER
            := gme_common_pvt.g_max_errors,
      p_init_msg_list            IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_commit                   IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_org_code                 IN              VARCHAR2,
      p_batchstep_activity_rec   IN              gme_batch_step_activities%ROWTYPE,
      p_batchstep_resource_tbl   IN              gme_create_step_pvt.resources_tab,
      p_batch_no                 IN              VARCHAR2 := NULL,
      p_batchstep_no             IN              NUMBER := NULL,
      p_ignore_qty_below_cap     IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_validate_flexfield       IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      x_batchstep_activity_rec   OUT NOCOPY      gme_batch_step_activities%ROWTYPE,
      x_message_count            OUT NOCOPY      NUMBER,
      x_message_list             OUT NOCOPY      VARCHAR2,
      x_return_status            OUT NOCOPY      VARCHAR2
   )
   IS
      l_api_name            CONSTANT VARCHAR2 (30) := 'INSERT_BATCHSTEP_ACTIVITY';
Line: 8498

      insert_activity_failed         EXCEPTION;
Line: 8501

      SAVEPOINT insert_activity_pub;
Line: 8505

         gme_debug.log_initialize ('InsertBatchstepActivity');
Line: 8549

      gme_batchstep_act_pvt.insert_batchstep_activity (p_batchstep_activity_rec      => p_batchstep_activity_rec,
                                                       p_batchstep_resource_tbl      => p_batchstep_resource_tbl,
                                                       p_org_code                    => p_org_code,
                                                       p_batch_no                    => p_batch_no,
                                                       p_batchstep_no                => p_batchstep_no,
                                                       p_ignore_qty_below_cap        => p_ignore_qty_below_cap,
                                                       p_validate_flexfield          => p_validate_flexfield,
                                                       x_batchstep_activity_rec      => x_batchstep_activity_rec,
                                                       x_return_status               => x_return_status
                                                      );
Line: 8563

         RAISE insert_activity_failed;
Line: 8594

      WHEN insert_activity_failed THEN
         ROLLBACK TO SAVEPOINT insert_activity_pub;
Line: 8601

         ROLLBACK TO SAVEPOINT insert_activity_pub;
Line: 8608

         ROLLBACK TO SAVEPOINT insert_activity_pub;
Line: 8613

   END insert_batchstep_activity;
Line: 8617

      update_batchstep_activity
    Description
      This procedure is used to update an activity for a step

    Parameters
      p_batchstep_activity (R)    activity to be updated
      p_org_code (O)              organization code
      p_batch_no (O)              batch number
      p_batchstep_no(O)           batch step number
      p_validate_flexfield (O)    Whether to validate the flexfields
      x_batchstep_activity        updated activity row
      x_return_status             outcome of the API call
                                  S - Success
                                  E - Error
                                  U - Unexpected Error
   HISTORY
     Sivakumar.G FPBug#4395561 16-NOV-2005
     Code changes made to set global flex field validate flag
  ================================================================================*/
   PROCEDURE update_batchstep_activity (
      p_api_version              IN              NUMBER ,
      p_validation_level         IN              NUMBER
            := gme_common_pvt.g_max_errors,
      p_init_msg_list            IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_commit                   IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_org_code                 IN              VARCHAR2,
      p_batchstep_activity_rec   IN              gme_batch_step_activities%ROWTYPE,
      p_batch_no                 IN              VARCHAR2 := NULL,
      p_batchstep_no             IN              NUMBER := NULL,
      p_validate_flexfield       IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      x_batchstep_activity_rec   OUT NOCOPY      gme_batch_step_activities%ROWTYPE,
      x_message_count            OUT NOCOPY      NUMBER,
      x_message_list             OUT NOCOPY      VARCHAR2,
      x_return_status            OUT NOCOPY      VARCHAR2
   )
   IS
      l_api_name   CONSTANT  VARCHAR2 (30) := 'UPDATE_BATCHSTEP_ACTIVITY';
Line: 8657

      update_activity_failed EXCEPTION;
Line: 8660

      SAVEPOINT update_activity_pub;
Line: 8663

         gme_debug.log_initialize ('UpdateBatchstepActivity');
Line: 8705

      gme_batchstep_act_pvt.update_batchstep_activity (p_batchstep_activity_rec      => p_batchstep_activity_rec,
                                                       p_org_code                    => p_org_code,
                                                       p_batch_no                    => p_batch_no,
                                                       p_batchstep_no                => p_batchstep_no,
                                                       p_validate_flexfield          => p_validate_flexfield,
                                                       x_batchstep_activity_rec      => x_batchstep_activity_rec,
                                                       x_return_status               => x_return_status
                                                      );
Line: 8717

         RAISE update_activity_failed;
Line: 8747

     WHEN update_activity_failed THEN
         ROLLBACK TO SAVEPOINT update_activity_pub;
Line: 8754

         ROLLBACK TO SAVEPOINT update_activity_pub;
Line: 8761

         ROLLBACK TO SAVEPOINT update_activity_pub;
Line: 8766

   END update_batchstep_activity;
Line: 8770

      delete_batchstep_activity
    Description
      This procedure is used to delete an activity from a step.  Note that either the
      activity_id must be provided or the combination of organization_code, batch_no, batchstep_no,
      and activity in order to uniquely identify an activity to be deleted.

    Parameters
      p_batchstep_activity_id (O) activity_id to be deleted
      p_org_code (O)              organization code
      p_batch_no (O)              batch number
      p_batchstep_no(O)           batch step number
      p_activity(O)               activity
      x_return_status             outcome of the API call
                                  S - Success
                                  E - Error
                                  U - Unexpected Error
  ================================================================================*/
   PROCEDURE delete_batchstep_activity (
      p_api_version             IN              NUMBER := 2.0,
      p_validation_level        IN              NUMBER
            := gme_common_pvt.g_max_errors,
      p_init_msg_list           IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_commit                  IN              VARCHAR2
            DEFAULT fnd_api.g_false,
      p_org_code                IN              VARCHAR2,
      p_batchstep_activity_id   IN              NUMBER := NULL,
      p_batch_no                IN              VARCHAR2 := NULL,
      p_batchstep_no            IN              NUMBER := NULL,
      p_activity                IN              VARCHAR2 := NULL,
      x_message_count           OUT NOCOPY      NUMBER,
      x_message_list            OUT NOCOPY      VARCHAR2,
      x_return_status           OUT NOCOPY      VARCHAR2
   )
   IS
      l_api_name   CONSTANT  VARCHAR2 (30) := 'DELETE_BATCHSTEP_ACTIVITY';
Line: 8807

      delete_activity_failed EXCEPTION;
Line: 8810

      SAVEPOINT delete_activity_pub;
Line: 8848

      gme_batchstep_act_pvt.delete_batchstep_activity (p_batchstep_activity_id      => p_batchstep_activity_id,
                                                       p_org_code                   => p_org_code,
                                                       p_batch_no                   => p_batch_no,
                                                       p_batchstep_no               => p_batchstep_no,
                                                       p_activity                   => p_activity,
                                                       x_return_status              => x_return_status
                                                      );
Line: 8856

         RAISE delete_activity_failed;
Line: 8887

      WHEN delete_activity_failed THEN
         ROLLBACK TO SAVEPOINT delete_activity_pub;
Line: 8894

         ROLLBACK TO SAVEPOINT delete_activity_pub;
Line: 8901

          ROLLBACK TO SAVEPOINT delete_activity_pub;
Line: 8906

   END delete_batchstep_activity;
Line: 9308

      update_pending_product_lot
    Description
      This procedure is used to update a pending product lot record for a specified
      pending product lot record
      Following key sequences can be specified:
      pending_product_lot_id OR
      batch_id, line_no, line_type, sequence OR
      batch_no, org_code, line_no, line_type, sequence (batch_type is assumed to be Batch)

    Parameters
      p_batch_header_rec (O)      batch header record
      p_org_code (O)              organization code
      p_material_detail_rec (O)   material detail record
      p_pending_product_lots_rec (R) pending product lots record
      x_return_status             outcome of the API call
                                  S - Success
                                  E - Error
                                  U - Unexpected Error
  ================================================================================*/

  PROCEDURE update_pending_product_lot
     (p_api_version              IN              NUMBER
     ,p_validation_level         IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
     ,x_message_count            OUT NOCOPY      NUMBER
     ,x_message_list             OUT NOCOPY      VARCHAR2
     ,x_return_status            OUT NOCOPY      VARCHAR2
     ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
     ,p_org_code                 IN              VARCHAR2
     ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
     ,p_pending_product_lots_rec IN              gme_pending_product_lots%ROWTYPE
     ,x_pending_product_lots_rec OUT NOCOPY      gme_pending_product_lots%ROWTYPE)
   IS
      l_api_name           CONSTANT VARCHAR2 (30)  := 'UPDATE_PENDING_PRODUCT_LOT';
Line: 9354

      error_update_pp_lot        EXCEPTION;
Line: 9357

         gme_debug.log_initialize ('UpdatePendingProdLot');
Line: 9369

      SAVEPOINT update_pending_product_lot;
Line: 9377

                                         ,'update_pending_prod_lot'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 9441

      gme_pending_product_lots_pvt.validate_material_for_update
                        (p_batch_header_rec          => l_batch_header_rec
                        ,p_material_detail_rec       => l_material_detail_rec
                        ,x_return_status             => x_return_status);
Line: 9450

      gme_pending_product_lots_pvt.validate_record_for_update
                        (p_material_detail_rec             => l_material_detail_rec
                        ,p_db_pending_product_lots_rec     => l_db_pending_product_lots_rec
                        ,p_pending_product_lots_rec        => p_pending_product_lots_rec
                        ,x_pending_product_lots_rec        => l_pending_product_lots_rec
                        ,x_return_status                   => x_return_status);
Line: 9462

      gme_api_main.update_pending_product_lot
                         (p_validation_level            => p_validation_level
                         ,p_init_msg_list               => fnd_api.g_false
                         ,x_message_count               => x_message_count
                         ,x_message_list                => x_message_list
                         ,x_return_status               => x_return_status
                         ,p_org_id                      => l_batch_header_rec.organization_id
                         ,p_pending_product_lots_rec    => l_pending_product_lots_rec
                         ,x_pending_product_lots_rec    => x_pending_product_lots_rec);
Line: 9478

             || ' Return status from gme_api_main.update_pending_product_lot is '
             || x_return_status);
Line: 9483

         RAISE error_update_pp_lot;
Line: 9522

      WHEN error_update_pp_lot THEN
         ROLLBACK TO SAVEPOINT update_pending_product_lot;
Line: 9529

         ROLLBACK TO SAVEPOINT update_pending_product_lot;
Line: 9536

        ROLLBACK TO SAVEPOINT update_pending_product_lot;
Line: 9542

   END update_pending_product_lot;
Line: 9546

      Delete_pending_product_lot
    Description
      This procedure is used to delete a pending product lot record for a specified
      pending product lot record
      Following key sequences can be specified:
      pending_product_lot_id OR
      batch_id, line_no, line_type, sequence OR
      batch_no, org_code, line_no, line_type, sequence (batch_type is assumed to be Batch)

    Parameters
      p_batch_header_rec (O)      batch header record
      p_org_code (O)              organization code
      p_material_detail_rec (O)   material detail record
      p_pending_product_lots_rec (R) pending product lots record
      x_return_status             outcome of the API call
                                  S - Success
                                  E - Error
                                  U - Unexpected Error
  ================================================================================*/

  PROCEDURE delete_pending_product_lot
     (p_api_version              IN              NUMBER
     ,p_validation_level         IN              NUMBER
            := gme_common_pvt.g_max_errors
     ,p_init_msg_list            IN              VARCHAR2 := fnd_api.g_false
     ,p_commit                   IN              VARCHAR2 := fnd_api.g_false
     ,x_message_count            OUT NOCOPY      NUMBER
     ,x_message_list             OUT NOCOPY      VARCHAR2
     ,x_return_status            OUT NOCOPY      VARCHAR2
     ,p_batch_header_rec         IN              gme_batch_header%ROWTYPE
     ,p_org_code                 IN              VARCHAR2
     ,p_material_detail_rec      IN              gme_material_details%ROWTYPE
     ,p_pending_product_lots_rec IN              gme_pending_product_lots%ROWTYPE)
   IS
      l_api_name           CONSTANT VARCHAR2 (30)  := 'DELETE_PENDING_PRODUCT_LOT';
Line: 9596

      error_delete_pp_lot        EXCEPTION;
Line: 9600

         gme_debug.log_initialize ('DeletePendingProdLot');
Line: 9612

      SAVEPOINT delete_pending_product_lot;
Line: 9620

                                         ,'delete_pending_prod_lot'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 9682

      gme_pending_product_lots_pvt.validate_material_for_delete
                        (p_batch_header_rec          => l_batch_header_rec
                        ,p_material_detail_rec       => l_material_detail_rec
                        ,x_return_status             => x_return_status);
Line: 9691

      gme_pending_product_lots_pvt.validate_record_for_delete
                        (p_material_detail_rec             => l_material_detail_rec
                        ,p_db_pending_product_lots_rec     => l_db_pending_product_lots_rec
                        ,p_pending_product_lots_rec        => p_pending_product_lots_rec
                        ,x_pending_product_lots_rec        => l_pending_product_lots_rec
                        ,x_return_status                   => x_return_status);
Line: 9703

      gme_api_main.delete_pending_product_lot
                         (p_validation_level            => p_validation_level
                         ,p_init_msg_list               => fnd_api.g_false
                         ,x_message_count               => x_message_count
                         ,x_message_list                => x_message_list
                         ,x_return_status               => x_return_status
                         ,p_org_id                      => l_batch_header_rec.organization_id
                         ,p_pending_product_lots_rec    => l_pending_product_lots_rec);
Line: 9718

             || ' Return status from gme_api_main.delete_pending_product_lot is '
             || x_return_status);
Line: 9723

         RAISE error_delete_pp_lot;
Line: 9763

      WHEN error_delete_pp_lot THEN
         ROLLBACK TO SAVEPOINT delete_pending_product_lot;
Line: 9769

         ROLLBACK TO SAVEPOINT delete_pending_product_lot;
Line: 9775

        ROLLBACK TO SAVEPOINT delete_pending_product_lot;
Line: 9780

   END delete_pending_product_lot;
Line: 9834

         SELECT  COUNT(1)
         FROM mtl_material_transactions mmt, gme_material_details mtl
         WHERE NVL(transfer_lpn_id,0) > 0
           AND TRANSACTION_SOURCE_ID = p_batch_id
           AND transaction_action_id = 31
           AND transaction_type_id IN (44, 1002)
           AND mmt.transaction_source_id = mtl.batch_id
           AND mmt.inventory_item_id = mtl.inventory_item_id
           AND mmt.transaction_id NOT IN (
           SELECT transaction_id1
                    FROM gme_transaction_pairs
                    WHERE batch_id = p_batch_id
                    AND pair_type = 1);
Line: 10370

                                                  ,p_delete_invis_mo          => 'F'
                                                  ,p_delete_reservations      => 'T'
                                                  ,p_delete_trans_pairs       => 'F'
                                                  ,p_recursive                => 'R'
                                                  ,x_return_status            => x_return_status);
Line: 11240

         SELECT organization_id
           FROM mtl_parameters
          WHERE organization_code = p_org_code;
Line: 11246

         SELECT group_id
           FROM gme_batch_groups_b
          WHERE organization_id = l_org_id AND group_name = l_group_name;
Line: 11252

         SELECT lookup_code FROM gem_lookups
         WHERE lookup_type = 'GME_BATCH_GROUP_ACTION'
         AND lookup_code = l_lookup_code
         AND lookup_code NOT IN (1,2);
Line: 11259

         SELECT batch_id
         FROM gme_batch_groups_association
         WHERE group_id = l_group_id;
Line: 11265

         SELECT batch_status
         FROM gme_batch_header
         WHERE batch_id = l_batch_id
         and organization_id = l_org_id;
Line: 11573

      update_batchstep_qty
    Description
      This api procedure is used only for updating actual_step_qty.
      Charges will also be recalculated.
      One of the following key sequences must be specified:
      batchstep_id
      batch_id, batchstep_no OR
      batch_no, org_code, batchstep_no batch_type assumed to be batch

    Parameters
      p_batch step_rec (O)        batch step to identify the step to update.
      p_org_code (O)              organization code to identify the step is conjunction with batch_no in p_batch_header_rec
      p_batch_no (O)              batch_no to identify the step
      p_add (O)                   indicates whether to add to the actual step qty for incremental
                                  recording or overwrite. Default is 'N' Meaning overwrite.
      x_batch_step_rec            Output batch step record after update
      x_return_status             outcome of the API call
                                  S - Success
                                  E - Error
                                  U - Unexpected Error
                                  X - Batch Exception

    History:
      G. Muratore    15-JUN-2009  Bug 7447757
         Introduced new api for update actual_step_qty
         PROCEDURE update_batchstep_qty. Charges will also be recalculated.
  ================================================================================*/
   PROCEDURE update_batchstep_qty (
      p_api_version         IN              NUMBER   := 1.0
     ,p_validation_level    IN              NUMBER   := gme_common_pvt.g_max_errors
     ,p_init_msg_list       IN              VARCHAR2 := fnd_api.g_false
     ,p_commit              IN              VARCHAR2
     ,p_org_code            IN              VARCHAR2
     ,p_batch_no            IN              VARCHAR2 := NULL
     ,p_add                 IN              VARCHAR2 := 'N'
     ,p_batch_step_rec      IN              gme_batch_steps%ROWTYPE
     ,x_batch_step_rec      OUT NOCOPY      gme_batch_steps%ROWTYPE
     ,x_message_count       OUT NOCOPY      NUMBER
     ,x_message_list        OUT NOCOPY      VARCHAR2
     ,x_return_status       OUT NOCOPY      VARCHAR2)

   IS
      l_api_name             CONSTANT VARCHAR2 (30)
                                               := 'UPDATE_STEP';
Line: 11626

      update_step_failed              EXCEPTION;
Line: 11629

      SAVEPOINT update_batchstep_qty;
Line: 11632

         gme_debug.log_initialize ('UpdateBatchstep');
Line: 11647

                                         ,'update_batchstep'
                                         ,g_pkg_name) THEN
         gme_common_pvt.log_message ('GME_INVALID_API_VERSION');
Line: 11661

      /* Retrieve the row to be updated              */
      IF g_debug <= gme_debug.g_log_statement THEN
         gme_debug.put_line ('actual qty passed in is '||p_batch_step_rec.actual_step_qty);
Line: 11781

         gme_update_step_qty_pvt.recalculate_charges(p_batchstep_rec => l_batch_step_rec
                                                    ,p_cal_type      => 'P'
                                                    ,x_batchstep_rec => l_batch_step_rec2
                                                    ,x_return_status => x_return_status );
Line: 11844

            RAISE update_step_failed;
Line: 11849

                                    ,p_message_code => 'IEM_NOTHING_TO_UPDATE');
Line: 11857

      WHEN l_invalid_step_status OR negative_qty_error OR update_step_failed THEN
         ROLLBACK TO SAVEPOINT update_batchstep_qty;
Line: 11865

         ROLLBACK TO SAVEPOINT update_batchstep_qty;
Line: 11870

         ROLLBACK TO SAVEPOINT update_batchstep_qty;
Line: 11875

   END update_batchstep_qty;