P. 1
Items OnHand MinMax.txt

Items OnHand MinMax.txt

|Views: 12|Likes:
Published by Olabooye Ayodeji

More info:

Published by: Olabooye Ayodeji on Jul 30, 2013
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less






DESCRIPTION, MSIB.PRIMARY_UNIT_OF_MEASURE UOM,Round(Nvl(CIC.ITEM_COST,0),2) ITEM_COST ,Nvl(MSIB.MIN_MINMAX_QUANTITY,0) MIN_MINMAX_QUANTITY,Nvl(MSIB.MAX_MINMAX_QUANTIT Y,0) MAX_MINMAX_QUANTITY, Nvl(MSIB.MINIMUM_ORDER_QUANTITY,0) MINIMUM_ORDER_QUANTITY,Nvl(MSIB.MAXIMUM_ORDER _QUANTITY,0) MAXIMUM_ORDER_QUANTITY, Nvl(MOQD.TRANSACTION_QUANTITY,0) ONHAND_QTY FROM MTL_SYSTEM_ITEMS_B MSIB, MTL_ONHAND_QUANTITIES_DETAIL MOQD, CST_ITEM_COSTS CIC, HR_ALL_ORGANIZATION_UNITS HAOU WHERE MOQD.INVENTORY_ITEM_ID(+) = MSIB.INVENTORY_ITEM_ID AND CIC.INVENTORY_ITEM_ID(+) = MSIB.INVENTORY_ITEM_ID AND MOQD.ORGANIZATION_ID(+) = MSIB.ORGANIZATION_ID AND CIC.ORGANIZATION_ID(+) = MSIB.ORGANIZATION_ID AND MSIB.ORGANIZATION_ID = HAOU.ORGANIZATION_ID AND msib.organization_id != 0 and MSIB.SEGMENT1 in ('54520LH00114','54520LH00115','60620NE00044') and MSIB.ORGANIZATION_ID='1492' ----------------------SELECT * FROM ORG_ORGANIZATION_DEFINITIONS WHERE ORGANIZATION_CODE IN ('TWK','PAS','INT') SELECT INVENTORY_PLANNING_CODE,MSB.INVENTORY_ITEM_ID, ORGANIZATION_ID,SEGMENT1,D ESCRIPTION FROM mtl_system_items_b MSB ,xxx_item_master_stg stg WHERE stg.ITEM_CODE=MSB.SEGMENT1 AND ORGANIZATION_ID=1137 AND INVENTORY_PLANNING_CODE =6 ---------------------SELECT * FROM ORG_ORGANIZATION_DEFINITIONS WHERE ORGANIZATION_CODE IN ('TWK','PAS','INT') ----------------------mIN-MAX LOADING -declare l_err_flag varchar2(3); l_err_msg varchar2(2500); l_count number (2); l_category_set_id number (20); l_category_id number (20); l_org_id number (4); l_template_name varchar2(250); l_uom varchar2(20); l_item_type varchar2(20); l_organization_id number (10); --CURSOR TO FETCH THE DATA FROM STAGING TABLE cursor c1 is SELECT msb.organization_id,'PAS' organization_Code ,'Inventory Type' item_type ,upper(trim(msb.segment1))item_code , msb.description ,'Finished Good' template_name , upper(trim(PRIMARY_UOM_CODE)) uom ,mv.category_id category_id

INVENTORY_ITEM_ID=MSB.item_type)).initialize the variables l_err_flag :='Y'. ---*********** ITEM TYPE VALIDATION --2 begin select lookup_code into l_item_type from fnd_lookup_values where lookup_type = 'ITEM_TYPE' and upper(meaning) = trim(upper(c_rec..xxx_item_master_stg stg WHERE A. E.category_id=a.organization_id and upper(trim(msb. ---*************** ITEM CODE VALIDATION --3 ----********** Check if Item Already exist for the Warehouse Organization begin l_count := 0.category_id and msb.INVENTORY_ITEM_ID --. l_err_msg := null. --The Code of O rganization .* FROM mtl_system_items_b MSB . end .MSB.INVENTORY_ITEM_ID AND MV.segment1)) =stg.g 'PAS' for Passions {Picks By Hardcoding} exception when others then l_err_flag := 'Y'.msb.organization_id=a.mtl_categories_v MV . /* fOR New Items not to duplicate .segment1)) ='20590DD00005' and nvl(verify_flag. ---*********** MASTER ORGANIZATION VALIDATION --1 begin select TO_NUMBER(organization_id) into l_organization_id from org_organization_definitions WHERE organization_code = upper(trim(c_rec.'Inventory' cat_set_name .Item Type must exist E. end .stg.organization_id='1492' --and upper(trim(msb. MIN_MINMAX_QUANTITY .item_code and msb.MAX_MINMAX_QUANTITY . l_err_msg := l_err_msg || 'INVALID ITEM TYPE' .'N') = 'N' and STRUCTURE_NAME='Item Categories'.mtl_item_categories A . begin for c_rec in c1 loop begin --.organization_Code)).g: 'Inventory Type'. -.Inventory' {Picks from Staging Table} exception when others then l_err_flag := 'N1'.stg. l_err_msg := 'INVALID ORGANIZATION' .'FA .

ITEM TEMPLATE VALIDATION Code of Organi COMMENT FOR EM Item Type must Table} --REPEA --Item Description begin select template_name into l_template_name from mtl_item_templates where upper(trim(template_name)) = upper(trim(c_rec.g 'PAS' for Passions {Picks By Hardcoding} --REPEATED PHASY and organization_id = l_organization_id. exception when others then . l_err_msg := l_err_msg||'INVALID UOM'.'Purchased Item' {Picks from Stag ing Table} exception when others then l_err_flag := 'N4'.g: 'Finished Goods -Test' {Picks from Staging Table} l_err_flag := 'N3'. l_err_msg :=l_err_msg || 'ITEM ALREADY EXISTING' . eg litr e.g: 'Inventory Type'. end if. end. end.Inventory' {Picks from Staging TED COMMENT FOR EMPHASY if l_count > 0 then l_err_flag := 'N2'.select count(*) into l_count from mtl_system_items_b where upper(trim(segment1)) = upper(trim(c_rec.template_name)). end if. */ ----*********** VALIDATE THE DESCRIPTION if trim(c_rec. --. E. end .ITEM CATEGORY VALIDATION begin select c_rec.item_code)) --The zation .g: 'Finished Good'.category_id into l_category_id from dual.PRIMARY UOM VALIDATION begin select unit_of_measure into l_uom from mtl_units_of_measure where upper(trim(uom_code)) = upper(trim(c_rec.uom)). numbers exception when others then l_err_flag := 'N5'. l_err_msg := l_err_msg || 'INVALID DESCRIPTION'. end.description) is null then E. l_err_msg := l_err_msg||'INVALID TEMPLATE NAME'. ---The Item's UOM. --.'FA . --template _name is same as Item th E. --. ---exist E.

