115: * Also sets prevent encumbrace flag to 'Y' in the po_req_distributions table.
116: * Effects: This api split the requisition lines, if needed, depending on the
117: * allocation done by the sourcing user. This api uses a global temp. table
118: * to massage the input given by sourcing and inserts records into
119: * po_requisition_lines_all and po_req_distributions_all table. This api also
120: * handles the encumbrace effect of splitting requisition lines. This api would
121: * be called from ORacle sourcing workflow.
122: *
123: * Returns:
199: -- transactions.Opening the cursor keeps the records locked till the
200: -- transaction control happens.
201: CURSOR LockReqLines_Cursor IS
202: SELECT prl.requisition_line_id,quantity
203: FROM po_requisition_lines_all prl, --
205: WHERE prl.requisition_line_id = prs.requisition_line_id
206: FOR UPDATE OF prl.quantity NOWAIT;
207:
213: --
214: l_online_report_id PO_ONLINE_REPORT_TEXT.online_report_id%TYPE;
215:
216: --
217: l_old_line_requesting_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
218: l_line_requesting_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
219: l_current_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
220: l_org_context_changed VARCHAR2(1) := 'N';
221:
214: l_online_report_id PO_ONLINE_REPORT_TEXT.online_report_id%TYPE;
215:
216: --
217: l_old_line_requesting_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
218: l_line_requesting_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
219: l_current_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
220: l_org_context_changed VARCHAR2(1) := 'N';
221:
222: -- bug 5249299
215:
216: --
217: l_old_line_requesting_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
218: l_line_requesting_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
219: l_current_ou_id PO_REQUISITION_LINES_ALL.org_id%TYPE;
220: l_org_context_changed VARCHAR2(1) := 'N';
221:
222: -- bug 5249299
223: l_project_id po_req_distributions_all.project_id%TYPE;
316: (SELECT quantity,
317: --decode(cancel_flag,'Y','C',null)
318: decode(cancel_flag,'Y','C',decode(closed_code,'FINALLY CLOSED',
319: 'C',NULL))
320: FROM po_requisition_lines_all prl --
322: );
323:
324: l_progress :='031';
369: UPDATE po_req_split_lines_gt prs
370: SET prs.record_status='C'
371: WHERE NOT EXISTS
372: (SELECT requisition_line_id
373: FROM po_requisition_lines_all prl --
375: );
376:
377: l_progress :='036';
418: UPDATE po_req_split_lines_gt PRS
419: SET ( PRS.record_status
420: , PRS.new_req_line_id ) = ( SELECT 'T'
421: , PRL.requisition_line_id
422: FROM po_requisition_lines_all PRL
423: , po_line_types_b PLT
424: WHERE PRL.requisition_line_id = PRS.requisition_line_id
425: AND PRL.line_type_id = PLT.line_type_id
426: AND PLT.order_type_lookup_code IN ('RATE','FIXED PRICE')
569:
570: -- SQL What: Make entry for the new remainder req lines in the temp table
571: -- ( which are not consumed or Services Lines )
572: -- SQL Why : These rows stand for the remainder req lines to be created
573: -- in the po_requisition_lines_all table.
574: INSERT INTO po_req_split_lines_gt
575: ( auction_header_id,
576: bid_number,
577: bid_line_number,
631: FND_LOG.string(FND_LOG.LEVEL_STATEMENT, l_module,
632: 'before stamping bid info for equal allocation ');
633: END IF;
634:
635: -- SQL What:update the po_requisition_lines_all table to stamp bid info for
636: -- lines with Equal allocation (include Services Lines)
637: -- SQL Why :We need this update only for equal award. For other cases
638: -- we pass in the bid info through the insert statement.
639: UPDATE po_requisition_lines_all prl --
635: -- SQL What:update the po_requisition_lines_all table to stamp bid info for
636: -- lines with Equal allocation (include Services Lines)
637: -- SQL Why :We need this update only for equal award. For other cases
638: -- we pass in the bid info through the insert statement.
639: UPDATE po_requisition_lines_all prl --
641: bid_line_number)=
642: (SELECT prs.bid_number,
643: prs.bid_line_number
689: -- the new requisition lines
690: UPDATE po_req_split_lines_gt prs
691: SET prs.new_line_num=
692: (SELECT max(prl.line_num)
693: FROM po_requisition_lines_all prl --
695: WHERE prs.record_status in ('S','N');
696:
697: l_progress :='081';
916: min_bid_number_rslt_tbl,
917: record_status_rslt_tbl,
918: encumbrance_flag_rslt_tbl -- Bug 4723367
919: FROM po_req_split_lines_gt prs,
920: po_requisition_lines_all prl, --
922: -- Bug 5467617: Removed the joins to PO_VENDORS and PO_VENDOR_SITES_ALL
923: -- These are not required anymore because they we used to fetch the
924: -- rounding rule from the site level. Now the tax rounding is done by
965: END IF;
966:
967: FORALL l_insert_line_index IN
968: 1.. requisition_line_id_rslt_tbl.COUNT
969: INSERT INTO po_requisition_lines_all --
971: requisition_line_id,
972: requisition_header_id,
973: line_num,
1205: prl.purchase_basis,
1206: prl.matching_basis,
1207: prl.org_id, --
1208: 'CREATE' --
1209: FROM po_requisition_lines_all prl --
1211: requisition_line_id_rslt_tbl(l_insert_line_index);
1212:
1213: l_progress :='131';
1251:
1252: --
1253: -- WHO columns.
1254: FORALL l_mod_buyer_index in 1.. requisition_line_id_rslt_tbl.COUNT
1255: UPDATE po_requisition_lines_all --
1257: reqs_in_pool_flag = NULL, --
1258: last_update_date = SYSDATE,
1259: last_updated_by = FND_GLOBAL.USER_ID,
1356: nvl(prl.quantity_delivered, 0)),
1357: null,
1358: prl.unit_meas_lookup_code,
1359: decode(prl.item_id, null, null, prl.need_by_date + nvl(msi.postprocessing_lead_time,0))
1360: FROM po_requisition_lines_all prl, --
1362: WHERE prl.requisition_line_id =
1363: new_req_line_id_rslt_tbl(l_update_mtl_supply_index)
1364: AND prl.destination_organization_id = msi.organization_id(+)
1488: -- SQL Why: Need to set org context to the OU where the
1489: -- requisition line is raised
1490: SELECT nvl(org_id, -99)
1491: INTO l_line_requesting_ou_id
1492: FROM po_requisition_lines_all
1493: WHERE requisition_line_id = requisition_line_id_rslt_tbl(l_create_dist_index);
1494:
1495: IF l_line_requesting_ou_id <> l_old_line_requesting_ou_id THEN
1496: PO_MOAC_UTILS_PVT.set_org_context(l_line_requesting_ou_id) ; --