You are on page 1of 15

procedure POPULATE_SOLVENT_DETAILS(retcode out varchar2,errbuf out varchar2,p_pe riod in varchar2) is cursor org is select distinct ood.organization_id,ood.

organization_code from jai_cmn_inventory_orgs jic, org_organization_definitions ood where ood.organization_id = jic.master_organization_id and ood.operating_unit = 83 and --ood.organization_i d=100 and ood.organization_code like 'U%' order by 2; cursor solvent(p_master_org number) IS select mp.organization_code , mp.organization_id , msib.segment1 , msib.description , mmt.subinventory_code , mmt.locator_id , msib.primary_uom_code transaction_uom , sum(mmt.primary_quantity)transaction_quantity, gbh.formula_id , msib.inventory_item_id from gme_batch_header gbh , gme_material_details gmd , mtl_material_transactions mmt, mtl_parameters mp , mtl_system_items_b msib where gbh.batch_id = gmd.batch_id and gbh.batch_id = mmt.transaction_source_id and gbh.organization_id = mmt.organization_id and gmd.material_detail_id = mmt.trx_source_line_id and gmd.batch_id = mmt.transaction_source_id and mmt.transaction_type_id in (1002,1003) and gmd.line_type = 2 and mmt.transaction_date >= (select start_date from cm_cldr_dtl where upper( period_desc) = p_period and rownum=1) and mmt.transaction_date <= (select end_date from cm_cldr_dtl where upper(pe riod_desc) = p_period and rownum=1) and mmt.inventory_item_id = gmd.inventory_item_id and mmt.organization_id = gmd.organization_id and mp.organization_id = mmt.organization_id and msib.inventory_item_id = mmt.inventory_item_id and msib.organization_id = mmt.organization_id and mp.organization_id IN (select organization_id from jai_cmn_inventory_ orgs where master_organization_id = p_master_org) group by mp.organization_code , mp.organization_id , msib.segment1 , msib.description , mmt.subinventory_code , mmt.locator_id , msib.primary_uom_code , gbh.formula_id , msib.inventory_item_id; cursor link_code(p_formula_id number,p_item_id number ) is select 1 linkcode,fmd.attribute11 link_code,msib.inventory_item_id link_code_id,

decode(fmd.attribute16,'Yes',100,'No',NULL) direct_recovery from fm_matl_dtl fmd , mtl_system_items_b msib where fmd.formula_id = p_formula_id and fmd.inventory_item_id = p_item_id and msib.segment1 = fmd.attribute11 and msib.organization_id = fmd.organization_id and fmd.attribute11 is not null union select 2 attr,fmd.attribute12 link_code,msib.inventory_item_id link_code_id,deco de(fmd.attribute16,'Yes',100,'No',NULL) direct_recovery from fm_matl_dtl fmd , mtl_system_items_b msib where fmd.formula_id = p_formula_id and fmd.inventory_item_id = p_item_id and msib.segment1 = fmd.attribute12 and msib.organization_id = fmd.organization_id and fmd.attribute12 is not null union select 3 attr,fmd.attribute15 link_code,msib.inventory_item_id link_code_id,deco de(fmd.attribute16,'Yes',100,'No',NULL) direct_recovery from fm_matl_dtl fmd , mtl_system_items_b msib where fmd.formula_id = p_formula_id and fmd.inventory_item_id = p_item_id and msib.segment1 = fmd.attribute12 and msib.organization_id = fmd.organization_id and fmd.attribute15 is not null;

l_apl_solvent_cost_dtl apl_solvent_cost_dtl%rowtype; l_location varchar2(240); l_product varchar2(30); l_prod_desc varchar2(240); l_product_item_id number; l_recovered_solvent varchar2(30); l_solvent_cost number; l_user_id number := fnd_profile.value('ORG_ID'); l_login_id number := fnd_profile.value('LOGIN_ID'); l_matid number; l_rec number; l_input number; l_output number; l_rec_per_ref number; l_latest_dis_batch number; l_period_id number; l_start_date date; l_end_date date; l_header_count number; l_line_count number; BEGIN Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'Begining of the procedure'); begin select period_id,start_date,TRUNC(end_date) into l_period_id,l_start_date,l_end_

