7923: BEGIN
7924:
7925: d_progress := 0;
7926:
7927: IF (PO_LOG.d_proc) THEN
7928: PO_LOG.proc_begin(d_module);
7929: PO_LOG.proc_begin(d_module, 'p_line_location_id', p_line_location_id);
7930: END IF;
7931:
7924:
7925: d_progress := 0;
7926:
7927: IF (PO_LOG.d_proc) THEN
7928: PO_LOG.proc_begin(d_module);
7929: PO_LOG.proc_begin(d_module, 'p_line_location_id', p_line_location_id);
7930: END IF;
7931:
7932: d_progress := 10;
7925: d_progress := 0;
7926:
7927: IF (PO_LOG.d_proc) THEN
7928: PO_LOG.proc_begin(d_module);
7929: PO_LOG.proc_begin(d_module, 'p_line_location_id', p_line_location_id);
7930: END IF;
7931:
7932: d_progress := 10;
7933:
7937: WHERE pod.line_location_id = p_line_location_id;
7938:
7939: d_progress := 20;
7940:
7941: IF (PO_LOG.d_stmt) THEN
7942: PO_LOG.stmt(d_module, d_progress, 'l_last_dist_id', l_last_dist_id);
7943: END IF;
7944:
7945: SELECT poll.quantity
7938:
7939: d_progress := 20;
7940:
7941: IF (PO_LOG.d_stmt) THEN
7942: PO_LOG.stmt(d_module, d_progress, 'l_last_dist_id', l_last_dist_id);
7943: END IF;
7944:
7945: SELECT poll.quantity
7946: INTO l_shipment_quantity
7954: (l_sum_dist_quantities - pod.quantity_ordered)
7955: WHERE pod.po_distribution_id = l_last_dist_id
7956: RETURNING pod.quantity_ordered INTO l_last_dist_qty;
7957:
7958: IF (PO_LOG.d_proc) THEN
7959: PO_LOG.proc_end(d_module, 'l_last_dist_qty', l_last_dist_qty);
7960: PO_LOG.proc_end(d_module);
7961: END IF;
7962:
7955: WHERE pod.po_distribution_id = l_last_dist_id
7956: RETURNING pod.quantity_ordered INTO l_last_dist_qty;
7957:
7958: IF (PO_LOG.d_proc) THEN
7959: PO_LOG.proc_end(d_module, 'l_last_dist_qty', l_last_dist_qty);
7960: PO_LOG.proc_end(d_module);
7961: END IF;
7962:
7963: EXCEPTION
7956: RETURNING pod.quantity_ordered INTO l_last_dist_qty;
7957:
7958: IF (PO_LOG.d_proc) THEN
7959: PO_LOG.proc_end(d_module, 'l_last_dist_qty', l_last_dist_qty);
7960: PO_LOG.proc_end(d_module);
7961: END IF;
7962:
7963: EXCEPTION
7964: WHEN OTHERS THEN
7961: END IF;
7962:
7963: EXCEPTION
7964: WHEN OTHERS THEN
7965: IF (PO_LOG.d_exc) THEN
7966: PO_LOG.exc(d_module, d_progress, SQLCODE||SQLERRM);
7967: END IF;
7968:
7969: RAISE;
7962:
7963: EXCEPTION
7964: WHEN OTHERS THEN
7965: IF (PO_LOG.d_exc) THEN
7966: PO_LOG.exc(d_module, d_progress, SQLCODE||SQLERRM);
7967: END IF;
7968:
7969: RAISE;
7970:
10239: --insert only takes care of the interface lines which are backed by
10240: --requisitions.
10241: if g_interface_source_code='SOURCING' then
10242:
10243: IF (PO_LOG.d_stmt) THEN
10244: PO_LOG.stmt(g_log_head || l_api_name, 190, 'Defaulting dists interface for sourcing.');
10245: END IF;
10246:
10247: l_progress:='190';
10240: --requisitions.
10241: if g_interface_source_code='SOURCING' then
10242:
10243: IF (PO_LOG.d_stmt) THEN
10244: PO_LOG.stmt(g_log_head || l_api_name, 190, 'Defaulting dists interface for sourcing.');
10245: END IF;
10246:
10247: l_progress:='190';
10248: for i in c_default_distribution
10248: for i in c_default_distribution
10249: loop
10250:
10251: --
10252: IF (PO_LOG.d_stmt) THEN
10253: PO_LOG.stmt(g_log_head || l_api_name, 190, 'i.interface_line_id', i.interface_line_id);
10254: END IF;
10255:
10256:
10249: loop
10250:
10251: --
10252: IF (PO_LOG.d_stmt) THEN
10253: PO_LOG.stmt(g_log_head || l_api_name, 190, 'i.interface_line_id', i.interface_line_id);
10254: END IF;
10255:
10256:
10257: IF (p_is_complex_work_po) THEN
10302: , i.ship_to_location_id
10303: , l_ship_to_org_id
10304: );
10305:
10306: IF (PO_LOG.d_stmt) THEN
10307: PO_LOG.stmt(g_log_head || l_api_name, 190, 'Num rows inserted', SQL%ROWCOUNT);
10308: END IF;
10309:
10310: ELSE
10303: , l_ship_to_org_id
10304: );
10305:
10306: IF (PO_LOG.d_stmt) THEN
10307: PO_LOG.stmt(g_log_head || l_api_name, 190, 'Num rows inserted', SQL%ROWCOUNT);
10308: END IF;
10309:
10310: ELSE
10311:
14384: BEGIN
14385:
14386: d_progress := 0;
14387:
14388: IF (PO_LOG.d_proc) THEN
14389: PO_LOG.proc_begin(d_module);
14390: PO_LOG.proc_begin(d_module, 'p_deliver_to_loc_id', p_deliver_to_loc_id);
14391: END IF;
14392:
14385:
14386: d_progress := 0;
14387:
14388: IF (PO_LOG.d_proc) THEN
14389: PO_LOG.proc_begin(d_module);
14390: PO_LOG.proc_begin(d_module, 'p_deliver_to_loc_id', p_deliver_to_loc_id);
14391: END IF;
14392:
14393: d_progress := 10;
14386: d_progress := 0;
14387:
14388: IF (PO_LOG.d_proc) THEN
14389: PO_LOG.proc_begin(d_module);
14390: PO_LOG.proc_begin(d_module, 'p_deliver_to_loc_id', p_deliver_to_loc_id);
14391: END IF;
14392:
14393: d_progress := 10;
14394:
14406: l_found := TRUE;
14407:
14408: EXCEPTION
14409: WHEN NO_DATA_FOUND THEN
14410: IF (PO_LOG.d_stmt) THEN
14411: PO_LOG.stmt(d_module, d_progress, 'No data found in hr_locations.');
14412: END IF;
14413: END;
14414:
14407:
14408: EXCEPTION
14409: WHEN NO_DATA_FOUND THEN
14410: IF (PO_LOG.d_stmt) THEN
14411: PO_LOG.stmt(d_module, d_progress, 'No data found in hr_locations.');
14412: END IF;
14413: END;
14414:
14415: d_progress := 20;
14426: l_found := TRUE;
14427:
14428: EXCEPTION
14429: WHEN NO_DATA_FOUND THEN
14430: IF (PO_LOG.d_stmt) THEN
14431: PO_LOG.stmt(d_module, d_progress, 'No data found in hz_locations.');
14432: END IF;
14433: END;
14434:
14427:
14428: EXCEPTION
14429: WHEN NO_DATA_FOUND THEN
14430: IF (PO_LOG.d_stmt) THEN
14431: PO_LOG.stmt(d_module, d_progress, 'No data found in hz_locations.');
14432: END IF;
14433: END;
14434:
14435: END IF; -- if not l_found
14437: IF (NOT l_found) THEN
14438: RAISE NO_DATA_FOUND;
14439: END IF;
14440:
14441: IF (PO_LOG.d_proc) THEN
14442: PO_LOG.proc_return(d_module, l_ship_to_location_id);
14443: PO_LOG.proc_end(d_module);
14444: END IF;
14445:
14438: RAISE NO_DATA_FOUND;
14439: END IF;
14440:
14441: IF (PO_LOG.d_proc) THEN
14442: PO_LOG.proc_return(d_module, l_ship_to_location_id);
14443: PO_LOG.proc_end(d_module);
14444: END IF;
14445:
14446: RETURN l_ship_to_location_id;
14439: END IF;
14440:
14441: IF (PO_LOG.d_proc) THEN
14442: PO_LOG.proc_return(d_module, l_ship_to_location_id);
14443: PO_LOG.proc_end(d_module);
14444: END IF;
14445:
14446: RETURN l_ship_to_location_id;
14447:
14446: RETURN l_ship_to_location_id;
14447:
14448: EXCEPTION
14449: WHEN OTHERS THEN
14450: IF (PO_LOG.d_exc) THEN
14451: PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
14452: END IF;
14453: wrapup(interface.interface_header_id);
14454: RAISE;
14447:
14448: EXCEPTION
14449: WHEN OTHERS THEN
14450: IF (PO_LOG.d_exc) THEN
14451: PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
14452: END IF;
14453: wrapup(interface.interface_header_id);
14454: RAISE;
14455: END;
14986:
14987: BEGIN
14988:
14989: d_progress := 0;
14990: IF (PO_LOG.d_proc) THEN
14991: PO_LOG.proc_begin(d_module);
14992: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
14993: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
14994: END IF;
14987: BEGIN
14988:
14989: d_progress := 0;
14990: IF (PO_LOG.d_proc) THEN
14991: PO_LOG.proc_begin(d_module);
14992: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
14993: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
14994: END IF;
14995:
14988:
14989: d_progress := 0;
14990: IF (PO_LOG.d_proc) THEN
14991: PO_LOG.proc_begin(d_module);
14992: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
14993: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
14994: END IF;
14995:
14996: d_progress := 10;
14989: d_progress := 0;
14990: IF (PO_LOG.d_proc) THEN
14991: PO_LOG.proc_begin(d_module);
14992: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
14993: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
14994: END IF;
14995:
14996: d_progress := 10;
14997:
15017: l_isFinancing := PO_COMPLEX_WORK_PVT.is_financing_po(
15018: p_po_header_id => l_po_header_id
15019: );
15020:
15021: IF (PO_LOG.d_stmt) THEN
15022: PO_LOG.stmt(d_module, d_progress, 'l_isFinancing', l_isFinancing);
15023: END IF;
15024:
15025: d_progress := 30;
15018: p_po_header_id => l_po_header_id
15019: );
15020:
15021: IF (PO_LOG.d_stmt) THEN
15022: PO_LOG.stmt(d_module, d_progress, 'l_isFinancing', l_isFinancing);
15023: END IF;
15024:
15025: d_progress := 30;
15026:
15135: END IF; -- if l_isFinancing
15136:
15137: d_progress := 80;
15138:
15139: IF (PO_LOG.d_stmt) THEN
15140: PO_LOG.stmt(d_module, d_progress, 'interface.has_advance_flag', interface.has_advance_flag);
15141: END IF;
15142:
15143: IF (interface.has_advance_flag = 'Y') THEN
15136:
15137: d_progress := 80;
15138:
15139: IF (PO_LOG.d_stmt) THEN
15140: PO_LOG.stmt(d_module, d_progress, 'interface.has_advance_flag', interface.has_advance_flag);
15141: END IF;
15142:
15143: IF (interface.has_advance_flag = 'Y') THEN
15144:
15288: EXIT WHEN poll_interface_cursor%NOTFOUND;
15289:
15290: d_progress := 160;
15291:
15292: IF (PO_LOG.d_stmt) THEN
15293: PO_LOG.stmt(d_module, d_progress, 'Getting receiving controls.');
15294: END IF;
15295:
15296: RCV_CORE_S.get_receiving_controls(
15289:
15290: d_progress := 160;
15291:
15292: IF (PO_LOG.d_stmt) THEN
15293: PO_LOG.stmt(d_module, d_progress, 'Getting receiving controls.');
15294: END IF;
15295:
15296: RCV_CORE_S.get_receiving_controls(
15297: p_order_type_lookup_code => line_location_rec.value_basis
15313: , x_receipt_days_exception_code => payitem_rcv_ctl_rec.receipt_days_exception_code
15314: );
15315:
15316: d_progress := 200;
15317: IF (PO_LOG.d_stmt) THEN
15318: PO_LOG.stmt(d_module, d_progress, 'Getting default country of origin');
15319: END IF;
15320:
15321: po_coo_s.get_default_country_of_origin(
15314: );
15315:
15316: d_progress := 200;
15317: IF (PO_LOG.d_stmt) THEN
15318: PO_LOG.stmt(d_module, d_progress, 'Getting default country of origin');
15319: END IF;
15320:
15321: po_coo_s.get_default_country_of_origin(
15322: x_item_id => interface.item_id
15326: , x_country_of_origin => l_country_of_origin_code
15327: );
15328:
15329: d_progress := 210;
15330: IF (PO_LOG.d_stmt) THEN
15331: PO_LOG.stmt(d_module, d_progress, 'Inserting payitem into po_line_locations_all');
15332: END IF;
15333:
15334: -- insert payitem into po_line_locations_all
15327: );
15328:
15329: d_progress := 210;
15330: IF (PO_LOG.d_stmt) THEN
15331: PO_LOG.stmt(d_module, d_progress, 'Inserting payitem into po_line_locations_all');
15332: END IF;
15333:
15334: -- insert payitem into po_line_locations_all
15335:
15517: )
15518: RETURNING line_location_id INTO l_line_loc_id;
15519:
15520: d_progress := 220;
15521: IF (PO_LOG.d_stmt) THEN
15522: PO_LOG.stmt(d_module, d_progress, 'Inserted payitem.');
15523: PO_LOG.stmt(d_module, d_progress, 'l_line_loc_id', l_line_loc_id);
15524: END IF;
15525:
15518: RETURNING line_location_id INTO l_line_loc_id;
15519:
15520: d_progress := 220;
15521: IF (PO_LOG.d_stmt) THEN
15522: PO_LOG.stmt(d_module, d_progress, 'Inserted payitem.');
15523: PO_LOG.stmt(d_module, d_progress, 'l_line_loc_id', l_line_loc_id);
15524: END IF;
15525:
15526: d_progress := 230;
15519:
15520: d_progress := 220;
15521: IF (PO_LOG.d_stmt) THEN
15522: PO_LOG.stmt(d_module, d_progress, 'Inserted payitem.');
15523: PO_LOG.stmt(d_module, d_progress, 'l_line_loc_id', l_line_loc_id);
15524: END IF;
15525:
15526: d_progress := 230;
15527:
15553:
15554: d_progress := 300;
15555:
15556: -- call create_payitem_dists to create distributions for all new payitems
15557: IF (PO_LOG.d_stmt) THEN
15558: PO_LOG.stmt(d_module, d_progress, 'Ready to call create_payitem_dists');
15559: END IF;
15560:
15561: create_payitem_dists(
15554: d_progress := 300;
15555:
15556: -- call create_payitem_dists to create distributions for all new payitems
15557: IF (PO_LOG.d_stmt) THEN
15558: PO_LOG.stmt(d_module, d_progress, 'Ready to call create_payitem_dists');
15559: END IF;
15560:
15561: create_payitem_dists(
15562: p_po_line_id => p_po_line_id
15567: );
15568:
15569: d_progress := 310;
15570:
15571: IF (PO_LOG.d_stmt) THEN
15572: PO_LOG.stmt(d_module, d_progress, 'Done calling create_payitem dists');
15573: END IF;
15574:
15575: d_progress := 400;
15568:
15569: d_progress := 310;
15570:
15571: IF (PO_LOG.d_stmt) THEN
15572: PO_LOG.stmt(d_module, d_progress, 'Done calling create_payitem dists');
15573: END IF;
15574:
15575: d_progress := 400;
15576:
15573: END IF;
15574:
15575: d_progress := 400;
15576:
15577: IF (PO_LOG.d_stmt) THEN
15578: PO_LOG.stmt(d_module, d_progress, 'calling tax api ');
15579: END IF;
15580:
15581: d_progress := 1420;
15574:
15575: d_progress := 400;
15576:
15577: IF (PO_LOG.d_stmt) THEN
15578: PO_LOG.stmt(d_module, d_progress, 'calling tax api ');
15579: END IF;
15580:
15581: d_progress := 1420;
15582:
15579: END IF;
15580:
15581: d_progress := 1420;
15582:
15583: IF (PO_LOG.d_proc) THEN
15584: PO_LOG.proc_end(d_module, 'x_line_location_id', x_line_location_id);
15585: PO_LOG.proc_end(d_module, 'x_line_loc_id_tbl', x_line_loc_id_tbl);
15586: PO_LOG.proc_end(d_module);
15587: END IF;
15580:
15581: d_progress := 1420;
15582:
15583: IF (PO_LOG.d_proc) THEN
15584: PO_LOG.proc_end(d_module, 'x_line_location_id', x_line_location_id);
15585: PO_LOG.proc_end(d_module, 'x_line_loc_id_tbl', x_line_loc_id_tbl);
15586: PO_LOG.proc_end(d_module);
15587: END IF;
15588:
15581: d_progress := 1420;
15582:
15583: IF (PO_LOG.d_proc) THEN
15584: PO_LOG.proc_end(d_module, 'x_line_location_id', x_line_location_id);
15585: PO_LOG.proc_end(d_module, 'x_line_loc_id_tbl', x_line_loc_id_tbl);
15586: PO_LOG.proc_end(d_module);
15587: END IF;
15588:
15589: EXCEPTION
15582:
15583: IF (PO_LOG.d_proc) THEN
15584: PO_LOG.proc_end(d_module, 'x_line_location_id', x_line_location_id);
15585: PO_LOG.proc_end(d_module, 'x_line_loc_id_tbl', x_line_loc_id_tbl);
15586: PO_LOG.proc_end(d_module);
15587: END IF;
15588:
15589: EXCEPTION
15590: WHEN OTHERS THEN
15588:
15589: EXCEPTION
15590: WHEN OTHERS THEN
15591:
15592: IF (PO_LOG.d_exc) THEN
15593: PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
15594: END IF;
15595:
15596: IF (poll_interface_cursor%ISOPEN) THEN
15589: EXCEPTION
15590: WHEN OTHERS THEN
15591:
15592: IF (PO_LOG.d_exc) THEN
15593: PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
15594: END IF;
15595:
15596: IF (poll_interface_cursor%ISOPEN) THEN
15597: CLOSE poll_interface_cursor;
15719:
15720: BEGIN
15721:
15722: d_progress := 0;
15723: IF (PO_LOG.d_proc) THEN
15724: PO_LOG.proc_begin(d_module);
15725: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
15726: PO_LOG.proc_begin(d_module, 'p_req_line_id', p_req_line_id);
15727: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
15720: BEGIN
15721:
15722: d_progress := 0;
15723: IF (PO_LOG.d_proc) THEN
15724: PO_LOG.proc_begin(d_module);
15725: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
15726: PO_LOG.proc_begin(d_module, 'p_req_line_id', p_req_line_id);
15727: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
15728: END IF;
15721:
15722: d_progress := 0;
15723: IF (PO_LOG.d_proc) THEN
15724: PO_LOG.proc_begin(d_module);
15725: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
15726: PO_LOG.proc_begin(d_module, 'p_req_line_id', p_req_line_id);
15727: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
15728: END IF;
15729:
15722: d_progress := 0;
15723: IF (PO_LOG.d_proc) THEN
15724: PO_LOG.proc_begin(d_module);
15725: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
15726: PO_LOG.proc_begin(d_module, 'p_req_line_id', p_req_line_id);
15727: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
15728: END IF;
15729:
15730: d_progress := 10;
15723: IF (PO_LOG.d_proc) THEN
15724: PO_LOG.proc_begin(d_module);
15725: PO_LOG.proc_begin(d_module, 'p_po_line_id', p_po_line_id);
15726: PO_LOG.proc_begin(d_module, 'p_req_line_id', p_req_line_id);
15727: PO_LOG.proc_begin(d_module, 'p_interface_line_id', p_interface_line_id);
15728: END IF;
15729:
15730: d_progress := 10;
15731:
15761: );
15762:
15763: IF (params.period_name IS NULL) THEN
15764: d_progress := 50;
15765: IF (PO_LOG.d_exc) THEN
15766: PO_LOG.exc(d_module, d_progress, 'Unable to find period name for SYSDATE');
15767: END IF;
15768: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
15769: END IF;
15762:
15763: IF (params.period_name IS NULL) THEN
15764: d_progress := 50;
15765: IF (PO_LOG.d_exc) THEN
15766: PO_LOG.exc(d_module, d_progress, 'Unable to find period name for SYSDATE');
15767: END IF;
15768: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
15769: END IF;
15770:
15909: AND prl.requisition_line_id = prd.requisition_line_id
15910: AND poll.payment_type <> 'ADVANCE';
15911:
15912: d_progress := 70;
15913: IF (PO_LOG.d_stmt) THEN
15914: PO_LOG.stmt(d_module, d_progress, 'Payitems distributions created from requisition distributions.');
15915: END IF;
15916:
15917: ELSE
15910: AND poll.payment_type <> 'ADVANCE';
15911:
15912: d_progress := 70;
15913: IF (PO_LOG.d_stmt) THEN
15914: PO_LOG.stmt(d_module, d_progress, 'Payitems distributions created from requisition distributions.');
15915: END IF;
15916:
15917: ELSE
15918:
15935: );
15936:
15937: IF (params.period_name IS NULL) THEN
15938: d_progress := 100;
15939: IF (PO_LOG.d_exc) THEN
15940: PO_LOG.exc(d_module, d_progress, 'Unable to find period name for SYSDATE');
15941: END IF;
15942: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
15943: END IF;
15936:
15937: IF (params.period_name IS NULL) THEN
15938: d_progress := 100;
15939: IF (PO_LOG.d_exc) THEN
15940: PO_LOG.exc(d_module, d_progress, 'Unable to find period name for SYSDATE');
15941: END IF;
15942: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
15943: END IF;
15944:
16038: AND poll.line_location_id = polli.line_location_id
16039: AND poll.payment_type <> 'ADVANCE';
16040:
16041: d_progress := 120;
16042: IF (PO_LOG.d_stmt) THEN
16043: PO_LOG.stmt(d_module, d_progress, 'Payitems distributions created from scratch.');
16044: END IF;
16045:
16046: END IF; -- if p_req_line_id IS NOT NULL
16039: AND poll.payment_type <> 'ADVANCE';
16040:
16041: d_progress := 120;
16042: IF (PO_LOG.d_stmt) THEN
16043: PO_LOG.stmt(d_module, d_progress, 'Payitems distributions created from scratch.');
16044: END IF;
16045:
16046: END IF; -- if p_req_line_id IS NOT NULL
16047:
16159: AND poll2.shipment_type = 'STANDARD'))
16160: AND pod.line_location_id = deliv.line_location_id;
16161:
16162: d_progress := 150;
16163: IF (PO_LOG.d_stmt) THEN
16164: PO_LOG.stmt(d_module, d_progress, 'Advance distributions created.');
16165: END IF;
16166:
16167: END IF; -- if interface.has_advance_flag
16160: AND pod.line_location_id = deliv.line_location_id;
16161:
16162: d_progress := 150;
16163: IF (PO_LOG.d_stmt) THEN
16164: PO_LOG.stmt(d_module, d_progress, 'Advance distributions created.');
16165: END IF;
16166:
16167: END IF; -- if interface.has_advance_flag
16168:
16197: FETCH payitem_acct_gen_cursor INTO payitem_acct_rec;
16198: EXIT WHEN payitem_acct_gen_cursor%NOTFOUND;
16199:
16200: d_progress := 180;
16201: IF (PO_LOG.d_stmt) THEN
16202: PO_LOG.stmt(d_module, d_progress, 'Calling account generator wf method.');
16203: PO_LOG.stmt(d_module, d_progress, 'payitem_acct_rec.po_distribution_id', payitem_acct_rec.po_distribution_id);
16204: END IF;
16205:
16198: EXIT WHEN payitem_acct_gen_cursor%NOTFOUND;
16199:
16200: d_progress := 180;
16201: IF (PO_LOG.d_stmt) THEN
16202: PO_LOG.stmt(d_module, d_progress, 'Calling account generator wf method.');
16203: PO_LOG.stmt(d_module, d_progress, 'payitem_acct_rec.po_distribution_id', payitem_acct_rec.po_distribution_id);
16204: END IF;
16205:
16206: l_acct_api_success := PO_WF_BUILD_ACCOUNT_INIT.Start_Workflow(
16199:
16200: d_progress := 180;
16201: IF (PO_LOG.d_stmt) THEN
16202: PO_LOG.stmt(d_module, d_progress, 'Calling account generator wf method.');
16203: PO_LOG.stmt(d_module, d_progress, 'payitem_acct_rec.po_distribution_id', payitem_acct_rec.po_distribution_id);
16204: END IF;
16205:
16206: l_acct_api_success := PO_WF_BUILD_ACCOUNT_INIT.Start_Workflow(
16207: x_purchasing_ou_id => g_purchasing_ou_id
16333: , p_payment_type => payitem_acct_rec.payment_type
16334: );
16335:
16336: d_progress := 190;
16337: IF (PO_LOG.d_stmt) THEN
16338: PO_LOG.stmt(d_module, d_progress, 'Finished account generator call.');
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16334: );
16335:
16336: d_progress := 190;
16337: IF (PO_LOG.d_stmt) THEN
16338: PO_LOG.stmt(d_module, d_progress, 'Finished account generator call.');
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16342: PO_LOG.stmt(d_module, d_progress, 'l_budget_success', l_budget_success);
16335:
16336: d_progress := 190;
16337: IF (PO_LOG.d_stmt) THEN
16338: PO_LOG.stmt(d_module, d_progress, 'Finished account generator call.');
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16342: PO_LOG.stmt(d_module, d_progress, 'l_budget_success', l_budget_success);
16343: PO_LOG.stmt(d_module, d_progress, 'l_accrual_success', l_accrual_success);
16336: d_progress := 190;
16337: IF (PO_LOG.d_stmt) THEN
16338: PO_LOG.stmt(d_module, d_progress, 'Finished account generator call.');
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16342: PO_LOG.stmt(d_module, d_progress, 'l_budget_success', l_budget_success);
16343: PO_LOG.stmt(d_module, d_progress, 'l_accrual_success', l_accrual_success);
16344: END IF;
16337: IF (PO_LOG.d_stmt) THEN
16338: PO_LOG.stmt(d_module, d_progress, 'Finished account generator call.');
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16342: PO_LOG.stmt(d_module, d_progress, 'l_budget_success', l_budget_success);
16343: PO_LOG.stmt(d_module, d_progress, 'l_accrual_success', l_accrual_success);
16344: END IF;
16345:
16338: PO_LOG.stmt(d_module, d_progress, 'Finished account generator call.');
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16342: PO_LOG.stmt(d_module, d_progress, 'l_budget_success', l_budget_success);
16343: PO_LOG.stmt(d_module, d_progress, 'l_accrual_success', l_accrual_success);
16344: END IF;
16345:
16346: -- follow same behavior as with shipment distributions:
16339: PO_LOG.stmt(d_module, d_progress, 'l_acct_api_success', l_acct_api_success);
16340: PO_LOG.stmt(d_module, d_progress, 'l_charge_success', l_charge_success);
16341: PO_LOG.stmt(d_module, d_progress, 'l_variance_success', l_variance_success);
16342: PO_LOG.stmt(d_module, d_progress, 'l_budget_success', l_budget_success);
16343: PO_LOG.stmt(d_module, d_progress, 'l_accrual_success', l_accrual_success);
16344: END IF;
16345:
16346: -- follow same behavior as with shipment distributions:
16347: -- if account generator failed, do not create distribution
16356: AND (l_budget_success OR (NVL(params.po_encumbrance_flag, 'N') <> 'Y')))
16357: THEN
16358:
16359: d_progress := 210;
16360: IF (PO_LOG.d_stmt) THEN
16361: PO_LOG.stmt(d_module, d_progress, 'Updating dist. with acct. info');
16362: END IF;
16363:
16364: --SQL WHAT: Update account information for a po distribution
16357: THEN
16358:
16359: d_progress := 210;
16360: IF (PO_LOG.d_stmt) THEN
16361: PO_LOG.stmt(d_module, d_progress, 'Updating dist. with acct. info');
16362: END IF;
16363:
16364: --SQL WHAT: Update account information for a po distribution
16365: --SQL WHY : PO Distributions that don't have a backing req need to
16376:
16377: ELSE
16378:
16379: d_progress := 220;
16380: IF (PO_LOG.d_stmt) THEN
16381: PO_LOG.stmt(d_module, d_progress, 'Deleting distribution - acct. gen failure');
16382: END IF;
16383:
16384: DELETE FROM po_distributions_all pod
16377: ELSE
16378:
16379: d_progress := 220;
16380: IF (PO_LOG.d_stmt) THEN
16381: PO_LOG.stmt(d_module, d_progress, 'Deleting distribution - acct. gen failure');
16382: END IF;
16383:
16384: DELETE FROM po_distributions_all pod
16385: WHERE pod.po_distribution_id =
16390: END LOOP; -- payitem_acct_gen_cursor loop
16391: CLOSE payitem_acct_gen_cursor;
16392:
16393: d_progress := 300;
16394: IF (PO_LOG.d_stmt) THEN
16395: PO_LOG.stmt(d_module, d_progress, 'Calling update_award_distributions');
16396: END IF;
16397:
16398: update_award_distributions(
16391: CLOSE payitem_acct_gen_cursor;
16392:
16393: d_progress := 300;
16394: IF (PO_LOG.d_stmt) THEN
16395: PO_LOG.stmt(d_module, d_progress, 'Calling update_award_distributions');
16396: END IF;
16397:
16398: update_award_distributions(
16399: p_table_type => 'ALL'
16413: LOOP
16414: calculate_local('PO', 'DISTRIBUTION', l_dist_id_tbl(i));
16415: END LOOP;
16416:
16417: IF (PO_LOG.d_proc) THEN
16418: PO_LOG.proc_end(d_module);
16419: END IF;
16420:
16421: EXCEPTION
16414: calculate_local('PO', 'DISTRIBUTION', l_dist_id_tbl(i));
16415: END LOOP;
16416:
16417: IF (PO_LOG.d_proc) THEN
16418: PO_LOG.proc_end(d_module);
16419: END IF;
16420:
16421: EXCEPTION
16422: WHEN OTHERS THEN
16419: END IF;
16420:
16421: EXCEPTION
16422: WHEN OTHERS THEN
16423: IF (PO_LOG.d_exc) THEN
16424: PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
16425: END IF;
16426:
16427: IF (payitem_acct_gen_cursor%ISOPEN) THEN
16420:
16421: EXCEPTION
16422: WHEN OTHERS THEN
16423: IF (PO_LOG.d_exc) THEN
16424: PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
16425: END IF;
16426:
16427: IF (payitem_acct_gen_cursor%ISOPEN) THEN
16428: CLOSE payitem_acct_gen_cursor;