[Home] [Help]
PACKAGE BODY: APPS.WIP_POPULATE_TEMP
Source
1 PACKAGE BODY WIP_POPULATE_TEMP as
2 /* $Header: wiputmtb.pls 120.6.12000000.2 2007/10/18 23:21:18 ankohli ship $ */
3
4 PROCEDURE INSERT_TEMP
5 (p_transaction_mode IN NUMBER,
6 p_wip_entity_id IN NUMBER,
7 p_line_id IN NUMBER,
8 p_transaction_date IN DATE,
9 p_transaction_type_id IN NUMBER,
10 p_transaction_action_id IN NUMBER,
11 p_subinventory IN VARCHAR2,
12 p_locator_id IN NUMBER,
13 p_repetitive_days IN NUMBER,
14 p_assembly_quantity IN NUMBER,
15 p_operation_seq_num IN NUMBER,
16 p_department_id IN NUMBER,
17 p_criteria_sub IN VARCHAR2,
18 p_organization_id IN NUMBER,
19 p_acct_period_id IN NUMBER,
20 p_last_updated_by IN NUMBER,
21 p_entity_type IN NUMBER,
22 p_next_seq_num IN NUMBER,
23 p_calendar_code IN VARCHAR2,
24 p_exception_set_id IN NUMBER,
25 p_transaction_header_id IN NUMBER,
26 p_commit_counter OUT NOCOPY NUMBER)
27 IS
28 x_transaction_source_type_id NUMBER;
29 x_transaction_source_id NUMBER;
30 x_item_segments VARCHAR2(2000);
31 x_locator_id NUMBER;
32 x_locator_control NUMBER;
33 x_locator_segments VARCHAR2(2000);
34 x_valid_locator_flag VARCHAR2(2);
35 x_valid_subinventory_flag VARCHAR2(2);
36 x_dummy BOOLEAN;
37 x_rev VARCHAR2(5) := NULL;
38 x_wip_commit_flag VARCHAR2(2);
39 i NUMBER := 0;
40 x_commit_counter NUMBER := 0;
41 x_released_revs_type NUMBER ;
42 x_released_revs_meaning Varchar2(30);
43 l_include_yield NUMBER; /* ER 4369064: Component Yield Enhancement */
44
45
46 CURSOR CDIS IS
47 SELECT WIP_COMPONENT.Determine_Txn_Quantity
48 (p_transaction_action_id,
49 wro.quantity_per_assembly,
50 wro.required_quantity,
51 wro.quantity_issued,
52 p_assembly_quantity,
53 l_include_yield, /* ER 4369064: Component Yield Enhancement */
54 wro.component_yield_factor,
55 wro.basis_type) transaction_quantity, /* LBM Project */
56 wro.inventory_item_id,
57 msinv.secondary_inventory_name subinventory_code,
58 wro.quantity_issued,
59 wro.required_quantity,
60 wro.quantity_per_assembly,
61 bd.department_id,
62 bd.department_code,
63 wro.operation_seq_num,
64 wro.wip_supply_type,
65 wro.supply_subinventory,
66 wro.supply_locator_id,
67 msi.mtl_transactions_enabled_flag,
68 msi.description,
69 msi.location_control_code,
70 msi.restrict_subinventories_code,
71 msi.restrict_locators_code,
72 msi.revision_qty_control_code,
73 msi.primary_uom_code,
74 mum.uom_class,
75 msi.inventory_asset_flag,
76 msi.allowed_units_lookup_code,
77 msi.shelf_life_code,
78 msi.shelf_life_days,
79 /* decode(msi.serial_number_control_code,2,2,5,2,1) serial_control_code, */
80 decode(msi.serial_number_control_code,2,2,5,5,1) serial_control_code, /* Bug 2914137 */
81 msi.lot_control_code,
82 msinv.locator_type,
83 msi.start_auto_lot_number,
84 msi.auto_lot_alpha_prefix,
85 msi.start_auto_serial_number,
86 msi.auto_serial_alpha_prefix,
87 mil.inventory_location_id,
88 mil.disable_date locator_disable_date,
89 mp.stock_locator_control_code,
90 WIP_COMPONENT.Valid_Subinventory(msinv.secondary_inventory_name,
91 msi.inventory_item_id,
92 p_organization_id)
93 valid_subinventory_flag,
94 mil.project_id,
95 mil.task_id,
96 wdj.project_id source_project_id,
97 wdj.task_id source_task_id,
98 msi.eam_item_type
99 FROM mtl_parameters mp,
100 mtl_item_locations mil,
101 mtl_secondary_inventories msinv,
102 mtl_units_of_measure mum,
103 bom_departments bd,
104 mtl_system_items msi,
105 wip_discrete_jobs wdj,
106 wip_requirement_operations wro
107 WHERE wro.wip_entity_id = p_wip_entity_id
108 AND wro.organization_id = p_organization_id
109 AND WIP_COMPONENT.is_valid(
110 p_transaction_action_id,
111 wro.wip_supply_type,
112 wro.required_quantity,
113 wro.quantity_issued,
114 p_assembly_quantity,
115 p_entity_type) = WIP_CONSTANTS.YES
116 AND WIP_COMPONENT.meets_criteria(
117 wro.operation_seq_num,
118 p_operation_seq_num,
119 wro.department_id,
120 p_department_id,
121 wro.supply_subinventory,
122 p_criteria_sub) = WIP_CONSTANTS.YES
123 AND wdj.wip_entity_id = wro.wip_entity_id
124 AND wdj.organization_id = wro.organization_id
125 AND bd.department_id(+) = wro.department_id
126 AND bd.organization_id(+) = wro.organization_id
127 AND msi.inventory_item_id = wro.inventory_item_id
128 AND msi.organization_id = wro.organization_id
129 AND mum.uom_code = msi.primary_uom_code
130 AND msinv.organization_id(+) = wro.organization_id
131 AND msinv.secondary_inventory_name(+) =
132 decode(p_transaction_action_id,
133 WIP_CONSTANTS.SUBTRFR_ACTION, p_subinventory,
134 NVL(wro.supply_subinventory, p_subinventory))
135 AND mil.organization_id(+) = wro.organization_id
136 AND mil.inventory_location_id(+) =
137 decode(p_transaction_action_id,
138 WIP_CONSTANTS.SUBTRFR_ACTION, p_locator_id,
139 NVL(wro.supply_locator_id, p_locator_id))
140 AND mp.organization_id = wro.organization_id
141 ORDER BY
142 wro.operation_seq_num;
143
144 CURSOR CREP IS
145 SELECT
146 wro.inventory_item_id,
147 msinv.secondary_inventory_name subinventory_code,
148 sum(wro.quantity_issued) quantity_issued,
149 sum(wro.required_quantity) required_quantity,
150 sum(wro.quantity_per_assembly) quantity_per_assembly,
151 bd.department_id,
152 bd.department_code,
153 wro.operation_seq_num,
154 wro.wip_supply_type,
155 wro.supply_subinventory,
156 wro.supply_locator_id,
157 msi.mtl_transactions_enabled_flag,
158 msi.description,
159 msi.location_control_code,
160 msi.restrict_subinventories_code,
161 msi.restrict_locators_code,
162 msi.revision_qty_control_code,
163 msi.primary_uom_code,
164 mum.uom_class,
165 msi.inventory_asset_flag,
166 msi.allowed_units_lookup_code,
167 msi.shelf_life_code,
168 msi.shelf_life_days,
169 decode(msi.serial_number_control_code,2,2,5,5,1) serial_control_code, /* Bug 2914137 */
170 msi.lot_control_code,
171 msinv.locator_type,
172 msi.start_auto_lot_number,
173 msi.auto_lot_alpha_prefix,
174 msi.start_auto_serial_number,
175 msi.auto_serial_alpha_prefix,
176 mil.inventory_location_id,
177 mil.disable_date locator_disable_date,
178 mp.stock_locator_control_code,
179 SUM((LEAST(bcd1.next_seq_num+wrs.processing_work_days,
180 p_next_seq_num + p_repetitive_days) -
181 GREATEST(bcd1.next_seq_num, p_next_seq_num)) *
182 wro.quantity_per_assembly * wrs.daily_production_rate *
183 decode(p_transaction_action_id, 1, -1, 2, -1, 33, -1, 1)/
184 decode(l_include_yield,2,1,wro.component_yield_factor))
185 transaction_quantity /* ER 4369064: Component Yield Enhancement */
186 FROM mtl_parameters mp,
187 mtl_item_locations mil,
188 mtl_secondary_inventories msinv,
189 mtl_units_of_measure mum,
190 bom_departments bd,
191 mtl_system_items msi,
192 bom_calendar_dates bcd1,
193 wip_requirement_operations wro,
194 wip_repetitive_schedules wrs
195 WHERE wro.wip_entity_id = wrs.wip_entity_id
196 AND wro.organization_id = wrs.organization_id
197 AND wro.repetitive_schedule_id = wrs.repetitive_schedule_id
198 AND wrs.wip_entity_id = p_wip_entity_id
199 AND wrs.organization_id = p_organization_id
200 AND wrs.line_id = p_line_id
201 AND bcd1.calendar_code(+) = p_calendar_code
202 AND bcd1.exception_set_id(+) = p_exception_set_id
203 --bug 5470386 truncating the time factor from both the date fields as
204 -- calendar date doesnot have the time factor but date required field includes the time factor
205 --and therefore repetitive schedule is not defaulting
206 --AND bcd1.calendar_date(+) = trunc(wro.date_required)
207 AND trunc(bcd1.calendar_date(+)) = trunc(wro.date_required)
208 AND bcd1.next_seq_num(+) < p_next_seq_num + p_repetitive_days
209 AND bcd1.next_seq_num + wrs.processing_work_days > p_next_seq_num
210 AND WIP_COMPONENT.is_valid(
211 p_transaction_action_id,
212 wro.wip_supply_type,
213 wro.required_quantity,
214 wro.quantity_issued,
215 NULL,
216 p_entity_type) = WIP_CONSTANTS.YES
217 AND WIP_COMPONENT.meets_criteria(
218 wro.operation_seq_num,
219 p_operation_seq_num,
220 wro.department_id,
221 p_department_id,
222 wro.supply_subinventory,
223 p_criteria_sub) = WIP_CONSTANTS.YES
224 AND bd.department_id(+) = wro.department_id
225 AND bd.organization_id(+) = wro.organization_id
226 AND msi.inventory_item_id = wro.inventory_item_id
227 AND msi.organization_id = wro.organization_id
228 AND mum.uom_code = msi.primary_uom_code
229 AND msinv.organization_id(+) = wro.organization_id
230 AND msinv.secondary_inventory_name(+) =
231 decode(p_transaction_action_id,
232 WIP_CONSTANTS.SUBTRFR_ACTION, p_subinventory,
233 NVL(wro.supply_subinventory, p_subinventory))
234 AND mil.organization_id(+) = wro.organization_id
235 AND mil.inventory_location_id(+) =
236 decode(p_transaction_action_id,
237 WIP_CONSTANTS.SUBTRFR_ACTION, p_locator_id,
238 NVL(wro.supply_locator_id, p_locator_id))
239 AND mp.organization_id = wro.organization_id
240 /* Fix for bug 2570492 Adding filtering by status_type */
241 AND status_type in (WIP_CONSTANTS.RELEASED, WIP_CONSTANTS.COMP_CHRG)
242 GROUP BY
243 wro.inventory_item_id,
244 msinv.secondary_inventory_name,
245 bd.department_id,
246 bd.department_code,
247 wro.operation_seq_num,
248 wro.wip_supply_type,
249 wro.supply_subinventory,
250 wro.supply_locator_id,
251 msi.mtl_transactions_enabled_flag,
252 msi.description,
253 msi.location_control_code,
254 msi.restrict_subinventories_code,
255 msi.restrict_locators_code,
256 msi.revision_qty_control_code,
257 msi.primary_uom_code,
258 mum.uom_class,
259 msi.inventory_asset_flag,
260 msi.allowed_units_lookup_code,
261 msi.shelf_life_code,
262 msi.shelf_life_days,
263 decode(msi.serial_number_control_code,2,2,5,5,1), /* Bug 2914137 */
264 msi.lot_control_code,
265 msinv.locator_type,
266 msi.start_auto_lot_number,
267 msi.auto_lot_alpha_prefix,
268 msi.start_auto_serial_number,
269 msi.auto_serial_alpha_prefix,
270 mil.inventory_location_id,
271 mil.disable_date,
272 mp.stock_locator_control_code
273 ORDER BY
274 wro.operation_seq_num,
275 wro.supply_subinventory
276 ;
277
278 BEGIN
279 x_wip_commit_flag := 'Y';
280
281 X_COMMIT_COUNTER := 0;
282
283 /* Source Type and Source are set differently for Subinventory Replen */
284
285 IF p_transaction_action_id = WIP_CONSTANTS.SUBTRFR_ACTION THEN
286 /*Start: Bug 6460181: Instead of a constant value for x_transaction_source_type_id, the value is selected from mtl_transaction_type table*/
287
288 SELECT transaction_source_type_id
289 into x_transaction_source_type_id
290 from mtl_transaction_types where transaction_type_id = p_transaction_type_id ;
291 --x_transaction_source_type_id := 13;
292 x_transaction_source_id := NULL;
293 ELSE
294 x_transaction_source_type_id := 5;
295 x_transaction_source_id := p_wip_entity_id;
296 END IF;
297
298 /* ER 4369064: Component Yield Enhancement */
299 select nvl(include_component_yield,1) /* Handled Null value */
300 into l_include_yield
301 from wip_parameters
302 where organization_id = p_organization_id;
303
304 -- set up release type
305 /* 2999230 */
306 wip_common.Get_Released_Revs_Type_Meaning (x_released_revs_type,
307 x_released_revs_meaning
308 );
309
310 --6 is eAM job
311 IF p_entity_type in (WIP_CONSTANTS.DISCRETE,WIP_CONSTANTS.LOTBASED,6) THEN
312 FOR C IN CDIS LOOP
313
314 x_dummy := FND_FLEX_KEYVAL.validate_ccid(
315 appl_short_name => 'INV',
316 key_flex_code => 'MSTK',
317 structure_number => 101,
318 combination_id => C.inventory_item_id,
319 data_set => p_organization_id);
320
321 x_item_segments := FND_FLEX_KEYVAL.concatenated_values;
322
323 x_locator_id := C.inventory_location_id;
324 /* Fix for Bug# 2149033. Added x_locator_id condition in if condition */
325 IF(C.subinventory_code IS NOT NULL) and (x_locator_id IS NOT NULL) THEN
326 x_valid_locator_flag := WIP_COMPONENT.Valid_Locator
327 (x_locator_id,
328 C.inventory_item_id,
329 p_organization_id,
330 C.stock_locator_control_code,
331 C.locator_type,
332 C.location_control_code,
333 C.restrict_locators_code,
334 C.locator_disable_date,
335 x_locator_control);
336
337 IF x_locator_control = 1 THEN
338 x_locator_segments := NULL;
339 ELSE
340
341 x_dummy := FND_FLEX_KEYVAL.validate_ccid(
342 appl_short_name => 'INV',
343 key_flex_code => 'MTLL',
344 structure_number => 101,
345 combination_id => x_locator_id,
346 data_set => p_organization_id);
347
348 -- fix for bug 4084598
349 --x_locator_segments := FND_FLEX_KEYVAL.concatenated_values;
350 END IF;
351 ELSE
352 x_valid_locator_flag := 'N';
353 x_locator_id := null; --no locator when sub is not populated
354 x_locator_segments := NULL;
355 END IF;
356
357 IF C.revision_qty_control_code = WIP_CONSTANTS.REV THEN
358 BOM_REVISIONS.Get_Revision
359 (type => 'PART',
360 eco_status => x_released_revs_meaning,
361 examine_type => 'ALL',
362 org_id => P_Organization_Id,
363 item_id => C.inventory_item_id,
364 rev_date => p_transaction_date,
365 itm_rev => x_rev);
366 ELSE
367 x_rev := NULL;
368 END IF;
369
370 IF C.mtl_transactions_enabled_flag = 'N'
371 OR (C.valid_subinventory_flag = 'N')
372 OR (x_valid_locator_flag = 'N')
373 OR (C.lot_control_code <> 1
374 AND C.transaction_quantity <> 0)
375 OR (C.serial_control_code <> 1
376 AND C.transaction_quantity <> 0)
377 OR (C.lot_control_code <> 1
378 AND C.serial_control_code <> 1)
379 OR (C.transaction_quantity = 0
380 AND p_assembly_quantity IS NOT NULL
381 AND p_transaction_action_id IN
382 (WIP_CONSTANTS.RETNEGC_ACTION,
383 WIP_CONSTANTS.RETCOMP_ACTION)) THEN
384 x_wip_commit_flag := 'N';
385 X_COMMIT_COUNTER := X_COMMIT_COUNTER + 1;
386 ELSE
387 x_wip_commit_flag := 'Y';
388 END IF;
389
390 -- bug3430508: do not insert subinv/loc if material status
391 -- disables it
392 if (inv_material_status_grp.is_status_applicable(
393 NULL, -- p_wms_installed,
394 NULL,
395 p_transaction_type_id, -- p_trx_type_id (is this same as trx_type_id?)
396 NULL,
397 NULL,
398 p_organization_id,
399 C.inventory_item_id,
400 C.subinventory_code,
401 NULL,
402 NULL,
403 NULL,
404 'Z') = 'N') then
405 C.subinventory_code := null;
406 x_locator_id := null;
407 end if;
408
409 if (inv_material_status_grp.is_status_applicable(
410 NULL, -- p_wms_installed,
411 NULL,
412 p_transaction_type_id, -- p_trx_type_id (is this same as trx_type_id?)
413 NULL,
414 NULL,
415 p_organization_id,
416 C.inventory_item_id,
417 NULL,
418 x_locator_id,
419 NULL,
420 NULL,
421 'L') = 'N') then
422 x_locator_id := null;
423 end if;
424
425 INSERT INTO mtl_material_transactions_temp
426 (item_segments,
427 locator_segments,
428 primary_switch,
429 transaction_header_id,
430 transaction_mode,
431 lock_flag,
432 inventory_item_id,
433 subinventory_code,
434 primary_quantity,
435 transaction_quantity,
436 transaction_date,
437 organization_id,
438 acct_period_id,
439 last_update_date,
440 last_updated_by,
441 creation_date,
442 created_by,
443 transaction_source_id,
444 transaction_source_type_id,
445 transaction_type_id,
446 transaction_action_id,
447 wip_entity_type,
448 repetitive_line_id,
449 department_id,
450 department_code,
451 locator_id,
452 required_flag,
453 operation_seq_num,
454 transfer_subinventory,
455 transfer_to_location,
456 wip_supply_type,
457 supply_subinventory,
458 supply_locator_id,
459 item_trx_enabled_flag,
460 item_description,
461 item_location_control_code,
462 item_restrict_subinv_code,
463 item_restrict_locators_code,
464 item_revision_qty_control_code,
465 revision,
466 item_primary_uom_code,
467 transaction_uom,
468 item_uom_class,
469 item_inventory_asset_flag,
470 allowed_units_lookup_code,
471 item_shelf_life_code,
472 item_shelf_life_days,
473 item_serial_control_code,
474 item_lot_control_code,
475 current_locator_control_code,
476 wip_commit_flag,
477 number_of_lots_entered,
478 next_lot_number,
479 next_serial_number,
480 lot_alpha_prefix,
481 serial_alpha_prefix,
482 valid_subinventory_flag,
483 valid_locator_flag,
484 negative_req_flag,
485 posting_flag,
486 process_flag,
487 project_id,
488 task_id,
489 source_project_id,
490 source_task_id)
491 VALUES
492 (x_item_segments,
493 x_locator_segments,
494 i,
495 p_transaction_header_id,
496 decode(p_transaction_mode,2,2,1),
497 'N',
498 C.inventory_item_id,
499 C.subinventory_code,
500 decode(C.eam_item_type, 3, 1, C.transaction_quantity),
501 decode(C.eam_item_type, 3, 1, C.transaction_quantity),
502 p_transaction_date,
503 p_organization_id,
504 p_acct_period_id,
505 SYSDATE,
506 p_last_updated_by,
507 SYSDATE,
508 p_last_updated_by,
509 x_transaction_source_id,
510 x_transaction_source_type_id,
511 p_transaction_type_id,
512 p_transaction_action_id,
513 p_entity_type,
514 p_line_id,
515 C.department_id,
516 C.department_code,
517 x_locator_id,
518 1,
519 C.operation_seq_num,
520 DECODE( p_transaction_action_id,
521 2,C.supply_subinventory,
522 NULL),
523 DECODE( p_transaction_action_id,
524 2,C.supply_locator_id,
525 NULL),
526 C.wip_supply_type,
527 C.supply_subinventory,
528 C.supply_locator_id,
529 C.mtl_transactions_enabled_flag,
530 C.description,
531 C.location_control_code,
532 C.restrict_subinventories_code,
533 C.restrict_locators_code,
534 C.revision_qty_control_code,
535 x_rev,
536 C.primary_uom_code,
537 C.primary_uom_code,
538 C.uom_class,
539 C.inventory_asset_flag,
540 C.allowed_units_lookup_code,
541 C.shelf_life_code,
542 C.shelf_life_days,
543 C.serial_control_code,
544 C.lot_control_code,
545 C.locator_type,
546 x_wip_commit_flag,
547 0,
548 C.start_auto_lot_number,
549 C.start_auto_serial_number,
550 C.auto_lot_alpha_prefix,
551 C.auto_serial_alpha_prefix,
552 C.valid_subinventory_flag,
553 x_valid_locator_flag,
554 sign(C.required_quantity),
555 'Y',
556 'Y',
557 C.project_id,
558 C.task_id,
559 C.source_project_id,
560 C.source_task_id);
561
562 i := i + 1;
563
564 END LOOP;
565
566 ELSE
567
568 FOR C IN CREP LOOP
569
570 x_dummy := FND_FLEX_KEYVAL.validate_ccid(
571 appl_short_name => 'INV',
572 key_flex_code => 'MSTK',
573 structure_number => 101,
574 combination_id => C.inventory_item_id,
575 data_set => p_organization_id);
576
577 x_item_segments := FND_FLEX_KEYVAL.concatenated_values;
578 IF(C.subinventory_code IS NULL) THEN
579 x_valid_subinventory_flag := 'N';
580 x_valid_locator_flag := 'N';
581 ELSE
582 x_valid_subinventory_flag := WIP_COMPONENT.Valid_Subinventory
583 (C.subinventory_code,
584 C.inventory_item_id,
585 p_organization_id);
586
587 x_locator_id := C.inventory_location_id;
588
589 x_valid_locator_flag := WIP_COMPONENT.Valid_Locator
590 (x_locator_id,
591 C.inventory_item_id,
592 p_organization_id,
593 C.stock_locator_control_code,
594 C.locator_type,
595 C.location_control_code,
596 C.restrict_locators_code,
597 C.locator_disable_date,
598 x_locator_control);
599
600 IF x_locator_control = 1 THEN
601 x_locator_segments := NULL;
602 ELSE
603
604 x_dummy := FND_FLEX_KEYVAL.validate_ccid(
605 appl_short_name => 'INV',
606 key_flex_code => 'MTLL',
607 structure_number => 101,
608 combination_id => x_locator_id,
609 data_set => p_organization_id);
610
611 -- fix for bug 4084598
612 --x_locator_segments := FND_FLEX_KEYVAL.concatenated_values;
613 END IF;
614 END IF;
615
616 IF C.revision_qty_control_code = WIP_CONSTANTS.REV THEN
617 BOM_REVISIONS.Get_Revision
618 (type => 'PART',
619 eco_status => x_released_revs_meaning,
620 examine_type => 'ALL',
621 org_id => P_Organization_Id,
622 item_id => C.inventory_item_id,
623 rev_date => p_transaction_date,
624 itm_rev => x_rev);
625 ELSE
626 x_rev := NULL;
627 END IF;
628
629 IF C.mtl_transactions_enabled_flag = 'N'
630 OR (x_valid_subinventory_flag = 'N')
631 OR (x_valid_locator_flag = 'N')
632 OR (C.lot_control_code <> 1
633 AND C.transaction_quantity <> 0)
634 OR (C.serial_control_code <> 1
635 AND C.transaction_quantity <> 0)
636 OR (C.lot_control_code <> 1
637 AND C.serial_control_code <> 1)
638 OR (C.transaction_quantity = 0
639 AND p_assembly_quantity IS NOT NULL
640 AND p_transaction_action_id IN
641 (WIP_CONSTANTS.RETNEGC_ACTION,
642 WIP_CONSTANTS.RETCOMP_ACTION)) THEN
643 x_wip_commit_flag := 'N';
644 X_COMMIT_COUNTER := X_COMMIT_COUNTER + 1;
645 ELSE
646 x_wip_commit_flag := 'Y';
647 END IF;
648
649 INSERT INTO mtl_material_transactions_temp
650 (item_segments,
651 locator_segments,
652 primary_switch,
653 transaction_header_id,
654 transaction_mode,
655 lock_flag,
656 inventory_item_id,
657 subinventory_code,
658 primary_quantity,
659 transaction_quantity,
660 transaction_date,
661 organization_id,
662 acct_period_id,
663 last_update_date,
664 last_updated_by,
665 creation_date,
666 created_by,
667 transaction_source_id,
668 transaction_source_type_id,
669 transaction_type_id,
670 transaction_action_id,
671 wip_entity_type,
672 repetitive_line_id,
673 department_id,
674 department_code,
675 locator_id,
676 required_flag,
677 operation_seq_num,
678 transfer_subinventory,
679 transfer_to_location,
680 wip_supply_type,
681 supply_subinventory,
682 supply_locator_id,
683 item_trx_enabled_flag,
684 item_description,
685 item_location_control_code,
686 item_restrict_subinv_code,
687 item_restrict_locators_code,
688 item_revision_qty_control_code,
689 revision,
690 item_primary_uom_code,
691 transaction_uom,
692 item_uom_class,
693 item_inventory_asset_flag,
694 allowed_units_lookup_code,
695 item_shelf_life_code,
696 item_shelf_life_days,
697 item_serial_control_code,
698 item_lot_control_code,
699 current_locator_control_code,
700 wip_commit_flag,
701 number_of_lots_entered,
702 next_lot_number,
703 next_serial_number,
704 lot_alpha_prefix,
705 serial_alpha_prefix,
706 valid_subinventory_flag,
707 valid_locator_flag,
708 negative_req_flag,
709 posting_flag,
710 process_flag)
711 VALUES
712 (x_item_segments,
713 x_locator_segments,
714 i,
715 p_transaction_header_id,
716 decode(p_transaction_mode,2,2,1),
717 'N',
718 C.inventory_item_id,
719 C.subinventory_code,
720 C.transaction_quantity,
721 C.transaction_quantity,
722 p_transaction_date,
723 p_organization_id,
724 p_acct_period_id,
725 SYSDATE,
726 p_last_updated_by,
727 SYSDATE,
728 p_last_updated_by,
729 x_transaction_source_id,
730 x_transaction_source_type_id,
731 p_transaction_type_id,
732 p_transaction_action_id,
733 p_entity_type,
734 p_line_id,
735 C.department_id,
736 C.department_code,
737 x_locator_id,
738 1, /* Required_Flag */
739 C.operation_seq_num,
740 DECODE( p_transaction_action_id,
741 2,C.supply_subinventory,
742 NULL),
743 DECODE( p_transaction_action_id,
744 2,C.supply_locator_id,
745 NULL),
746 C.wip_supply_type,
747 C.supply_subinventory,
748 C.supply_locator_id,
749 C.mtl_transactions_enabled_flag,
750 C.description,
751 C.location_control_code,
752 C.restrict_subinventories_code,
753 C.restrict_locators_code,
754 C.revision_qty_control_code,
755 x_rev,
756 C.primary_uom_code,
757 C.primary_uom_code,
758 C.uom_class,
759 C.inventory_asset_flag,
760 C.allowed_units_lookup_code,
761 C.shelf_life_code,
762 C.shelf_life_days,
763 C.serial_control_code,
764 C.lot_control_code,
765 C.locator_type,
766 x_wip_commit_flag,
767 0, /* Num Lots Entered */
768 C.start_auto_lot_number,
769 C.start_auto_serial_number,
770 C.auto_lot_alpha_prefix,
771 C.auto_serial_alpha_prefix,
772 x_valid_subinventory_flag,
773 x_valid_locator_flag,
774 sign(C.required_quantity),
775 'Y',
776 'Y');
777
778 i := i + 1;
779
780 END LOOP;
781
782 END IF;
783
784 P_COMMIT_COUNTER := X_COMMIT_COUNTER;
785
786 END INSERT_TEMP;
787
788 END WIP_POPULATE_TEMP;