date from cm_cldr_mst_v where upper(period_desc) = p_period AND cost_type_id IN(select cost_type_id from cm_mthd_mst where cost_mthd_code =' APMA'); Fnd_File.PUT_LINE(Fnd_File.OUTPUT,l_period_id||','||l_start_date||','||l_end_dat e); exception when others then --l_period_id :=0; null; end; for mst in org loop begin begin select count(1) into l_header_count from apl_solvent_cost_hdr where master_organization_id =mst.organization_id and period_id =l_period_id; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,l_header_count||'->'||l_header_cou nt); select count(1) into l_line_count from apl_solvent_cost_dtl where m aster_organization_id =mst.organization_id and period_id =l_period_id; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,l_line_count||'->'||l_line_count); if l_line_count != 0 then delete from apl_solvent_cost_dtl where master_organization_id =mst.o rganization_id and period_id = l_period_id; end if; if l_header_count = 0 then insert into apl_solvent_cost_hdr( master_organization_code, master_organization_id, period, period_id, status, period_start_date, period_end_date, exceptions_exists, created_by, creation_date, last_updated_by, last_update_date, last_update_login) values(mst.organization_code, mst.organization_id, p_period, l_period_id, 'DRAFT', l_start_date, l_end_date,

'N', l_user_id, SYSDATE, l_user_id, sysdate, l_login_id); Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'Header inserted'); end if;

end;

for i in solvent(mst.organization_id) loop Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'solvent loop'); for linkcodes in link_code(i.formula_id,i.inventory_item_id) loop Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'linkcodes loop'); L_MATID := NULL; begin select segment1||'.'||segment2||'.'||segment3 into l_location from mtl_item_locations where inventory_location_id=i.locator_id; exception when others then l_location :=null; --fnd_message.set_string('Unable to Fetch Locator'); --fnd_message.show; end; begin select msib.segment1,msib.description into l_product,l_prod_desc from fm_form_mst ffm, fm_matl_dtl fmd, mtl_system_items_b msib where msib.organization_id = ffm.owner_organization_id and msib.inventory_item_id = fmd.inventory_item_id and ffm.formula_id = fmd.formula_id and fmd.line_type = 1 and fmd.line_no = 1 and ffm.formula_id = i.formula_id; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_product'||'->'||l_product); exception when others then /* fnd_message.set_string('Unable to Fetch Product'); fnd_message.show;*/ l_product:=null; l_prod_desc :=null; end;

begin select sum(cmpnt_cost) into l_solvent_cost from cm_cmpt_dtl where inventory_item_id = linkcodes.link_code_id --:apl_solvent_cost_d tl.recovered_solvent_item_id and organization_id = mst.organization_id and period_id = l_period_id; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_solvent_cost'||'->'||l_solvent_cost ); exception when others then /*fnd_message.set_string('Unable to Fetch Unit Cost'); fnd_message.show; */ l_solvent_cost :=0; end; l_rec:= apl_solvent_rec_percent(i.inventory_item_id i.formula_id i.organization_id l_start_date, l_end_date, linkcodes.linkcode); , , ,

Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_rec'||'->'||l_rec); BEGIN SELECT MAX(BATCH_ID) INTO l_latest_dis_batch FROM MTL_MATERIAL_TRANSACTIONS MMT,GME_MATERIAL_DETAILS B WHERE MMT.INVENTORY_ITEM_ID!=i.inventory_item_id AND TRUNC(MMT.TRANSACTION_DATE) <= l_end_date AND MMT.ORGANIZATION_ID= i.organization_id AND EXISTS (SELECT 1 FROM GME_MATERIAL_DETAILS GMD WHERE GMD.BATCH_ ID = B.BATCH_ID AND GMD.INVENTORY_ITEM_ID = i.inventory_item_id AND LINE_TYPE=-1 ) AND MMT.TRANSACTION_TYPE_ID IN (44,17,1002,1003) -AND MMT.SUBINVENTORY_CODE=i.subinventory_code -AND MMT.LOCATOR_ID=i.locator_id AND MMT.TRANSACTION_SOURCE_ID=B.BATCH_ID AND MMT.TRX_SOURCE_LINE_ID = B.MATERIAL_DETAIL_ID AND B.LINE_TYPE=1; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_latest_dis_batch'||'->'||l_latest_d is_batch); EXCEPTION WHEN OTHERS THEN l_latest_dis_batch :=0; END; IF l_latest_dis_batch <> 0 THEN BEGIN SELECT ABS(SUM(PRIMARY_QUANTITY)) INTO l_output

