96: IF (l_debug = 1) THEN
97: INV_TRX_UTIL_PUB.TRACE('p_process_code IS Insert ','INSERT_UPDATE_ITEM_SUB_DEFAULTS',9);
98: END IF;
99: INSERT
100: INTO mtl_item_sub_defaults (INVENTORY_ITEM_ID
101: ,ORGANIZATION_ID
102: ,SUBINVENTORY_CODE
103: ,DEFAULT_TYPE
104: ,LAST_UPDATE_DATE
126: END IF;
127:
128: /*Bug4013041--Now deleting default sub information when it is nulled.*/
129: IF (p_subinventory_code IS NULL) THEN
130: delete from mtl_item_sub_defaults
131: where inventory_item_id = p_inventory_item_id
132: and organization_id = p_organization_id
133: and default_type = p_default_type;
134: ELSE
131: where inventory_item_id = p_inventory_item_id
132: and organization_id = p_organization_id
133: and default_type = p_default_type;
134: ELSE
135: UPDATE mtl_item_sub_defaults
136: SET subinventory_code = p_subinventory_code
137: , LAST_UPDATE_DATE = p_last_update_date
138: , LAST_UPDATED_BY = p_last_updated_by
139: , CREATION_DATE = p_creation_date
148: END IF;
149: END IF; --p_subinventory_code IS NULL
150: ELSIF UPPER(p_process_code) = 'SYNC' THEN
151: /*
152: Check if the record exists in MTL_ITEM_SUB_DEFAULTS for the combination
153: Inventory_item_id,Organization_id,Default_type.If it exists, Update the
154: record with the new info provided. If the record does not exists, insert
155: a new record into MTL_ITEM_SUB_DEFAULTS
156: */
151: /*
152: Check if the record exists in MTL_ITEM_SUB_DEFAULTS for the combination
153: Inventory_item_id,Organization_id,Default_type.If it exists, Update the
154: record with the new info provided. If the record does not exists, insert
155: a new record into MTL_ITEM_SUB_DEFAULTS
156: */
157: IF (l_debug = 1) THEN
158: INV_TRX_UTIL_PUB.TRACE('p_process_code IS Sync ','INSERT_UPDATE_ITEM_SUB_DEFAULTS',9);
159: END IF;
159: END IF;
160: BEGIN
161: SELECT 1
162: INTO l_chk_rec_exists
163: FROM mtl_item_sub_defaults
164: WHERE inventory_item_id = p_inventory_item_id
165: AND organization_id = p_organization_id
166: AND default_type = p_default_type;
167:
166: AND default_type = p_default_type;
167:
168: /*Bug4013041--Now deleting default sub information when it is nulled.*/
169: IF (p_subinventory_code IS NULL and l_chk_rec_exists = 1) THEN
170: delete from mtl_item_sub_defaults
171: where inventory_item_id = p_inventory_item_id
172: and organization_id = p_organization_id
173: and default_type = p_default_type;
174: ELSE
171: where inventory_item_id = p_inventory_item_id
172: and organization_id = p_organization_id
173: and default_type = p_default_type;
174: ELSE
175: UPDATE mtl_item_sub_defaults
176: SET subinventory_code = p_subinventory_code
177: , LAST_UPDATE_DATE = p_last_update_date
178: , LAST_UPDATED_BY = p_last_updated_by
179: , CREATION_DATE = p_creation_date
190:
191: EXCEPTION
192: WHEN no_data_found THEN
193: IF (l_debug = 1) THEN
194: INV_TRX_UTIL_PUB.TRACE('In no data found. Record does not exists in mtl_item_sub_defaults.Insert record.','INSERT_UPDATE_ITEM_SUB_DEFAULTS',9);
195: END IF;
196: INSERT INTO mtl_item_sub_defaults (INVENTORY_ITEM_ID
197: ,ORGANIZATION_ID
198: ,SUBINVENTORY_CODE
192: WHEN no_data_found THEN
193: IF (l_debug = 1) THEN
194: INV_TRX_UTIL_PUB.TRACE('In no data found. Record does not exists in mtl_item_sub_defaults.Insert record.','INSERT_UPDATE_ITEM_SUB_DEFAULTS',9);
195: END IF;
196: INSERT INTO mtl_item_sub_defaults (INVENTORY_ITEM_ID
197: ,ORGANIZATION_ID
198: ,SUBINVENTORY_CODE
199: ,DEFAULT_TYPE
200: ,LAST_UPDATE_DATE