1222: SUM ( NVL((NVL(d.wip_plan_qty, d.plan_qty) - d.actual_qty), 0) *
1223: (original_primary_qty/original_qty))
1224: INTO l_qty
1225: FROM gme_material_details d
1226: , gme_batch_header h
1227: WHERE h.batch_type IN (0,10)
1228: AND h.batch_status IN (1,2)
1229: AND h.batch_id = d.batch_id
1230: AND d.inventory_item_id = p_item_id
2010: SUM (( NVL((NVL(d.wip_plan_qty, d.plan_qty) - d.actual_qty), 0) *
2011: (d.original_primary_qty/d.original_qty)) - NVL(mtr.primary_reservation_quantity,0))
2012: INTO qty
2013: FROM gme_material_details d
2014: , gme_batch_header h
2015: , mtl_reservations mtr
2016: WHERE h.batch_type IN (0,10)
2017: AND h.batch_status IN (1,2)
2018: AND h.batch_id = d.batch_id
4406: , x_ret_stat OUT NOCOPY VARCHAR2
4407: , x_ret_mesg OUT NOCOPY VARCHAR2) IS
4408:
4409:
4410: l_gme_batch_header GME_BATCH_HEADER%ROWTYPE;
4411: l_eff_id NUMBER(15);
4412: batch_exc EXCEPTION;
4413: x_message_count NUMBER;
4414: x_message_list VARCHAR2(1000);
4412: batch_exc EXCEPTION;
4413: x_message_count NUMBER;
4414: x_message_list VARCHAR2(1000);
4415: return_status VARCHAR2(1000);
4416: x_gme_batch_header gme_batch_header%ROWTYPE;
4417: x_exception_material_tbl gmp_batch_wrapper_pkg.exceptions_tab;
4418:
4419: BEGIN
4420:
4437: RAISE batch_exc;
4438: ELSE
4439: fnd_profile.initialize(p_user_id);
4440:
4441: l_gme_batch_header.organization_id := p_organization_id;
4442: l_gme_batch_header.plan_cmplt_date := p_nb_time;
4443: l_gme_batch_header.due_date := p_nb_time;
4444: l_gme_batch_header.batch_type := 0; /* 0 for batches, 10 for FPOs */
4445: l_gme_batch_header.update_inventory_ind := 'Y' ;
4438: ELSE
4439: fnd_profile.initialize(p_user_id);
4440:
4441: l_gme_batch_header.organization_id := p_organization_id;
4442: l_gme_batch_header.plan_cmplt_date := p_nb_time;
4443: l_gme_batch_header.due_date := p_nb_time;
4444: l_gme_batch_header.batch_type := 0; /* 0 for batches, 10 for FPOs */
4445: l_gme_batch_header.update_inventory_ind := 'Y' ;
4446: -- l_gme_batch_header.RECIPE_VALIDITY_RULE_ID := l_eff_id ;
4439: fnd_profile.initialize(p_user_id);
4440:
4441: l_gme_batch_header.organization_id := p_organization_id;
4442: l_gme_batch_header.plan_cmplt_date := p_nb_time;
4443: l_gme_batch_header.due_date := p_nb_time;
4444: l_gme_batch_header.batch_type := 0; /* 0 for batches, 10 for FPOs */
4445: l_gme_batch_header.update_inventory_ind := 'Y' ;
4446: -- l_gme_batch_header.RECIPE_VALIDITY_RULE_ID := l_eff_id ;
4447:
4440:
4441: l_gme_batch_header.organization_id := p_organization_id;
4442: l_gme_batch_header.plan_cmplt_date := p_nb_time;
4443: l_gme_batch_header.due_date := p_nb_time;
4444: l_gme_batch_header.batch_type := 0; /* 0 for batches, 10 for FPOs */
4445: l_gme_batch_header.update_inventory_ind := 'Y' ;
4446: -- l_gme_batch_header.RECIPE_VALIDITY_RULE_ID := l_eff_id ;
4447:
4448: IF G_TRACE_ON = 1 THEN
4441: l_gme_batch_header.organization_id := p_organization_id;
4442: l_gme_batch_header.plan_cmplt_date := p_nb_time;
4443: l_gme_batch_header.due_date := p_nb_time;
4444: l_gme_batch_header.batch_type := 0; /* 0 for batches, 10 for FPOs */
4445: l_gme_batch_header.update_inventory_ind := 'Y' ;
4446: -- l_gme_batch_header.RECIPE_VALIDITY_RULE_ID := l_eff_id ;
4447:
4448: IF G_TRACE_ON = 1 THEN
4449: print_debug('Calling the GMP Create_Batch Wrapper API', 're_batch', 9);
4442: l_gme_batch_header.plan_cmplt_date := p_nb_time;
4443: l_gme_batch_header.due_date := p_nb_time;
4444: l_gme_batch_header.batch_type := 0; /* 0 for batches, 10 for FPOs */
4445: l_gme_batch_header.update_inventory_ind := 'Y' ;
4446: -- l_gme_batch_header.RECIPE_VALIDITY_RULE_ID := l_eff_id ;
4447:
4448: IF G_TRACE_ON = 1 THEN
4449: print_debug('Calling the GMP Create_Batch Wrapper API', 're_batch', 9);
4450: END IF;
4457: ,x_message_count => x_message_count
4458: ,x_message_list => x_message_list
4459: ,x_return_status => return_status
4460: ,p_org_code => NULL
4461: ,p_batch_header_rec => l_gme_batch_header
4462: ,x_batch_header_rec => x_gme_batch_header
4463: ,p_batch_size => p_qty
4464: ,p_batch_size_uom => p_uom
4465: ,p_creation_mode => 'PRODUCT'
4458: ,x_message_list => x_message_list
4459: ,x_return_status => return_status
4460: ,p_org_code => NULL
4461: ,p_batch_header_rec => l_gme_batch_header
4462: ,x_batch_header_rec => x_gme_batch_header
4463: ,p_batch_size => p_qty
4464: ,p_batch_size_uom => p_uom
4465: ,p_creation_mode => 'PRODUCT'
4466: ,p_recipe_id => NULL
4486: END IF;
4487: RAISE batch_exc;
4488: ELSE
4489: IF G_TRACE_ON = 1 THEN
4490: print_debug('Created batch with batch_id '||to_char(x_gme_batch_header.batch_id)
4491: , 're_batch', 9);
4492: END IF;
4493: END IF;
4494: