206: p_po_release_id => x_po_release_id,
207: p_calling_program =>'PORELGEB');
208: l_progress := '042';
209:
210: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
211: IF (g_debug_stmt) THEN
212: PO_DEBUG.debug_stmt (
213: p_log_head => c_log_head||l_api_name,
214: p_token => '',
226:
227: IF (x_authorization_status = 'APPROVED') THEN
228:
229: --
230: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
231: --
232: -- ECO Bug 4643026
233: -- Update Release with status INCOMPLETE
234: -- as the tax calculation has failed
297: p_recreate_demand_flag => 'N',
298: p_called_from_reqimport => 'N',
299: x_return_status => l_return_status
300: );
301: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
302: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
303: END IF;
304: -- Bug 3570793 END
305:
298: p_called_from_reqimport => 'N',
299: x_return_status => l_return_status
300: );
301: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
302: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
303: END IF;
304: -- Bug 3570793 END
305:
306: l_progress := '070';
330: preapproval_checks(x_old_po_header_id,
331: x_req_num,x_req_line_num,
332: l_check_status);
333:
334: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
335: -- Rollback the creation of the release.
336: ROLLBACK TO PORELGEN_1;
337: -- Bug 3570793 START
338: IF (g_debug_stmt) THEN
346: -- Bug 3570793 END
347: --
348: -- Assigning check status as unexpected error to make sure that if the release
349: -- fails in LCM submission checks then we should create the release with incomplete status.
350: ELSIF (l_check_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
351:
352: --
354: UPDATE po_releases_all por
480: p_po_header_id => NULL,
481: p_po_release_id => x_po_release_id,
482: p_calling_program =>'PORELGEB');
483: l_progress := '042';
484: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
485: IF (g_debug_stmt) THEN
486: PO_DEBUG.debug_stmt (
487: p_log_head => c_log_head||l_api_name,
488: p_token => '',
500:
501: IF(x_authorization_status = 'APPROVED') THEN
502: l_progress := '200';
503: --
504: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
505: -- sjadhav,
506: -- ECO Bug 4643026
507: -- Update Release with status INCOMPLETE
508: -- as the tax calculation has failed
560: p_recreate_demand_flag => 'N',
561: p_called_from_reqimport => 'N',
562: x_return_status => l_return_status
563: );
564: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
565: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
566: END IF;
567: -- Bug 3570793 END
568:
561: p_called_from_reqimport => 'N',
562: x_return_status => l_return_status
563: );
564: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
565: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
566: END IF;
567: -- Bug 3570793 END
568:
569: l_progress := '220';
587: -- its creation.
588: preapproval_checks(x_old_po_header_id,x_req_num,x_req_line_num,
589: l_check_status);
590:
591: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
592: -- Rollback the creation of the release.
593: ROLLBACK TO PORELGEN_1;
594: -- Bug 3570793 START
595: IF (g_debug_stmt) THEN
603: -- Bug 3570793 END
604: --
605: -- Assigning check status as unexpected error to make sure that if the release
606: -- fails in LCM submission checks then we should create the release with incomplete status.
607: ELSIF (l_check_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
608:
609: --
611: UPDATE po_releases_all por
659: return;
660:
661: EXCEPTION
662: -- Bug 3570793 START
663: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
664: -- Write the errors on the message list to the concurrent program log.
665: PO_DEBUG.write_msg_list_to_file (
666: p_log_head => c_log_head || l_api_name,
667: p_progress => l_progress
882:
883: BEGIN
884:
885: --
886: l_return_status := FND_API.G_RET_STS_SUCCESS;
887: IF (g_fnd_debug = 'Y') THEN
888: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
889: FND_LOG.string (
890: LOG_LEVEL => FND_LOG.LEVEL_STATEMENT,
2253: max_release_amount number :=0;
2254: x_error_msg varchar2(2000);
2255: x_po_num varchar2(20);
2256: BEGIN
2257: x_check_status := FND_API.G_RET_STS_SUCCESS; -- Bug 2701147
2258:
2259: SELECT nvl(sum(poll.quantity * poll.price_override),0)
2260: INTO release_amount
2261: FROM po_line_locations poll
2295: FND_FILE.put_line(FND_FILE.LOG,
2296: substr(g_reqmsg||g_delim||x_req_num||g_delim||g_linemsg||g_delim||
2297: x_req_line_num||g_delim||
2298: x_error_msg,1,240));
2299: x_check_status := FND_API.G_RET_STS_ERROR;
2300: -- Bug 2701147 END
2301: END IF;
2302:
2303: IF (max_release_amount <> -1 AND total_release_amount > max_release_amount)
2310: fnd_message.set_token('LINE_NUM', x_req_line_num);
2311: fnd_message.set_token('PO_NUM',x_po_num);
2312: x_error_msg := fnd_message.get;
2313: fnd_file.put_line(fnd_file.log,x_error_msg);
2314: x_check_status := FND_API.G_RET_STS_ERROR; -- Bug 2701147
2315: END IF;
2316:
2317: EXCEPTION
2318: WHEN OTHERS THEN
2438: * Modifies: Inserts error msgs in the concurrent program log.
2439: * Effects: This procedure checks that the release shipment price is
2440: * within the tolerance of the requisition line.
2441: * Returns:
2442: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2443: * the tolerance checks
2444: * FND_API.G_RET_STS_ERROR if at least one check fails
2445: */
2446: PROCEDURE check_rel_reqprice(x_check_status OUT NOCOPY VARCHAR2) IS
2440: * within the tolerance of the requisition line.
2441: * Returns:
2442: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2443: * the tolerance checks
2444: * FND_API.G_RET_STS_ERROR if at least one check fails
2445: */
2446: PROCEDURE check_rel_reqprice(x_check_status OUT NOCOPY VARCHAR2) IS
2447:
2448: l_textline po_online_report_text.text_line%TYPE := NULL;
2547: AND PRD.requisition_line_id = PRL.requisition_line_id
2548: GROUP BY PRL.requisition_line_id, PRL.unit_meas_lookup_code;
2549:
2550: BEGIN
2551: x_check_status := FND_API.G_RET_STS_SUCCESS;
2552:
2553: l_progress := '000';
2554: IF g_fnd_debug = 'Y' THEN
2555: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
2719: substr(g_reqmsg||g_delim||
2720: l_req_num||g_delim||g_linemsg||g_delim||
2721: l_req_line_num||g_delim||
2722: l_textline,1,240));
2723: x_check_status := FND_API.G_RET_STS_ERROR;
2724:
2725: END IF; --check for tolerance
2726:
2727: END IF; --check l_price_tolerance_allowed
2801: substr(g_reqmsg||g_delim||
2802: l_req_num||g_delim||g_linemsg||g_delim||
2803: l_req_line_num||g_delim||
2804: l_textline,1,240));
2805: x_check_status := FND_API.G_RET_STS_ERROR;
2806:
2807: END IF; --amount check
2808:
2809: END IF; --check l_amount_tolerance_allowed
2832: * Modifies: Writes error messages to the concurrent program log.
2833: * Effects: Performs checks that must be successful for an approved release
2834: * to be created.
2835: * Returns:
2836: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2837: * pre-approval checks
2838: * FND_API.G_RET_STS_ERROR if at least one check fails
2839: **/
2840: PROCEDURE preapproval_checks( p_po_header_id IN NUMBER,
2834: * to be created.
2835: * Returns:
2836: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2837: * pre-approval checks
2838: * FND_API.G_RET_STS_ERROR if at least one check fails
2839: **/
2840: PROCEDURE preapproval_checks( p_po_header_id IN NUMBER,
2841: p_req_num IN VARCHAR2,
2842: p_req_line_num IN NUMBER,
2871: l_sob_id FINANCIALS_SYSTEM_PARAMS_ALL.set_of_books_id%TYPE;
2872: l_purch_enc_flag FINANCIALS_SYSTEM_PARAMS_ALL.purch_encumbrance_flag%TYPE;
2873: BEGIN
2874:
2875: x_check_status := FND_API.G_RET_STS_SUCCESS;
2876: --
2877: l_federal_instance := PO_CORE_S.Check_Federal_Instance(
2878: PO_MOAC_UTILS_PVT.Get_Current_Org_Id);
2879: --
2885: END IF;
2886:
2887: -- First check the document level amount limits.
2888: check_amount_limits(p_po_header_id, p_req_num, p_req_line_num,l_check_status);
2889: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
2890: x_check_status := FND_API.G_RET_STS_ERROR;
2891: END IF;
2892:
2893: -- The following checks were adapted from the Document Submission
2886:
2887: -- First check the document level amount limits.
2888: check_amount_limits(p_po_header_id, p_req_num, p_req_line_num,l_check_status);
2889: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
2890: x_check_status := FND_API.G_RET_STS_ERROR;
2891: END IF;
2892:
2893: -- The following checks were adapted from the Document Submission
2894: -- Checks API (PO_DOCUMENT_CHECKS_PVT.check_releases):
2932: FOR i IN 1..l_error_messages.COUNT LOOP
2933: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
2934: END LOOP;
2935: IF l_error_messages.COUNT > 0 THEN
2936: x_check_status := FND_API.G_RET_STS_ERROR;
2937: END IF;
2938:
2939: ----------------------------------------------
2940:
2998: g_linemsg||g_delim||l_req_line_num||g_delim||
2999: l_error_messages(i));
3000: END LOOP;
3001: IF l_error_messages.COUNT > 0 THEN
3002: x_check_status := FND_API.G_RET_STS_ERROR;
3003: END IF;
3004:
3005: END IF; -- l_purch_enc_flag check
3006:
3049: l_error_messages(i));
3050: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3051: END LOOP;
3052: IF l_error_messages.COUNT > 0 THEN
3053: x_check_status := FND_API.G_RET_STS_ERROR;
3054: END IF;
3055:
3056: --------------------------------------------------
3057:
3121: FOR i IN 1..l_error_messages.COUNT LOOP
3122: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3123: END LOOP;
3124: IF l_error_messages.COUNT > 0 THEN
3125: x_check_status := FND_API.G_RET_STS_ERROR;
3126: END IF;
3127:
3128: ---------------------------------------------
3129:
3190: FOR i IN 1..l_error_messages.COUNT LOOP
3191: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3192: END LOOP;
3193: IF l_error_messages.COUNT > 0 THEN
3194: x_check_status := FND_API.G_RET_STS_ERROR;
3195: END IF;
3196:
3197: ---------------------------------------------------------
3198:
3198:
3199: -- Check that the release shipment price is within the tolerance
3200: -- of the requisition line.
3201: check_rel_reqprice(l_check_status);
3202: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
3203: x_check_status := FND_API.G_RET_STS_ERROR;
3204: END IF;
3205:
3206: ----------------------------------------------------------
3199: -- Check that the release shipment price is within the tolerance
3200: -- of the requisition line.
3201: check_rel_reqprice(l_check_status);
3202: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
3203: x_check_status := FND_API.G_RET_STS_ERROR;
3204: END IF;
3205:
3206: ----------------------------------------------------------
3207: --
3226: FROM po_headers_all
3227: WHERE po_header_id = p_po_header_id;
3228: EXCEPTION
3229: WHEN OTHERS THEN
3230: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3231: END;
3232:
3233: -- Call PO_FV_INTEGRATION_PVT.val_vendor_site_ccr_regis to check the
3234: -- Central Contractor Registration (CCR) status of the vendor site
3241: l_textline := FND_MESSAGE.get_string('PO', 'PO_VENDOR_SITE_CCR_INVALID');
3242: FND_FILE.put_line(FND_FILE.LOG, substr(g_reqmsg||g_delim
3243: ||p_req_num||g_delim||g_linemsg||g_delim
3244: ||p_req_line_num||g_delim||l_textline,1,240));
3245: x_check_status := FND_API.G_RET_STS_ERROR;
3246: END IF; -- l_valid_registration check
3247: END IF; -- l_vendor_id and l_vendor_site_id check
3248: END IF; -- l_federal_instance check
3249: --
3270: FOR i IN 1..l_error_messages.COUNT LOOP
3271: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3272: END LOOP;
3273: IF l_error_messages.COUNT > 0 THEN
3274: x_check_status := FND_API.G_RET_STS_UNEXP_ERROR;
3275: END IF;
3276:
3277: l_progress := '019';
3278: IF g_fnd_debug = 'Y' THEN
3299: FOR i IN 1..l_error_messages.COUNT LOOP
3300: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3301: END LOOP;
3302: IF l_error_messages.COUNT > 0 THEN
3303: x_check_status := FND_API.G_RET_STS_UNEXP_ERROR;
3304: END IF;
3305:
3306: EXCEPTION
3307:
3351:
3352: l_progress VARCHAR2(3) := '001';
3353:
3354: BEGIN
3355: l_return_status := FND_API.G_RET_STS_SUCCESS;
3356:
3357: IF (g_fnd_debug = 'Y') THEN
3358: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
3359: FND_LOG.string (
3377: p_line_id => NULL,
3378: p_line_location_id => NULL
3379: );
3380:
3381: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3382: RAISE FND_API.G_EXC_ERROR;
3383: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3384: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3385: ELSE
3378: p_line_location_id => NULL
3379: );
3380:
3381: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3382: RAISE FND_API.G_EXC_ERROR;
3383: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3384: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3385: ELSE
3386: NULL;
3379: );
3380:
3381: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3382: RAISE FND_API.G_EXC_ERROR;
3383: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3384: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3385: ELSE
3386: NULL;
3387: END IF;
3380:
3381: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3382: RAISE FND_API.G_EXC_ERROR;
3383: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3384: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3385: ELSE
3386: NULL;
3387: END IF;
3388:
3386: NULL;
3387: END IF;
3388:
3389: EXCEPTION
3390: WHEN FND_API.G_EXC_ERROR THEN
3391: ROLLBACK TO PORELGEN_1;
3392: -- Bug 3570793 Write the message list to the concurrent program log.
3393: PO_DEBUG.write_msg_list_to_file (
3394: p_log_head => c_log_head || l_api_name,
3394: p_log_head => c_log_head || l_api_name,
3395: p_progress => l_progress
3396: );
3397:
3398: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3399: ROLLBACK TO PORELGEN_1;
3400: -- Bug 3570793 Write the message list to the concurrent program log.
3401: PO_DEBUG.write_msg_list_to_file (
3402: p_log_head => c_log_head || l_api_name,
3505: x_msg_data => l_msg_data,
3506: p_caller => 'CREATE_RELEASE',
3507: x_po_gms_interface_obj => l_gms_po_interface_obj);
3508:
3509: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3510: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3511: END IF;
3512:
3513: l_progress := '003';
3506: p_caller => 'CREATE_RELEASE',
3507: x_po_gms_interface_obj => l_gms_po_interface_obj);
3508:
3509: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3510: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3511: END IF;
3512:
3513: l_progress := '003';
3514:
3520: WHERE po_distribution_id = l_gms_po_interface_obj.distribution_id(i);
3521:
3522: EXCEPTION
3523:
3524: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3525:
3526: -- Bug 3570793 Write the message list to the concurrent program log.
3527: PO_DEBUG.write_msg_list_to_file (
3528: p_log_head => c_log_head || l_api_name,