if l_count = 0 then l_err_flag := 'N8'. select count(*) into l_count from mtl_category_set_valid_cats_v where category_set_id = l_category_set_id and category_id = l_category_id . --Category Set {Picks from Staging Table} -. end. l_err_msg :=l_err_msg||'INVALID CATEGORY'. end. l_err_msg :=l_err_msg||'INVALID CATEGORY SET'. l_err_msg :=l_err_msg||'INVALID CATEGORY'.'Inventory' exception when others then l_err_flag := 'N7'.ITEM CATEGORY COMBINATION VALIDATION begin l_count := 0. l_err_msg :=l_err_msg||'INVALID CATEGORY COMBINATION'.cat_set_name).l_err_flag := 'N6'. IMPORT ITEMS FROM INTERFACE TABLE INTO BASE TABLE if l_err_flag='Y' then begin insert into mtl_system_items_interface (inventory_item_id. organization_id.cat_segment2) . /* select category_id into l_category_id from mtl_categories_v where segment1 =trim(c_rec.Segment1 {Picks from Stag ing Table} and segment2 = trim(c_rec. THEN INSERT DATA INTO INTERFACE TABLE ---. end if. exception when others then l_err_flag := 'N9'.Segment2 {Picks from Stag ing Table} exception when others then l_err_flag := 'N'. end. . --Category . /* --.IF ALL VALIDATIONS ARE CORRECT. */ ---. end.cat_segment1) --Category .THEN BY USING IMPORT ITEM CONCURRENT PGM. l_err_msg :=l_err_msg || 'INVALID CATEGORY COMBINATION' . */ ---************** ITEM CATEGORY SET VALIDATION begin select category_set_id -----1 into l_category_set_id from mtl_category_sets_tl where category_set_name = trim(c_rec.

l_uom .category_set_id . 'UPDATE' tran_type.MAX_MINMAX_QUANTITY. min_minmax_quantity.org_organization_definitions c where a.c_rec. xxx_item_master_stg b .segment1 .l_template_name .1 . max_minmax_quantity.c_rec.MAX_MINMAX_QUANTITY . b.MIN_MINMAX_QUANTITY .set_process_id.segment1=c_rec.primary_unit_of_measure .item_code . inventory_planning_code ) select a.organization_id = c. insert into mtl_item_categories_interface ( item_number .inventory_item_id.l_organization_id .MAX_MINMAX_QUANTITY .description .INVENTORY_ITEM_ID ). b.item_code order by item_code asc.set_process_id . transaction_type. 2 inventory_planning_code -.3 .organization_id. 777 set_id.c_rec.'UPDATE' .c_rec.organization_id .segment1 = b.MIN_MINMAX_QUANTITY .process_flag . /* insert into mtl_system_items_interface ( item_type .c_rec.item_code and a.INVENTORY_ITEM_ID ) values ( l_item_type .template_name . 1 process_flag. process_flag.Min-Max from mtl_system_items_b a.MIN_MINMAX_QUANTITY.transaction_type . a.description .organization_code='PAS' and a.organization_id and c.

l_organization_id .set_process_id .item_code .1 .organization_id . commit..item_code . */ update xxx_item_master_stg set verify_flag = 'Y'. end. end loop. commit. .'CREATE' ).l_category_set_id .category_id . commit.err_msg = l_err_msg where item_code = c_rec.process_flag .transaction_type ) values ( c_rec. end. update xxx_item_master_stg set verify_flag = 'N10' . else update xxx_item_master_stg set verify_flag = 'N' . exception when others then l_err_msg := sqlerrm. exception when others then dbms_output. end if.put_line(sqlerrm).3 .l_category_id . err_msg = null where item_code = c_rec.err_msg = l_err_msg where item_code = c_rec.item_code .item_code . commit.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->