DROPTABLEXXAPL.APL_ITEM_COST_UPDATECASCADECONSTRAINTS; CREATETABLEXXAPL.APL_ITEM_COST_UPDATE ( ITEM_CODEVARCHAR2(30BYTE), ORGANIZATION_CODEVARCHAR2(3BYTE), UOMVARCHAR2(3BYTE), QUANTITYNUMBER, ITEM_COSTNUMBER, PROCESS_FLAGVARCHAR2(2BYTE), MESSAGEVARCHAR2(2000BYTE), PERIODVARCHAR2(20BYTE) ) TABLESPACECUST_TS_TX_DATA PCTUSED0 PCTFREE10 INITRANS1 MAXTRANS255 STORAGE( INITIAL40K NEXT96K MINEXTENTS1 MAXEXTENTSUNLIMITED PCTINCREASE0 BUFFER_POOLDEFAULT ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING; DROPSYNONYMAPPS.APL_ITEM_COST_UPDATE; CREATESYNONYMAPPS.APL_ITEM_COST_UPDATEFORX CREATESYNONYMAPPS.AP L_ITEM_COST_UPDATEFORXXAPL.APL_ITEM_COST_UPDATE XAPL.APL_ITEM_COST_UPDATE; ; GRANTALTER,DELETE,INDEX,INSERT,REFERENCES,SELECT,UPDATE,ONCOMM GRANTALTER,DELETE,INDEX,INSERT,REFERENCES ,SELECT,UPDATE,ONCOMMITREFRES ITREFRES H,QUERYREWRITE,DEBUG,FLASHBACKONXXAPL.AP H,QUERYREWRITE,DEBU G,FLASHBACKONXXAPL.APL_ITEM_COST_UPDATETOAPP L_ITEM_COST_UPDATETOAPPS; S;
CREATEORREPLACEPROCEDUREAPPS.XXAPL_SOLVENT_COST_UPDATEIS l_cost_update_recgmf_actual_cost_adjustment_pub.adjustment_rec_type; l_cost_mthd_codevarchar2(20); l_cost_typenumber; l_cost_type_idnumber; l_period_idnumber; l_calendar_codevarchar2(30); l_period_codevarchar2(30); l_cost_cmpntcls_idnumber; l_cost_cmpntcls_codevarchar2(16); l_cost_adjust_idnumber; l_last_update_loginnumber:=fnd_profile.value('LOGIN_ID'); l_user_idnumber:=fnd_profile.value('USER_ID'); l_user_namevarchar2(20):=fnd_profile.value('USER_NAME'); l_statusvarchar2(1); l_msg_countnumber; l_msg_datavarchar2(2000); l_out_indexNumber:=0; cursorc1isselectmp.organization_code,period,item_code,uom,quantity,item_cos t,ccm.period_id,mp.organization_id,msi.inventory_item_id fromapl_item_cost_updateaic,CM_CLDR_MST_Vccm,mtl_parametersmp,m tl_system_itemsmsi whereperiod='DEC-10'and --nvl(PROCESS_FLAG,'N')!='S'and --rownum=1 --anditem_code='C4030782' upper(ccm.PERIOD_DESC)=upper(aic.period) andmp.organization_code=aic.organization_code andmsi.organization_id=mp.organization_id andmsi.segment1=aic.item_code; begin begin selectcost_mthd_code,cost_type,cost_type_id intol_cost_mthd_code,l_cost_type,l_cost_type_idfromcm_mthd_mstWHEREcost_m thd_code='APMA'; exceptionwhenothersthen --fnd_file.put_line(fnd_file.LOG,'ErrorWhileFetchingCostMethodCode'); null; end; /* begin selectperiod_id,calendar_code,period_code
intol_period_id,l_calendar_code,l_period_code fromcm_cldr_mst_v whereupper(period_desc)='OCT-10'; exceptionwhenothersthen fnd_file.put_line(fnd_file.LOG,'ErrorWhileFetchingPeriodDetails'); end; */ begin selectcost_cmpntcls_id,cost_cmpntcls_code intol_cost_cmpntcls_id,l_cost_cmpntcls_code fromcm_cmpt_mstwherecost_cmpntcls_code='MATERIAL'; exceptionwhenothersthen --fnd_file.put_line(fnd_file.LOG,'ErrorWhileFetchingcost_cmpntcls_code'); null; end;
Foriinc1loop BEGIN SELECTCALENDAR_CODEintol_calendar_code FROMCM_CLDR_DTLWHEREUPPER(PERIOD_DESC)=UPPER(i.period); exceptionwhenothersthen null; END; SELECTgem5_cost_adjust_id_s.nextvalintol_cost_adjust_idFROMdual; l_cost_update_rec.organization_id:=i.organization_id; l_cost_update_rec.organization_code:=i.organization_code; l_cost_update_rec.inventory_item_id:=i.inventory_item_id; l_cost_update_rec.item_number:=i.item_code; l_cost_update_rec.cost_type_id:=l_cost_type_id; l_cost_update_rec.cost_mthd_code:=l_cost_mthd_code; l_cost_update_rec.period_id:=i.period_id; l_cost_update_rec.calendar_code:=l_calendar_code; l_cost_update_rec.period_code:=i.period; l_cost_update_rec.cost_cmpntcls_id:=l_cost_cmpntcls_id; l_cost_update_rec.cost_cmpntcls_code:=l_cost_cmpntcls_code; l_cost_update_rec.cost_analysis_code:='MAC'; l_cost_update_rec.cost_adjust_id:=l_cost_adjust_id; l_cost_update_rec.adjust_qty:=i.quantity; l_cost_update_rec.adjust_qty_uom:=i.uom; l_cost_update_rec.adjust_cost:=i.item_cost; l_cost_update_rec.reason_code:='OPB'; l_cost_update_rec.adjust_status:=0;---0-NotApplied,1-Appli ed2-Modified l_cost_update_rec.creation_date:=sysdate; l_cost_update_rec.last_update_login:=l_last_update_login; l_cost_update_rec.created_by:=l_user_id; l_cost_update_rec.last_update_date:=sysdate; l_cost_update_rec.last_updated_by:=l_user_id; l_cost_update_rec.text_code:=NULL; l_cost_update_rec.trans_cnt:=1;
l_cost_update_rec.delete_mark:=0; l_cost_update_rec.request_id:=null; l_cost_update_rec.program_application_id:=null; l_cost_update_rec.program_id:=null; l_cost_update_rec.program_update_date:=null; l_cost_update_rec.attribute_category:=null; l_cost_update_rec.attribute1:=null; l_cost_update_rec.attribute2:=null; l_cost_update_rec.attribute3:=null; l_cost_update_rec.attribute4:=null; l_cost_update_rec.attribute5:=null; l_cost_update_rec.attribute6:=null; l_cost_update_rec.attribute7:=null; l_cost_update_rec.attribute8:=null; l_cost_update_rec.attribute9:=null; l_cost_update_rec.attribute10:=null; l_cost_update_rec.attribute11:=null; l_cost_update_rec.attribute12:=null; l_cost_update_rec.attribute13:=null; l_cost_update_rec.attribute14:=null; l_cost_update_rec.attribute15:=null; l_cost_update_rec.attribute16:=null; l_cost_update_rec.attribute17:=null; l_cost_update_rec.attribute18:=null; l_cost_update_rec.attribute19:=null; l_cost_update_rec.attribute20:=null; l_cost_update_rec.attribute21:=null; l_cost_update_rec.attribute22:=null; l_cost_update_rec.attribute23:=null; l_cost_update_rec.attribute24:=null; l_cost_update_rec.attribute25:=null; l_cost_update_rec.attribute26:=null; l_cost_update_rec.attribute27:=null; l_cost_update_rec.attribute28:=null; l_cost_update_rec.attribute29:=null; l_cost_update_rec.attribute30:=null; l_cost_update_rec.adjustment_ind:=0;--0-AverageCostAdjustment2-Uni tCostAdjustment, l_cost_update_rec.subledger_ind:=0; l_cost_update_rec.adjustment_date:=null; l_cost_update_rec.user_name:=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); Ifl_status='S'Then updateapl_item_cost_updatesetprocess_flag='S'WHEREorganization_cod e=i.organization_codeandperiod=i.period anditem_code=i.item_code; else updateapl_item_cost_updatesetprocess_flag='N'WHEREorganization_code =i.organization_codeandperiod=i.period anditem_code=i.item_code;
endif; dbms_output.put_line('l_status'||l_status||i.item_code); dbms_output.put_line('l_msg_count'||l_msg_count); dbms_output.put_line('l_msg_data'||l_msg_data); ForjIN1..l_msg_countLoop FND_MSG_PUB.get(p_msg_index=>j, p_encoded=>'F', p_data=>l_msg_data, p_msg_index_out=>l_out_index); dbms_output.put_line(l_msg_data); EndLoop; endloop; --:APL_SOLVENT_COST_HDR.STATUS:='COMPLETED'; endXXAPL_SOLVENT_COST_UPDATE; /