FROM MTL_MATERIAL_TRANSACTIONS MMT,GME_MATERIAL_DETAILS B WHERE MMT.INVENTORY_ITEM_ID!=i.inventory_item_id --AND TRUNC(MMT.TRANSACTION_DATE)between :apl_solvent_cost_hdr. period_start_date and :apl_solvent_cost_hdr.period_end_date AND MMT.ORGANIZATION_ID= i.organization_id AND EXISTS (SELECT 1 FROM GME_MATERIAL_DETAILS GMD WHERE GMD.BAT CH_ID = B.BATCH_ID AND GMD.INVENTORY_ITEM_ID = i.inventory_item_id AND LINE_TYPE =-1) AND MMT.TRANSACTION_TYPE_ID IN (44,17,1002,1003) AND B.BATCH_ID =l_latest_dis_batch -AND MMT.SUBINVENTORY_CODE=i.subinventory_code -AND MMT.LOCATOR_ID=i.locator_id AND MMT.TRANSACTION_SOURCE_ID=B.BATCH_ID AND MMT.TRX_SOURCE_LINE_ID = B.MATERIAL_DETAIL_ID AND MMT.INVENTORY_ITEM_ID = B.INVENTORY_ITEM_ID AND B.LINE_TYPE=1 ; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_output'||'->'||l_output); exception when others then l_output :=0; end; begin SELECT ABS(NVL(SUM(MMT.PRIMARY_QUANTITY),0)) INTO l_input FROM MTL_MATERIAL_TRANSACTIONS MMT,GME_MATERIAL_DETAILS B WHERE MMT.INVENTORY_ITEM_ID=i.inventory_item_id --AND TRUNC(MMT.TRANSACTION_DATE)between :apl_solvent_cost_hdr. period_start_date and :apl_solvent_cost_hdr.period_end_date AND MMT.ORGANIZATION_ID=i.organization_id AND MMT.TRANSACTION_SOURCE_ID = l_latest_dis_batch AND MMT.TRANSACTION_TYPE_ID IN (35,43) AND MMT.TRANSACTION_SOURCE_ID=B.BATCH_ID AND MMT.TRX_SOURCE_LINE_ID = B.MATERIAL_DETAIL_ID AND MMT.INVENTORY_ITEM_ID = B.INVENTORY_ITEM_ID AND CONTRIBUTE_YIELD_IND = 'Y' --AND MMT.SUBINVENTORY_CODE=i.subinventory_code --AND MMT.LOCATOR_ID=i.locator_id ; Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_input'||'->'||l_input); exception when others then l_input :=0; end; END IF; if nvl(l_input,0) <> 0 then l_rec_per_ref := round((l_output/l_input)*100,2); Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'l_rec_per_ref'||'->'||l_rec_p er_ref); end if; /*l_apl_solvent_cost_dtl.organization_code := i.organization_cod

e; l_apl_solvent_cost_dtl.organization_id l_apl_solvent_cost_dtl.period period; l_apl_solvent_cost_dtl.period_id period_id ; l_apl_solvent_cost_dtl.product_code l_apl_solvent_cost_dtl.inventory_item_id l_apl_solvent_cost_dtl.sub_inventory l_apl_solvent_cost_dtl.locator_id l_apl_solvent_cost_dtl.locator l_apl_solvent_cost_dtl.solvent_code l_apl_solvent_cost_dtl.solvent_item_id l_apl_solvent_cost_dtl.solvent_qty y; l_apl_solvent_cost_dtl.solvent_uom ; l_apl_solvent_cost_dtl.recovered_solvent_code l_apl_solvent_cost_dtl.recovered_solvent_item_id l_apl_solvent_cost_dtl.recovered_solvent_uom l_apl_solvent_cost_dtl.recovery1 l_apl_solvent_cost_dtl.recovery2 l_apl_solvent_cost_dtl.solvent_unit_price l_apl_solvent_cost_dtl.solvent_total_cost l_apl_solvent_cost_dtl.attribute_category l_apl_solvent_cost_dtl.attribute1 l_apl_solvent_cost_dtl.attribute2 l_apl_solvent_cost_dtl.attribute3 l_apl_solvent_cost_dtl.attribute4 l_apl_solvent_cost_dtl.attribute5 l_apl_solvent_cost_dtl.created_by l_apl_solvent_cost_dtl.creation_date l_apl_solvent_cost_dtl.last_updated_by l_apl_solvent_cost_dtl.last_update_date l_apl_solvent_cost_dtl.last_update_login := i.organization_id; := :solvent_control_blk. := :solvent_control_blk. := := := := := := := := null; null; i.subinventory_code; i.locator_id; null; i.segment1; i.inventory_item_id; i.transaction_quantit

:= i.transaction_uom := := := := := := := := := := := := := := := := := := null; null; null; null; null; null;, null; null; null; null; null; null; null; 1100; sysdate; 1100; sysdate; 171238;*/

begin Fnd_File.PUT_LINE(Fnd_File.OUTPUT,'Lines data being insterted'); Fnd_File.PUT_LINE(Fnd_File.OUTPUT,i.organization_code||'->'||i.segment1) ; insert into apl_solvent_cost_dtl(organization_code , organization_id , period , period_id , product_code , inventory_item_id , sub_inventory , locator_id , locator , solvent_code , solvent_item_id , solvent_qty , solvent_uom , recovered_solvent_code recovered_solvent_item_id recovered_solvent_uom recovery1 recovery2 solvent_unit_price solvent_total_cost

, , , , , , ,

attribute_category attribute1 attribute2 attribute3 attribute4 attribute5 rec_per_ref created_by creation_date last_updated_by last_update_date last_update_login master_organization_id, actual_recovery) values( i.organization_code , i.organization_id , p_period , l_period_id , l_product , l_product_item_id , i.subinventory_code , i.locator_id , l_location , i.segment1 , i.inventory_item_id , i.transaction_quantity , i.transaction_uom , linkcodes.link_code , linkcodes.link_code_id , null , NVL(linkcodes.direct_recovery,l_rec) , null , l_solvent_cost , null , null , null , null , null , null , null , l_rec_per_ref , l_user_id , sysdate , l_user_id , sysdate , l_login_id , mst.organization_id , linkcodes.direct_recovery); --Next_record; end; end loop; -- inner loop; end loop; -- outer loop; end; end loop; -- Master Org commit work; --FIRST_RECORD;

, , , , , , , , , , , ,

end populate_solvent_details;

******************************************************************************** ************************************* when others then --fnd_file.put_line (fnd_file.LOG,'Error While Fetching Cost Method Code'); null; end; /* begin select period_id,calendar_code,period_code into l_period_id,l_calendar_code,l_period_code from cm_cldr_mst_v where upper(period_desc) ='OCT-10'; exception when others then fnd_file.put_line (fnd_file.LOG,'Error While Fetching Period Details'); end; */ begin select cost_cmpntcls_id , cost_cmpntcls_code into l_cost_cmpntcls_id, l_cost_cmpntcls_code from cm_cmpt_mst where cost_cmpntcls_code ='RM SPENT SOL'; exception when others then --fnd_file.put_line (fnd_file.LOG,'Error While Fetching cost_cmpntcls_code'); null; end;

For i in c1 loop BEGIN SELECT CALENDAR_CODE into l_calendar_code FROM CM_CLDR_DTL WHERE UPPER(PERIOD_DESC) = UPPER(i.period); exception when others then null; END ; l_status := null; SELECT gem5_cost_adjust_id_s.nextval into l_cost_adjust_id l_cost_update_rec.organization_id l_cost_update_rec.organization_code l_cost_update_rec.inventory_item_id l_cost_update_rec.item_number l_cost_update_rec.cost_type_id l_cost_update_rec.cost_mthd_code l_cost_update_rec.period_id ; l_cost_update_rec.calendar_code := := := := := := := FROM dual;

