63:
64: PROCEDURE set_move_to_temp_off
65: IS
66: BEGIN
67: gme_common_pvt.g_move_to_temp := fnd_api.g_false;
68: END set_move_to_temp_off;
69:
70: -- nsinghi bug#5176319. Added this proc.
71: /* This procedure will take care of deleting the table g_mat_txn_hdr_tbl. This table should be
269: ,x_out_rec => l_gmd_params_rec
270: ,x_return_status => l_return_status);
271:
272: /*Assign the gmd params values to package variables */
273: IF l_return_status = fnd_api.g_ret_sts_success THEN
274: gme_common_pvt.g_plant_ind := l_gmd_params_rec.plant_ind;
275: gme_common_pvt.g_lab_ind := l_gmd_params_rec.lab_ind;
276: gme_common_pvt.g_yield_type := l_gmd_params_rec.fm_yield_type;
277: gme_common_pvt.g_release_type := l_gmd_params_rec.steprelease_type;
473: l_message_list VARCHAR2 (2000);
474: l_api_name CONSTANT VARCHAR2 (30) := 'GET_WHO';
475: BEGIN
476: /* Set the return status to success initially */
477: x_return_status := fnd_api.g_ret_sts_success;
478:
479: IF gme_common_pvt.g_user_ident IS NULL THEN
480: set_who;
481: END IF;
484: x_login_id := gme_common_pvt.g_login_id;
485: x_timestamp := gme_common_pvt.g_timestamp;
486: EXCEPTION
487: WHEN OTHERS THEN
488: x_return_status := fnd_api.g_ret_sts_unexp_error;
489: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
490: fnd_msg_pub.count_and_get (p_count => l_message_count
491: ,p_data => l_message_list);
492:
538: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
539: || l_api_name);
540: END IF;
541:
542: x_return_status := fnd_api.g_ret_sts_success;
543:
544: OPEN cur_supply_defaults (p_organization_id, p_inventory_item_id);
545:
546: FETCH cur_supply_defaults
621: || ' Error is '
622: || SQLERRM);
623: END IF;
624:
625: x_return_status := fnd_api.g_ret_sts_unexp_error;
626: END get_supply_defaults;
627:
628: PROCEDURE get_yield_defaults (
629: p_organization_id IN NUMBER
665: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
666: || l_api_name);
667: END IF;
668:
669: x_return_status := fnd_api.g_ret_sts_success;
670:
671: OPEN cur_yield_defaults (p_organization_id, p_inventory_item_id);
672:
673: FETCH cur_yield_defaults
747: || ' Error is '
748: || SQLERRM);
749: END IF;
750:
751: x_return_status := fnd_api.g_ret_sts_unexp_error;
752: END get_yield_defaults;
753:
754: PROCEDURE construct_material_detail (
755: p_formula_detail_rec IN fm_matl_dtl%ROWTYPE
816: ,x_locator_id => x_material_detail_rec.locator_id
817: ,x_return_status => l_return_status);
818: END IF;
819:
820: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
821: RAISE get_defaults_err;
822: END IF;
823:
824: x_return_status := fnd_api.g_ret_sts_success;
820: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
821: RAISE get_defaults_err;
822: END IF;
823:
824: x_return_status := fnd_api.g_ret_sts_success;
825:
826: IF g_debug <= gme_debug.g_log_procedure THEN
827: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
828: END IF;
840: || ' Error is '
841: || SQLERRM);
842: END IF;
843:
844: x_return_status := fnd_api.g_ret_sts_unexp_error;
845: END construct_material_detail;
846:
847: FUNCTION get_process_loss (
848: p_batch_id IN NUMBER DEFAULT NULL
1419: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1420: || l_api_name);
1421: END IF;
1422:
1423: x_return_status := fnd_api.g_ret_sts_success;
1424:
1425: IF p_mtl_dtl_rec.release_type IN
1426: (gme_common_pvt.g_mtl_manual_release
1427: ,gme_common_pvt.g_mtl_incremental_release
1492: || SQLERRM);
1493: END IF;
1494:
1495: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1496: x_return_status := fnd_api.g_ret_sts_unexp_error;
1497: END calc_mtl_req_date;
1498:
1499: FUNCTION is_qty_below_capacity (
1500: p_batch_step_resources_rec IN gme_batch_step_resources%ROWTYPE)
2281: END IF;
2282:
2283: gmd_val_data_pub.get_val_data
2284: (p_api_version => 1
2285: ,p_init_msg_list => fnd_api.g_false
2286: ,p_object_type => p_object_type
2287: ,p_recipe_no => NULL
2288: ,p_recipe_version => NULL
2289: ,p_recipe_id => NULL
2305: ,x_msg_data => l_msg_data
2306: ,x_return_code => l_return_code
2307: ,x_recipe_validity_out => l_recipe_validity_tbl);
2308:
2309: IF l_return_status <> fnd_api.g_ret_sts_success
2310: OR l_recipe_validity_tbl.COUNT <= 0 THEN
2311: RAISE validation_failure;
2312: END IF;
2313:
2470: END IF;
2471: IF g_debug <= gme_debug.g_log_procedure THEN
2472: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
2473: END IF;
2474: x_return_status := fnd_api.g_ret_sts_success;
2475: IF NOT (gme_common_pvt.g_setup_done) THEN
2476: IF NOT (gme_common_pvt.setup (p_org_id => p_organization_id) ) THEN
2477: RAISE setup_failure;
2478: END IF;
2518: ,p_item_location_control => NVL(l_item_rec.location_control_code,1)
2519: ,p_item_restrict_locators => l_item_rec.restrict_locators_code
2520: ,x_open_qty => l_open_qty
2521: ,x_return_status => l_return_status);
2522: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2523: RAISE get_open_qty_err;
2524: ELSE
2525: IF (l_mtl_dtl_rec.dtl_um = l_item_rec.primary_uom_code) THEN
2526: l_open_qty_prim := l_open_qty;
2595: ,x_sqr => l_sqr
2596: ,x_sqs => l_sqs
2597: ,x_satt => l_satt
2598: ,x_satr => l_satr);
2599: IF (l_return_status = fnd_api.g_ret_sts_success) THEN
2600: IF g_debug <= gme_debug.g_log_statement THEN
2601: gme_debug.put_line('Item level qtys');
2602: gme_debug.put_line('l_qoh = ' || l_qoh);
2603: gme_debug.put_line('l_att = ' || l_att);
2662: ,x_sqr => l_sqr
2663: ,x_sqs => l_sqs
2664: ,x_satt => l_satt
2665: ,x_satr => l_satr);
2666: IF (l_return_status = fnd_api.g_ret_sts_success) THEN
2667: IF g_debug <= gme_debug.g_log_statement THEN
2668: gme_debug.put_line('Item/Revision/Sub level qtys');
2669: gme_debug.put_line('l_qoh = ' || l_qoh);
2670: gme_debug.put_line('l_att = ' || l_att);
2767: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2768: END IF;
2769: EXCEPTION
2770: WHEN setup_failure THEN
2771: x_return_status := fnd_api.g_ret_sts_error;
2772: WHEN get_open_qty_err OR unable_to_query_tree THEN
2773: x_return_status := l_return_status;
2774: IF (cur_get_materials%ISOPEN) THEN
2775: CLOSE cur_get_materials;
2774: IF (cur_get_materials%ISOPEN) THEN
2775: CLOSE cur_get_materials;
2776: END IF;
2777: WHEN uom_conv_error THEN
2778: x_return_status := fnd_api.g_ret_sts_error;
2779: fnd_message.set_name ('GMI', 'IC_API_UOM_CONVERSION_ERROR');
2780: fnd_message.set_token ('ITEM_NO', l_item_rec.concatenated_segments);
2781: fnd_message.set_token ('FROM_UOM', l_mtl_dtl_rec.dtl_um);
2782: fnd_message.set_token ('TO_UOM', l_item_rec.primary_uom_code);
2784: CLOSE cur_get_materials;
2785: END IF;
2786: fnd_msg_pub.add;
2787: WHEN exception_ins_err THEN
2788: x_return_status := fnd_api.g_ret_sts_unexp_error;
2789: IF (cur_get_materials%ISOPEN) THEN
2790: CLOSE cur_get_materials;
2791: END IF;
2792: WHEN OTHERS THEN
2801: IF (cur_get_materials%ISOPEN) THEN
2802: CLOSE cur_get_materials;
2803: END IF;
2804: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2805: x_return_status := fnd_api.g_ret_sts_unexp_error;
2806: END get_batch_shortages;
2807:
2808: PROCEDURE get_open_qty (
2809: p_mtl_dtl_rec IN gme_material_details%ROWTYPE
2839: || l_api_name);
2840: gme_debug.put_line ('Being called by ' || p_called_by);
2841: END IF;
2842:
2843: x_return_status := fnd_api.g_ret_sts_success;
2844:
2845: -- All qty should be in the detail line uom.
2846: -- all allocations excludes the invisible move orders
2847: IF p_called_by = 'S' THEN
2849: (p_mtl_dtl_rec => p_mtl_dtl_rec
2850: ,x_reserved_qty => l_reserved_qty
2851: ,x_return_status => l_return_status);
2852:
2853: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2854: RAISE get_reserved_qty_err;
2855: END IF;
2856:
2857: x_open_qty :=
2867: END IF;
2868: ELSIF p_called_by = 'P' THEN
2869: gme_reservations_pvt.get_reserved_qty
2870: (p_mtl_dtl_rec => p_mtl_dtl_rec
2871: ,p_supply_sub_only => fnd_api.g_true
2872: ,x_reserved_qty => l_reserved_qty
2873: ,x_return_status => l_return_status);
2874:
2875: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2871: ,p_supply_sub_only => fnd_api.g_true
2872: ,x_reserved_qty => l_reserved_qty
2873: ,x_return_status => l_return_status);
2874:
2875: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2876: RAISE get_reserved_qty_err;
2877: END IF;
2878:
2879: gme_move_orders_pvt.get_pending_move_order_qty
2880: (p_mtl_dtl_rec => p_mtl_dtl_rec
2881: ,x_pending_qty => l_mo_line_qty
2882: ,x_return_status => l_return_status);
2883:
2884: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2885: RAISE get_pending_qty_err;
2886: END IF;
2887:
2888: IF g_debug <= gme_debug.g_log_statement THEN
2941: ,p_material_detail_id => p_mtl_dtl_rec.material_detail_id
2942: ,x_return_status => l_return_status
2943: ,x_reservations_tbl => l_resv_tbl);
2944:
2945: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2946: RAISE get_reservations_err;
2947: END IF;
2948:
2949: FOR i IN 1 .. l_resv_tbl.COUNT LOOP
2976: ,p_uom_code => p_mtl_dtl_rec.dtl_um
2977: ,x_qty => l_temp_qty
2978: ,x_return_status => l_return_status);
2979:
2980: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
2981: RAISE get_reserved_qty_err;
2982: END IF;
2983: IF g_debug <= gme_debug.g_log_statement THEN
2984: gme_debug.put_line ( g_pkg_name
3055: || SQLERRM);
3056: END IF;
3057:
3058: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
3059: x_return_status := fnd_api.g_ret_sts_unexp_error;
3060: END get_open_qty;
3061:
3062: FUNCTION insert_exceptions (p_exception_rec IN gme_exceptions_gtmp%ROWTYPE)
3063: RETURN BOOLEAN
3275: IF p_org_code IS NULL AND p_batch_header_rec.organization_id IS NULL THEN
3276: gme_common_pvt.log_message ('GME_NO_KEYS'
3277: ,'TABLE_NAME'
3278: ,'GME_BATCH_HEADER');
3279: RAISE fnd_api.g_exc_error;
3280: ELSIF p_org_code IS NOT NULL THEN
3281: OPEN get_organization (p_org_code);
3282:
3283: FETCH get_organization
3286: IF get_organization%NOTFOUND THEN
3287: CLOSE get_organization;
3288: gme_common_pvt.log_message (p_message_code => 'IC_ORGNCODERR'
3289: ,p_product_code => 'GMI');
3290: RAISE fnd_api.g_exc_error;
3291: END IF;
3292: CLOSE get_organization;
3293: END IF;
3294:
3293: END IF;
3294:
3295: IF NVL (p_batch_header_rec.batch_type, p_batch_type) <> p_batch_type THEN
3296: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
3297: RAISE fnd_api.g_exc_error;
3298: ELSE
3299: l_batch_header_rec.batch_type :=
3300: NVL (p_batch_header_rec.batch_type, p_batch_type);
3301: END IF;
3302: END IF;
3303:
3304: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header_rec
3305: ,x_batch_header_rec) ) THEN
3306: RAISE fnd_api.g_exc_error;
3307: END IF;
3308:
3309: IF x_batch_header_rec.batch_type <> p_batch_type THEN
3310: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
3307: END IF;
3308:
3309: IF x_batch_header_rec.batch_type <> p_batch_type THEN
3310: gme_common_pvt.log_message ('GME_INVALID_BATCH_TYPE');
3311: RAISE fnd_api.g_exc_error;
3312: END IF;
3313:
3314: RETURN TRUE;
3315: EXCEPTION
3312: END IF;
3313:
3314: RETURN TRUE;
3315: EXCEPTION
3316: WHEN fnd_api.g_exc_error THEN
3317: IF g_debug <= gme_debug.g_log_error THEN
3318: gme_debug.put_line ( 'Expected error '
3319: || g_pkg_name
3320: || '.'
3372: END IF;
3373:
3374: IF NOT (gme_batch_steps_dbl.fetch_row (l_batch_step_rec
3375: ,l_batch_step_rec) ) THEN
3376: RAISE fnd_api.g_exc_error;
3377: END IF;
3378:
3379: l_batch_header_rec.batch_id := l_batch_step_rec.batch_id;
3380: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header_rec
3378:
3379: l_batch_header_rec.batch_id := l_batch_step_rec.batch_id;
3380: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header_rec
3381: ,l_batch_header_rec) ) THEN
3382: RAISE fnd_api.g_exc_error;
3383: END IF;
3384:
3385: x_batch_header_rec := l_batch_header_rec;
3386: x_batch_step_rec := l_batch_step_rec;
3385: x_batch_header_rec := l_batch_header_rec;
3386: x_batch_step_rec := l_batch_step_rec;
3387: RETURN TRUE;
3388: EXCEPTION
3389: WHEN fnd_api.g_exc_error THEN
3390: IF g_debug <= gme_debug.g_log_error THEN
3391: gme_debug.put_line ( 'Expected error '
3392: || g_pkg_name
3393: || '.'
4074: ,'MM/DD/YYYY HH24:MI:SS') );
4075: END IF;
4076:
4077: /* Initially set the return status to success */
4078: x_return_status := fnd_api.g_ret_sts_success;
4079: -- Fetch material details.
4080: l_material_detail_rec.material_detail_id := p_material_detail_id;
4081:
4082: IF NOT gme_material_details_dbl.fetch_row (l_material_detail_rec
4080: l_material_detail_rec.material_detail_id := p_material_detail_id;
4081:
4082: IF NOT gme_material_details_dbl.fetch_row (l_material_detail_rec
4083: ,l_material_detail_rec) THEN
4084: RAISE fnd_api.g_exc_error;
4085: END IF;
4086:
4087: l_batch_header_rec.batch_id := l_material_detail_rec.batch_id;
4088:
4087: l_batch_header_rec.batch_id := l_material_detail_rec.batch_id;
4088:
4089: IF NOT (gme_batch_header_dbl.fetch_row (l_batch_header_rec
4090: ,l_batch_header_rec) ) THEN
4091: RAISE fnd_api.g_exc_error;
4092: END IF;
4093:
4094: IF p_material_date IS NOT NULL THEN
4095: l_material_date := p_material_date;
4114: ,l_batchstep_rec.batchstep_id
4115: ,l_batchstep_rec.step_status) THEN
4116: IF NOT gme_batch_steps_dbl.fetch_row (l_batchstep_rec
4117: ,l_batchstep_rec) THEN
4118: RAISE fnd_api.g_exc_error;
4119: END IF;
4120: END IF;
4121:
4122: gme_common_pvt.calc_mtl_req_date
4133: || l_return_status);
4134: END IF;
4135:
4136: -- Error handling for deduce_material_date call.
4137: IF l_return_status <> fnd_api.g_ret_sts_success THEN
4138: RAISE fnd_api.g_exc_error;
4139: END IF;
4140: END IF; /* p_material_date IS NOT NULL */
4141:
4134: END IF;
4135:
4136: -- Error handling for deduce_material_date call.
4137: IF l_return_status <> fnd_api.g_ret_sts_success THEN
4138: RAISE fnd_api.g_exc_error;
4139: END IF;
4140: END IF; /* p_material_date IS NOT NULL */
4141:
4142: -- Update new material_required_date in gme_material_details.
4143: l_material_detail_rec.material_requirement_date := l_material_date;
4144:
4145: IF NOT gme_material_details_dbl.update_row
4146: (p_material_detail => l_material_detail_rec) THEN
4147: RAISE fnd_api.g_exc_error;
4148: END IF;
4149:
4150: IF (NVL (g_debug, 0) IN
4151: (gme_debug.g_log_statement, gme_debug.g_log_procedure) ) THEN
4197: || ' number of reservations is '
4198: || l_rsv_count);
4199: END IF;
4200:
4201: IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
4202: RAISE query_reservations_error;
4203: END IF;
4204: FOR k IN 1 .. l_rsv_count LOOP
4205: gme_debug.put_line ('source line id is => '|| l_rsv_tbl(k).demand_source_line_id);
4226: || x_return_status );
4227: END IF;
4228:
4229: IF (x_return_status IN
4230: (fnd_api.g_ret_sts_error, fnd_api.g_ret_sts_unexp_error) ) THEN
4231: RAISE notify_CSR_err;
4232: END IF;
4233: END IF;
4234: END LOOP;
4279: ( 'Came back from Query Reservation with status '
4280: || l_return_status);
4281: END IF;
4282:
4283: IF l_size > 0 AND l_return_status = fnd_api.g_ret_sts_success THEN
4284: /* pending reservations found; check for expired lots*/
4285: FOR j IN 1 .. l_size LOOP
4286: -- Check for lot expiration.
4287: OPEN cur_get_lot_date (l_rsv_array (j).inventory_item_id
4314: || l_return_status);
4315: END IF;
4316:
4317: -- Error handling for delete_reservation call.
4318: IF l_return_status <> fnd_api.g_ret_sts_success THEN
4319: RAISE reservation_api_failed;
4320: END IF;
4321: ELSE
4322: /* l_lot_expiration_date <= l_material_date */
4356: || l_return_status);
4357: END IF;
4358:
4359: -- Error handling for update reservation call.
4360: IF l_return_status <> fnd_api.g_ret_sts_success THEN
4361: RAISE reservation_api_failed;
4362: END IF;
4363: END IF;
4364: /* l_lot_expiration_date <= l_material_date*/
4363: END IF;
4364: /* l_lot_expiration_date <= l_material_date*/
4365: END LOOP;
4366: --FPBug#4585491 /* j in 1..l_size */
4367: ELSIF l_return_status <> fnd_api.g_ret_sts_success THEN /* If querying of reservations threw an error */
4368: RAISE reservation_api_failed;
4369: END IF; /* l_size > 0 and l_return_status = fnd_api.g_ret_sts_success */
4370:
4371: OPEN cur_get_mo_lines;
4365: END LOOP;
4366: --FPBug#4585491 /* j in 1..l_size */
4367: ELSIF l_return_status <> fnd_api.g_ret_sts_success THEN /* If querying of reservations threw an error */
4368: RAISE reservation_api_failed;
4369: END IF; /* l_size > 0 and l_return_status = fnd_api.g_ret_sts_success */
4370:
4371: OPEN cur_get_mo_lines;
4372:
4373: FETCH cur_get_mo_lines
4403: || l_return_status);
4404: END IF;
4405:
4406: -- Error handling for process_move_order_line.
4407: IF l_return_status <> fnd_api.g_ret_sts_success THEN
4408: RAISE process_move_order_failed;
4409: END IF;
4410:
4411: /* For each of the mo lines, get the corresponding allocations */
4453: || l_return_status);
4454: END IF;
4455:
4456: -- Error handling for process_move_order_line.
4457: IF l_return_status <> fnd_api.g_ret_sts_success THEN
4458: RAISE delete_allocations_failed;
4459: END IF;
4460: END IF;
4461: END LOOP; /* j in 1..l_loop_count_mo_alloc */
4479: || 'Exiting with '
4480: || x_return_status);
4481: END IF;
4482: EXCEPTION
4483: WHEN fnd_api.g_exc_error THEN
4484: x_return_status := fnd_api.g_ret_sts_error;
4485: WHEN reserv_mo_err THEN
4486: /* GME_EXPIRED_RESERV_MO_DELETED: Due to requirement date change,
4487: some reserved lots and move orders allocations expired and are hence deleted.
4480: || x_return_status);
4481: END IF;
4482: EXCEPTION
4483: WHEN fnd_api.g_exc_error THEN
4484: x_return_status := fnd_api.g_ret_sts_error;
4485: WHEN reserv_mo_err THEN
4486: /* GME_EXPIRED_RESERV_MO_DELETED: Due to requirement date change,
4487: some reserved lots and move orders allocations expired and are hence deleted.
4488: */
4510: || 'Error is :'
4511: || l_msg_data);
4512: END IF; -- 4944024 END
4513: WHEN OTHERS THEN
4514: x_return_status := fnd_api.g_ret_sts_unexp_error;
4515: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
4516:
4517: IF (NVL (g_debug, 0) > 0) THEN
4518: gme_debug.put_line ( g_pkg_name
4753: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
4754: || l_api_name);
4755: END IF;
4756: /* Set the return status to success initially */
4757: x_return_status := fnd_api.g_ret_sts_success;
4758: l_batch_header_rec := p_batch_header_rec;
4759:
4760: /* IF (p_batch_header_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
4761: gme_common_pvt.log_message(p_product_code => 'INV'
4759:
4760: /* IF (p_batch_header_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
4761: gme_common_pvt.log_message(p_product_code => 'INV'
4762: ,p_message_code => 'INV_ORG_REQUIRED');
4763: RAISE fnd_api.g_exc_error;
4764: END IF; */
4765: IF p_batch_header_rec.batch_no IS NULL AND p_batch_header_rec.batch_id IS NULL THEN
4766: gme_common_pvt.log_message ('GME_MISSING_BATCH_IDENTIFIER');
4767: RAISE fnd_api.g_exc_error;
4763: RAISE fnd_api.g_exc_error;
4764: END IF; */
4765: IF p_batch_header_rec.batch_no IS NULL AND p_batch_header_rec.batch_id IS NULL THEN
4766: gme_common_pvt.log_message ('GME_MISSING_BATCH_IDENTIFIER');
4767: RAISE fnd_api.g_exc_error;
4768: END IF;
4769: IF NOT gme_common_pvt.get_batch_header
4770: (p_batch_header_rec => p_batch_header_rec
4771: ,p_org_code => p_org_code
4780:
4781: /* Check for phantom batch */
4782: IF NVL (l_batch_header_rec.parentline_id, 0) > 0 THEN
4783: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
4784: RAISE fnd_api.g_exc_error;
4785: END IF;
4786: /* Check for migrated batch */
4787: IF NVL (l_batch_header_rec.migrated_batch_ind, 'Y') = 'Y' THEN
4788: gme_common_pvt.log_message ('GME_MIGRATED_BATCH');
4785: END IF;
4786: /* Check for migrated batch */
4787: IF NVL (l_batch_header_rec.migrated_batch_ind, 'Y') = 'Y' THEN
4788: gme_common_pvt.log_message ('GME_MIGRATED_BATCH');
4789: RAISE fnd_api.g_exc_error;
4790: END IF;
4791: gme_common_pvt.g_error_count := 0;
4792: gme_common_pvt.g_setup_done :=
4793: gme_common_pvt.setup (p_org_id => l_batch_header_rec.organization_id
4796: IF NOT gme_common_pvt.g_setup_done THEN
4797: IF (g_debug = gme_debug.g_log_statement) THEN
4798: gme_debug.put_line (g_pkg_name||'.'||l_api_name|| ':set up problem ');
4799: END IF;
4800: RAISE fnd_api.g_exc_error;
4801: ELSE
4802: l_batch_header_rec.organization_id :=
4803: gme_common_pvt.g_organization_id;
4804: END IF;
4810: gme_debug.put_line ( g_pkg_name || '.' || l_api_name || ':' ||
4811: 'exiting organization_id = ' || x_batch_header_rec.organization_id);
4812: END IF;
4813: EXCEPTION
4814: WHEN fnd_api.g_exc_error THEN
4815: x_return_status := fnd_api.g_ret_sts_error;
4816: WHEN batch_header_fetch_error THEN
4817: x_return_status := fnd_api.g_ret_sts_error;
4818: WHEN OTHERS THEN
4811: 'exiting organization_id = ' || x_batch_header_rec.organization_id);
4812: END IF;
4813: EXCEPTION
4814: WHEN fnd_api.g_exc_error THEN
4815: x_return_status := fnd_api.g_ret_sts_error;
4816: WHEN batch_header_fetch_error THEN
4817: x_return_status := fnd_api.g_ret_sts_error;
4818: WHEN OTHERS THEN
4819: IF g_debug <= gme_debug.g_log_unexpected THEN
4813: EXCEPTION
4814: WHEN fnd_api.g_exc_error THEN
4815: x_return_status := fnd_api.g_ret_sts_error;
4816: WHEN batch_header_fetch_error THEN
4817: x_return_status := fnd_api.g_ret_sts_error;
4818: WHEN OTHERS THEN
4819: IF g_debug <= gme_debug.g_log_unexpected THEN
4820: gme_debug.put_line ( 'When others exception in '
4821: || g_pkg_name|| '.'||l_api_name||'Error is '
4820: gme_debug.put_line ( 'When others exception in '
4821: || g_pkg_name|| '.'||l_api_name||'Error is '
4822: || SQLERRM);
4823: END IF;
4824: x_return_status := fnd_api.g_ret_sts_unexp_error;
4825: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
4826:
4827: END Validate_batch;
4828: /*======================================================================
4861: || l_api_name);
4862: END IF;
4863:
4864: /* Set the return status to success initially */
4865: x_return_status := fnd_api.g_ret_sts_success;
4866: l_material_detail_rec := p_material_detail_rec;
4867:
4868:
4869: /*IF (p_material_detail_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
4868:
4869: /*IF (p_material_detail_rec.organization_id IS NULL AND p_org_code IS NULL) THEN
4870: gme_common_pvt.log_message(p_product_code => 'INV'
4871: ,p_message_code => 'INV_ORG_REQUIRED');
4872: RAISE fnd_api.g_exc_error;
4873: END IF; */
4874: IF NOT gme_common_pvt.get_material_detail
4875: (p_material_detail_rec => p_material_detail_rec
4876: ,p_org_code => p_org_code
4891: * in this place */
4892: /* Check for phantom batch
4893: IF NVL (l_batch_header_rec.parentline_id, 0) > 0 THEN
4894: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
4895: RAISE fnd_api.g_exc_error;
4896: END IF; */
4897: /* Check for migrated batch */
4898: IF NVL (l_batch_header_rec.migrated_batch_ind, 'Y') = 'Y' THEN
4899: gme_common_pvt.log_message ('GME_MIGRATED_BATCH');
4896: END IF; */
4897: /* Check for migrated batch */
4898: IF NVL (l_batch_header_rec.migrated_batch_ind, 'Y') = 'Y' THEN
4899: gme_common_pvt.log_message ('GME_MIGRATED_BATCH');
4900: RAISE fnd_api.g_exc_error;
4901: END IF;
4902: gme_common_pvt.g_error_count := 0;
4903: gme_common_pvt.g_setup_done :=
4904: gme_common_pvt.setup (p_org_id => l_batch_header_rec.organization_id
4907: IF NOT gme_common_pvt.g_setup_done THEN
4908: IF (g_debug = gme_debug.g_log_statement) THEN
4909: gme_debug.put_line (g_pkg_name||'.'||l_api_name|| ':set up problem ');
4910: END IF;
4911: RAISE fnd_api.g_exc_error;
4912: ELSE
4913: l_batch_header_rec.organization_id :=
4914: gme_common_pvt.g_organization_id;
4915: END IF;
4924: 'exiting mat det_id = ' || x_material_detail_rec.material_detail_id);
4925: END IF;
4926:
4927: EXCEPTION
4928: WHEN fnd_api.g_exc_error THEN
4929: x_return_status := fnd_api.g_ret_sts_error;
4930: WHEN material_fetch_error THEN
4931: x_return_status := fnd_api.g_ret_sts_error;
4932: WHEN OTHERS THEN
4925: END IF;
4926:
4927: EXCEPTION
4928: WHEN fnd_api.g_exc_error THEN
4929: x_return_status := fnd_api.g_ret_sts_error;
4930: WHEN material_fetch_error THEN
4931: x_return_status := fnd_api.g_ret_sts_error;
4932: WHEN OTHERS THEN
4933: IF g_debug <= gme_debug.g_log_unexpected THEN
4927: EXCEPTION
4928: WHEN fnd_api.g_exc_error THEN
4929: x_return_status := fnd_api.g_ret_sts_error;
4930: WHEN material_fetch_error THEN
4931: x_return_status := fnd_api.g_ret_sts_error;
4932: WHEN OTHERS THEN
4933: IF g_debug <= gme_debug.g_log_unexpected THEN
4934: gme_debug.put_line ( 'When others exception in '
4935: || g_pkg_name
4937: || l_api_name
4938: || ' Error is '
4939: || SQLERRM);
4940: END IF;
4941: x_return_status := fnd_api.g_ret_sts_unexp_error;
4942: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
4943: gme_common_pvt.count_and_get (x_count => x_message_count
4944: ,p_encoded => fnd_api.g_false
4945: ,x_data => x_message_list);
4940: END IF;
4941: x_return_status := fnd_api.g_ret_sts_unexp_error;
4942: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
4943: gme_common_pvt.count_and_get (x_count => x_message_count
4944: ,p_encoded => fnd_api.g_false
4945: ,x_data => x_message_list);
4946: END Validate_material_detail;
4947: /*======================================================================
4948: -- PROCEDURE :
4977: IF g_debug <= gme_debug.g_log_procedure THEN
4978: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
4979: || l_api_name);
4980: END IF;
4981: x_return_status := fnd_api.g_ret_sts_success;
4982:
4983:
4984: IF NOT gme_common_pvt.get_batch_step (
4985: p_batch_step_rec => p_batch_step_rec
4992:
4993: /* Check for phantom batch */
4994: IF NVL (l_batch_header_rec.parentline_id, 0) > 0 THEN
4995: gme_common_pvt.log_message ('PM_INVALID_PHANTOM_ACTION');
4996: RAISE fnd_api.g_exc_error;
4997: END IF;
4998: /* Check for migrated batch */
4999: IF NVL (l_batch_header_rec.migrated_batch_ind, 'Y') = 'Y' THEN
5000: gme_common_pvt.log_message ('GME_MIGRATED_BATCH');
4997: END IF;
4998: /* Check for migrated batch */
4999: IF NVL (l_batch_header_rec.migrated_batch_ind, 'Y') = 'Y' THEN
5000: gme_common_pvt.log_message ('GME_MIGRATED_BATCH');
5001: RAISE fnd_api.g_exc_error;
5002: END IF;
5003:
5004: gme_common_pvt.g_error_count := 0;
5005: gme_common_pvt.g_setup_done :=
5009: IF NOT gme_common_pvt.g_setup_done THEN
5010: IF (g_debug = gme_debug.g_log_statement) THEN
5011: gme_debug.put_line (g_pkg_name||'.'||l_api_name|| ':set up problem ');
5012: END IF;
5013: RAISE fnd_api.g_exc_error;
5014: ELSE
5015: l_batch_header_rec.organization_id :=
5016: gme_common_pvt.g_organization_id;
5017: END IF;
5031: || ' BatchStep ID: '
5032: || x_batch_step_rec.batchstep_id);
5033: END IF;
5034: EXCEPTION
5035: WHEN fnd_api.g_exc_error THEN
5036: x_return_status := fnd_api.g_ret_sts_error;
5037: WHEN Step_header_fetch_error THEN
5038: x_return_status := fnd_api.g_ret_sts_error;
5039: WHEN OTHERS THEN
5032: || x_batch_step_rec.batchstep_id);
5033: END IF;
5034: EXCEPTION
5035: WHEN fnd_api.g_exc_error THEN
5036: x_return_status := fnd_api.g_ret_sts_error;
5037: WHEN Step_header_fetch_error THEN
5038: x_return_status := fnd_api.g_ret_sts_error;
5039: WHEN OTHERS THEN
5040: IF g_debug <= gme_debug.g_log_unexpected THEN
5034: EXCEPTION
5035: WHEN fnd_api.g_exc_error THEN
5036: x_return_status := fnd_api.g_ret_sts_error;
5037: WHEN Step_header_fetch_error THEN
5038: x_return_status := fnd_api.g_ret_sts_error;
5039: WHEN OTHERS THEN
5040: IF g_debug <= gme_debug.g_log_unexpected THEN
5041: gme_debug.put_line ( 'When others exception in '
5042: || g_pkg_name
5044: || l_api_name
5045: || ' Error is '
5046: || SQLERRM);
5047: END IF;
5048: x_return_status := fnd_api.g_ret_sts_unexp_error;
5049: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
5050: gme_common_pvt.count_and_get (x_count => x_message_count
5051: ,p_encoded => fnd_api.g_false
5052: ,x_data => x_message_list);
5047: END IF;
5048: x_return_status := fnd_api.g_ret_sts_unexp_error;
5049: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
5050: gme_common_pvt.count_and_get (x_count => x_message_count
5051: ,p_encoded => fnd_api.g_false
5052: ,x_data => x_message_list);
5053: END Validate_batch_step;
5054:
5055: /* Bug#5394232 Added the following procedure to default transaction date
5097: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
5098: END IF;
5099:
5100: /* initializing the return status*/
5101: x_return_status := fnd_api.g_ret_sts_success;
5102:
5103: /* fetch the material detail record */
5104: l_material_detail_rec.material_detail_id := p_material_detail_id;
5105:
5166: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
5167: END IF;
5168: EXCEPTION
5169: WHEN error_fetch_material OR error_fetch_batch_details THEN
5170: x_return_status := fnd_api.g_ret_sts_error;
5171: WHEN OTHERS THEN
5172: IF g_debug <= gme_debug.g_log_unexpected THEN
5173: gme_debug.put_line ( 'When others exception in '
5174: || g_pkg_name
5178: || SQLERRM);
5179: END IF;
5180:
5181: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
5182: x_return_status := fnd_api.g_ret_sts_unexp_error;
5183: END fetch_trans_date;
5184: /*======================================================================
5185: * -- PROCEDURE :
5186: * -- check_oprn_effectivity_dates