[Home] [Help]
97: bind variables, use table joins. Also added rownum in the subquery */
98:
99: CURSOR c_repLines IS
100: select line_id, (nvl(quantity_detailed,0) - nvl(quantity_delivered,0)) open_quantity, wro.rowid
101: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
102: where wro.wip_entity_id = p_wip_entity_id
103: and wro.repetitive_schedule_id = p_repetitive_schedule_id
104: and mtrl.txn_source_id = wro.wip_entity_id
105: and mtrl.reference_id = wro.repetitive_schedule_id
114: and rownum = 1)
115:
116: for update of wro.quantity_allocated, quantity_backordered nowait;
117:
118: /* Bugfix 4211265: Cursor c_discLines is doing an FTS on mtrl. We will join with wip_entities to get the organization_id and join with mtrl thru wro so that index MTL_TXN_REQUEST_LINES_N1 can be used. */
119:
120: CURSOR c_discLines IS
121: select line_id, (nvl(quantity_detailed,0) - nvl(quantity_delivered,0)) open_quantity, wro.rowid
122: from mtl_txn_request_lines mtrl, wip_requirement_operations wro, wip_entities we /* bug 4211266 */
118: /* Bugfix 4211265: Cursor c_discLines is doing an FTS on mtrl. We will join with wip_entities to get the organization_id and join with mtrl thru wro so that index MTL_TXN_REQUEST_LINES_N1 can be used. */
119:
120: CURSOR c_discLines IS
121: select line_id, (nvl(quantity_detailed,0) - nvl(quantity_delivered,0)) open_quantity, wro.rowid
122: from mtl_txn_request_lines mtrl, wip_requirement_operations wro, wip_entities we /* bug 4211266 */
123: where we.wip_entity_id = p_wip_entity_id
124: and wro.organization_id = we.organization_id
125: and wro.wip_entity_id = we.wip_entity_id
126: and mtrl.organization_id = wro.organization_id
139: /* End of Bugfix 4743190 */
140:
141: CURSOR c_flowLines IS
142: select line_id
143: from mtl_txn_request_lines mtrl, wip_entities we
144: where mtrl.TRANSACTION_TYPE_ID = INV_Globals.G_TYPE_XFER_ORDER_REPL_SUBXFR -- 51
145: and mtrl.TRANSACTION_SOURCE_TYPE_ID = INV_Globals.G_SOURCETYPE_INVENTORY --13
146: and mtrl.txn_source_id = we.wip_entity_id
147: and mtrl.organization_id = we.organization_id
270: l_dummy VARCHAR2(1);
271:
272: CURSOR c_repLines IS
273: select line_id, (nvl(quantity_detailed,0) - nvl(quantity_delivered,0)) open_quantity, wro.rowid
274: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
275: where mtrl.txn_source_id = p_wip_entity_id
276: and mtrl.reference_id = p_repetitive_schedule_id
277: and wro.wip_entity_id = p_wip_entity_id
278: and wro.repetitive_schedule_id = p_repetitive_schedule_id
290: for update of wro.quantity_allocated, quantity_backordered nowait;
291:
292: CURSOR c_discLines IS
293: select line_id, (nvl(quantity_detailed,0) - nvl(quantity_delivered,0)) open_quantity, wro.rowid
294: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
295: where mtrl.txn_source_id = p_wip_entity_id
296: and wro.wip_entity_id = p_wip_entity_id
297: and wro.operation_seq_num = p_operation_seq_num
298: and mtrl.txn_source_line_id = wro.operation_seq_num
433: l_reductionQty NUMBER;
434:
435: CURSOR c_repLines(v_wip_entity_id NUMBER, v_repetitive_schedule_id NUMBER, v_operation_seq_num NUMBER, v_inventory_item_id NUMBER) IS
436: select line_id, nvl(mtrl.required_quantity,(nvl(quantity_detailed,0) - nvl(quantity_delivered,0))) open_quantity, wro.rowid
437: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
438: where mtrl.txn_source_id = v_wip_entity_id
439: and mtrl.reference_id = v_repetitive_schedule_id
440: and wro.wip_entity_id = v_wip_entity_id
441: and wro.repetitive_schedule_id = v_repetitive_schedule_id
455: for update of wro.quantity_allocated, quantity_backordered nowait;
456:
457: CURSOR c_discLines(v_wip_entity_id NUMBER, v_operation_seq_num NUMBER, v_inventory_item_id NUMBER) IS
458: select line_id, nvl(mtrl.required_quantity,(nvl(quantity_detailed,0) - nvl(quantity_delivered,0))) open_quantity, wro.rowid
459: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
460: where mtrl.txn_source_id = v_wip_entity_id
461: and wro.wip_entity_id = v_wip_entity_id
462: and wro.operation_seq_num = v_operation_seq_num
463: and mtrl.txn_source_line_id = wro.operation_seq_num
581: x_return_status OUT NOCOPY VARCHAR2,
582: x_msg_data OUT NOCOPY VARCHAR2) IS
583: CURSOR c_repLines IS
584: select line_id
585: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
586: where mtrl.txn_source_id = p_wip_entity_id
587: and mtrl.txn_source_line_id = p_repetitive_schedule_id
588: and wro.wip_entity_id = p_wip_entity_id
589: and wro.repetitive_schedule_id = p_repetitive_schedule_id
605: -- Also, the source_type should not be WIP. In case of backflush transfer, the source type is INV.
606:
607: CURSOR c_discLines IS
608: select line_id
609: from mtl_txn_request_lines mtrl, wip_requirement_operations wro
610: where mtrl.txn_source_id = p_wip_entity_id
611: and wro.wip_entity_id = p_wip_entity_id
612: and wro.operation_seq_num = 1
613: and mtrl.txn_source_line_id = wro.operation_seq_num