i.organization_id ; i.organization_code ; i.solvent_item_id ; i.solvent_code ; l_cost_type_id ; l_cost_mthd_code ; :apl_solvent_cost_hdr.period_id ;

:= l_calendar_code

l_cost_update_rec.period_code := ; l_cost_update_rec.cost_cmpntcls_id := l_cost_update_rec.cost_cmpntcls_code := l_cost_update_rec.cost_analysis_code := l_cost_update_rec.cost_adjust_id := l_cost_update_rec.adjust_qty := l_cost_update_rec.adjust_qty_uom := l_cost_update_rec.adjust_cost := l_cost_update_rec.reason_code := l_cost_update_rec.adjust_status := ed 2- Modified l_cost_update_rec.creation_date := l_cost_update_rec.last_update_login := l_cost_update_rec.created_by := l_cost_update_rec.last_update_date := l_cost_update_rec.last_updated_by := l_cost_update_rec.text_code := l_cost_update_rec.trans_cnt := l_cost_update_rec.delete_mark := l_cost_update_rec.request_id := l_cost_update_rec.program_application_id:= l_cost_update_rec.program_id := l_cost_update_rec.program_update_date := l_cost_update_rec.attribute_category := l_cost_update_rec.attribute1 := l_cost_update_rec.attribute2 := l_cost_update_rec.attribute3 := l_cost_update_rec.attribute4 := l_cost_update_rec.attribute5 := l_cost_update_rec.attribute6 := l_cost_update_rec.attribute7 := l_cost_update_rec.attribute8 := l_cost_update_rec.attribute9 := l_cost_update_rec.attribute10 := l_cost_update_rec.attribute11 := l_cost_update_rec.attribute12 := l_cost_update_rec.attribute13 := l_cost_update_rec.attribute14 := l_cost_update_rec.attribute15 := l_cost_update_rec.attribute16 := l_cost_update_rec.attribute17 := l_cost_update_rec.attribute18 := l_cost_update_rec.attribute19 := l_cost_update_rec.attribute20 := l_cost_update_rec.attribute21 := l_cost_update_rec.attribute22 := l_cost_update_rec.attribute23 := l_cost_update_rec.attribute24 := l_cost_update_rec.attribute25 := l_cost_update_rec.attribute26 := l_cost_update_rec.attribute27 := l_cost_update_rec.attribute28 := l_cost_update_rec.attribute29 := l_cost_update_rec.attribute30 := l_cost_update_rec.adjustment_ind := l_cost_update_rec.subledger_ind := l_cost_update_rec.adjustment_date := l_cost_update_rec.user_name :=

:apl_solvent_cost_hdr.period l_cost_cmpntcls_id ; l_cost_cmpntcls_code; 'MAC' ; l_cost_adjust_id; i.sol_qty; i.solvent_uom; i.solv_cost; 'SOL'; 0 ; --- 0 - Not Applied , 1-Appli sysdate ; l_last_update_login; l_user_id ; sysdate ; l_user_id ; NULL ; 1 ; 0 ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; 0; -- Average Cost Adjustment , 0; null ; 5362; --l_user_name;

GMF_ACTUAL_COST_ADJUSTMENT_PUB.create_actual_cost_adjustment( --UPDATE_ACTUAL_COST_ADJUSTMENT( p_api_version => 1, p_init_msg_list => 'T', p_commit => 'T', x_return_status => l_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data , p_adjustment_rec => l_cost_update_rec);

If l_status = 'S' Then update apl_solvent_cost_dtl set process_status ='S',attribute1=l _cost_adjust_id WHERE organization_id = i.organization_id and period_id =i.perio d_id and solvent_code =i.solvent_code and solvent_item_id = i.solvent _item_id and PRODUCT_CODE =i.product_code and RECOVERED_SOLVENT_ITEM_ID= i.RECOVERED_SOLVENT_ITEM_ID and LOCATOR_ID=i.LOCATOR_ID ; else update apl_solvent_cost_dtl set process_status ='N' WHERE organization _id = i.organization_id and period_id =i.period_id and solvent_code =i.solvent_code and solvent_item_id = i.solvent _item_id and PRODUCT_CODE =i.product_code and RECOVERED_SOLVENT_ITEM_ID= i.RECOVERED_SOLVENT_ITEM_ID and LOCATOR_ID=i.LOCATOR_ID ; end if; /* dbms_output.put_line('l_status '||l_status); dbms_output.put_line('l_msg_count'||l_msg_count); dbms_output.put_line('l_msg_data '||l_msg_data); For j IN 1 .. l_msg_count Loop FND_MSG_PUB.get(p_msg_index p_encoded p_data p_msg_index_out message(l_msg_data); message(l_msg_data); End Loop; */ end loop; COMMIT; end; ******************************************************************************** *************************************** PROCEDURE SOLD_QTY_COST_UPDATE IS l_cost_update_rec gmf_actual_cost_adjustment_pub.adjustment_rec_type; l_cost_mthd_code varchar2(20); l_cost_type number; l_cost_type_id number; l_period_id number; l_calendar_code varchar2(30); l_period_code varchar2(30);

=> => => =>

j, 'F', l_msg_data, l_out_index);

l_cost_cmpntcls_id l_cost_cmpntcls_code l_cost_adjust_id l_last_update_login l_user_id l_user_name l_status l_msg_count l_msg_data l_out_index

number; varchar2(16); number; number := fnd_profile.value('LOGIN_ID'); number := fnd_profile.value('USER_ID'); varchar2(20) := fnd_profile.value('USER_NAME'); varchar2(1); number; varchar2(2000); Number :=0;

cursor c1 is select organization_code,organization_id,period_id,period,solvent_ code,solvent_item_id,solvent_uom, selling_price solv_cost, quantity_sold sol_qty from apl_solvent_cost_dtl where organization_id in ( select organization_id from jai _cmn_inventory_orgs where master_organization_id = :apl_solvent_cost_hdr.master_ organization_id) and period_id = :apl_solvent_co st_hdr.period_id and nvl(sold_qty_process_status ,'N') !='S' and nvl(quantity_sold,0) <> 0; begin begin select cost_mthd_code,cost_type,cost_type_id into l_cost_mthd_code,l_cost_type,l_cost_type_id from cm_mthd_mst WHERE cost_m thd_code ='APMA'; exception when others then --fnd_file.put_line (fnd_file.LOG,'Error While Fetching Cost Method Code'); null; end; /* begin select period_id,calendar_code,period_code into l_period_id,l_calendar_code,l_period_code from cm_cldr_mst_v where upper(period_desc) ='OCT-10'; exception when others then fnd_file.put_line (fnd_file.LOG,'Error While Fetching Period Details'); end; */ begin select cost_cmpntcls_id , cost_cmpntcls_code into l_cost_cmpntcls_id, l_cost_cmpntcls_code from cm_cmpt_mst where cost_cmpntcls_code ='RM SPENT SOL'; exception when others then --fnd_file.put_line (fnd_file.LOG,'Error While Fetching cost_cmpntcls_code'); null; end;

For i in c1 loop BEGIN SELECT CALENDAR_CODE into l_calendar_code FROM CM_CLDR_DTL WHERE UPPER(PERIOD_DESC) = UPPER(i.period); exception when others then null; END ; l_status:=null; SELECT gem5_cost_adjust_id_s.nextval into l_cost_adjust_id l_cost_update_rec.organization_id := l_cost_update_rec.organization_code := l_cost_update_rec.inventory_item_id := l_cost_update_rec.item_number := l_cost_update_rec.cost_type_id := l_cost_update_rec.cost_mthd_code := l_cost_update_rec.period_id := ; l_cost_update_rec.calendar_code := l_cost_update_rec.period_code := ; l_cost_update_rec.cost_cmpntcls_id := l_cost_update_rec.cost_cmpntcls_code := l_cost_update_rec.cost_analysis_code := l_cost_update_rec.cost_adjust_id := l_cost_update_rec.adjust_qty := l_cost_update_rec.adjust_qty_uom := l_cost_update_rec.adjust_cost := l_cost_update_rec.reason_code := l_cost_update_rec.adjust_status := ed 2- Modified l_cost_update_rec.creation_date := l_cost_update_rec.last_update_login := l_cost_update_rec.created_by := l_cost_update_rec.last_update_date := l_cost_update_rec.last_updated_by := l_cost_update_rec.text_code := l_cost_update_rec.trans_cnt := l_cost_update_rec.delete_mark := l_cost_update_rec.request_id := l_cost_update_rec.program_application_id:= l_cost_update_rec.program_id := l_cost_update_rec.program_update_date := l_cost_update_rec.attribute_category := l_cost_update_rec.attribute1 := l_cost_update_rec.attribute2 := l_cost_update_rec.attribute3 := l_cost_update_rec.attribute4 := l_cost_update_rec.attribute5 := l_cost_update_rec.attribute6 := l_cost_update_rec.attribute7 := l_cost_update_rec.attribute8 := l_cost_update_rec.attribute9 := l_cost_update_rec.attribute10 := l_cost_update_rec.attribute11 := FROM dual;

i.organization_id ; i.organization_code ; i.solvent_item_id ; i.solvent_code ; l_cost_type_id ; l_cost_mthd_code ; :apl_solvent_cost_hdr.period_id l_calendar_code ; :apl_solvent_cost_hdr.period l_cost_cmpntcls_id ; l_cost_cmpntcls_code; 'MAC' ; l_cost_adjust_id; i.sol_qty; i.solvent_uom; i.solv_cost; 'SOL'; 0 ; --- 0 - Not Applied , 1-Appli sysdate ; l_last_update_login; l_user_id ; sysdate ; l_user_id ; NULL ; 1 ; 0 ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ; null ;

l_cost_update_rec.attribute12 l_cost_update_rec.attribute13 l_cost_update_rec.attribute14 l_cost_update_rec.attribute15 l_cost_update_rec.attribute16 l_cost_update_rec.attribute17 l_cost_update_rec.attribute18 l_cost_update_rec.attribute19 l_cost_update_rec.attribute20 l_cost_update_rec.attribute21 l_cost_update_rec.attribute22 l_cost_update_rec.attribute23 l_cost_update_rec.attribute24 l_cost_update_rec.attribute25 l_cost_update_rec.attribute26 l_cost_update_rec.attribute27 l_cost_update_rec.attribute28 l_cost_update_rec.attribute29 l_cost_update_rec.attribute30 l_cost_update_rec.adjustment_ind l_cost_update_rec.subledger_ind l_cost_update_rec.adjustment_date l_cost_update_rec.user_name

:= := := := := := := := := := := := := := := := := := := := := := :=

null null null null null null null null null null null null null null null null null null null 0; -0; null 5362;

; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Average Cost Adjustment , ; --l_user_name;

GMF_ACTUAL_COST_ADJUSTMENT_PUB.create_actual_cost_adjustment( --UPDATE_ACTUAL_COST_ADJUSTMENT( p_api_version => 1, p_init_msg_list => 'T', p_commit => 'T', x_return_status => l_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data , p_adjustment_rec => l_cost_update_rec); If l_status = 'S' Then update apl_solvent_cost_dtl set sold_qty_process_status ='S',att ribute2=l_cost_adjust_id WHERE organization_id = i.organization_id and period_id =i.period_id and solvent_code =i.solvent_code and solvent_item_id = i.solvent _item_id ; else update apl_solvent_cost_dtl set sold_qty_process_status ='N' WHERE org anization_id = i.organization_id and period_id =i.period_id and solvent_code =i.solvent_code and solvent_item_id = i.solvent _item_id ; end if; /* dbms_output.put_line('l_status '||l_status); dbms_output.put_line('l_msg_count'||l_msg_count); dbms_output.put_line('l_msg_data '||l_msg_data); For j IN 1 .. l_msg_count Loop FND_MSG_PUB.get(p_msg_index p_encoded p_data p_msg_index_out message(l_msg_data); message(l_msg_data); End Loop;

=> => => =>

j, 'F', l_msg_data, l_out_index);

*/ end loop; COMMIT; END; ******************************************************************************** *******************************************

You might also like