207: p_po_release_id => x_po_release_id,
208: p_calling_program =>'PORELGEB');
209: l_progress := '042';
210:
211: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
212: IF (g_debug_stmt) THEN
213: PO_DEBUG.debug_stmt (
214: p_log_head => c_log_head||l_api_name,
215: p_token => '',
227:
228: IF (x_authorization_status = 'APPROVED') THEN
229:
230: --
231: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
232: --
233: -- ECO Bug 4643026
234: -- Update Release with status INCOMPLETE
235: -- as the tax calculation has failed
298: p_recreate_demand_flag => 'N',
299: p_called_from_reqimport => 'N',
300: x_return_status => l_return_status
301: );
302: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
303: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
304: END IF;
305: -- Bug 3570793 END
306:
299: p_called_from_reqimport => 'N',
300: x_return_status => l_return_status
301: );
302: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
303: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
304: END IF;
305: -- Bug 3570793 END
306:
307: l_progress := '070';
331: preapproval_checks(x_old_po_header_id,
332: x_req_num,x_req_line_num,
333: l_check_status);
334:
335: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
336: -- Rollback the creation of the release.
337: ROLLBACK TO PORELGEN_1;
338: -- Bug 3570793 START
339: IF (g_debug_stmt) THEN
347: -- Bug 3570793 END
348: --
349: -- Assigning check status as unexpected error to make sure that if the release
350: -- fails in LCM submission checks then we should create the release with incomplete status.
351: ELSIF (l_check_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
352:
353: --
355: UPDATE po_releases_all por
481: p_po_header_id => NULL,
482: p_po_release_id => x_po_release_id,
483: p_calling_program =>'PORELGEB');
484: l_progress := '042';
485: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
486: IF (g_debug_stmt) THEN
487: PO_DEBUG.debug_stmt (
488: p_log_head => c_log_head||l_api_name,
489: p_token => '',
501:
502: IF(x_authorization_status = 'APPROVED') THEN
503: l_progress := '200';
504: --
505: IF l_tax_return_status <> FND_API.G_RET_STS_SUCCESS THEN
506: -- sjadhav,
507: -- ECO Bug 4643026
508: -- Update Release with status INCOMPLETE
509: -- as the tax calculation has failed
561: p_recreate_demand_flag => 'N',
562: p_called_from_reqimport => 'N',
563: x_return_status => l_return_status
564: );
565: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
566: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
567: END IF;
568: -- Bug 3570793 END
569:
562: p_called_from_reqimport => 'N',
563: x_return_status => l_return_status
564: );
565: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
566: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
567: END IF;
568: -- Bug 3570793 END
569:
570: l_progress := '220';
588: -- its creation.
589: preapproval_checks(x_old_po_header_id,x_req_num,x_req_line_num,
590: l_check_status);
591:
592: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
593: -- Rollback the creation of the release.
594: ROLLBACK TO PORELGEN_1;
595: -- Bug 3570793 START
596: IF (g_debug_stmt) THEN
604: -- Bug 3570793 END
605: --
606: -- Assigning check status as unexpected error to make sure that if the release
607: -- fails in LCM submission checks then we should create the release with incomplete status.
608: ELSIF (l_check_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
609:
610: --
612: UPDATE po_releases_all por
660: return;
661:
662: EXCEPTION
663: -- Bug 3570793 START
664: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
665: -- Write the errors on the message list to the concurrent program log.
666: PO_DEBUG.write_msg_list_to_file (
667: p_log_head => c_log_head || l_api_name,
668: p_progress => l_progress
888:
889: BEGIN
890:
891: --
892: l_return_status := FND_API.G_RET_STS_SUCCESS;
893: IF (g_fnd_debug = 'Y') THEN
894: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
895: FND_LOG.string (
896: LOG_LEVEL => FND_LOG.LEVEL_STATEMENT,
2278: max_release_amount number :=0;
2279: x_error_msg varchar2(2000);
2280: x_po_num varchar2(20);
2281: BEGIN
2282: x_check_status := FND_API.G_RET_STS_SUCCESS; -- Bug 2701147
2283:
2284: SELECT nvl(sum(poll.quantity * poll.price_override),0)
2285: INTO release_amount
2286: FROM po_line_locations poll
2320: FND_FILE.put_line(FND_FILE.LOG,
2321: substr(g_reqmsg||g_delim||x_req_num||g_delim||g_linemsg||g_delim||
2322: x_req_line_num||g_delim||
2323: x_error_msg,1,240));
2324: x_check_status := FND_API.G_RET_STS_ERROR;
2325: -- Bug 2701147 END
2326: END IF;
2327:
2328: IF (max_release_amount <> -1 AND total_release_amount > max_release_amount)
2335: fnd_message.set_token('LINE_NUM', x_req_line_num);
2336: fnd_message.set_token('PO_NUM',x_po_num);
2337: x_error_msg := fnd_message.get;
2338: fnd_file.put_line(fnd_file.log,x_error_msg);
2339: x_check_status := FND_API.G_RET_STS_ERROR; -- Bug 2701147
2340: END IF;
2341:
2342: EXCEPTION
2343: WHEN OTHERS THEN
2463: * Modifies: Inserts error msgs in the concurrent program log.
2464: * Effects: This procedure checks that the release shipment price is
2465: * within the tolerance of the requisition line.
2466: * Returns:
2467: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2468: * the tolerance checks
2469: * FND_API.G_RET_STS_ERROR if at least one check fails
2470: */
2471: PROCEDURE check_rel_reqprice(x_check_status OUT NOCOPY VARCHAR2) IS
2465: * within the tolerance of the requisition line.
2466: * Returns:
2467: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2468: * the tolerance checks
2469: * FND_API.G_RET_STS_ERROR if at least one check fails
2470: */
2471: PROCEDURE check_rel_reqprice(x_check_status OUT NOCOPY VARCHAR2) IS
2472:
2473: l_textline po_online_report_text.text_line%TYPE := NULL;
2572: AND PRD.requisition_line_id = PRL.requisition_line_id
2573: GROUP BY PRL.requisition_line_id, PRL.unit_meas_lookup_code;
2574:
2575: BEGIN
2576: x_check_status := FND_API.G_RET_STS_SUCCESS;
2577:
2578: l_progress := '000';
2579: IF g_fnd_debug = 'Y' THEN
2580: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
2744: substr(g_reqmsg||g_delim||
2745: l_req_num||g_delim||g_linemsg||g_delim||
2746: l_req_line_num||g_delim||
2747: l_textline,1,240));
2748: x_check_status := FND_API.G_RET_STS_ERROR;
2749:
2750: END IF; --check for tolerance
2751:
2752: END IF; --check l_price_tolerance_allowed
2826: substr(g_reqmsg||g_delim||
2827: l_req_num||g_delim||g_linemsg||g_delim||
2828: l_req_line_num||g_delim||
2829: l_textline,1,240));
2830: x_check_status := FND_API.G_RET_STS_ERROR;
2831:
2832: END IF; --amount check
2833:
2834: END IF; --check l_amount_tolerance_allowed
2857: * Modifies: Writes error messages to the concurrent program log.
2858: * Effects: Performs checks that must be successful for an approved release
2859: * to be created.
2860: * Returns:
2861: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2862: * pre-approval checks
2863: * FND_API.G_RET_STS_ERROR if at least one check fails
2864: **/
2865: PROCEDURE preapproval_checks( p_po_header_id IN NUMBER,
2859: * to be created.
2860: * Returns:
2861: * x_check_status: FND_API.G_RET_STS_SUCCESS if release passes all
2862: * pre-approval checks
2863: * FND_API.G_RET_STS_ERROR if at least one check fails
2864: **/
2865: PROCEDURE preapproval_checks( p_po_header_id IN NUMBER,
2866: p_req_num IN VARCHAR2,
2867: p_req_line_num IN NUMBER,
2896: l_sob_id FINANCIALS_SYSTEM_PARAMS_ALL.set_of_books_id%TYPE;
2897: l_purch_enc_flag FINANCIALS_SYSTEM_PARAMS_ALL.purch_encumbrance_flag%TYPE;
2898: BEGIN
2899:
2900: x_check_status := FND_API.G_RET_STS_SUCCESS;
2901: --
2902: l_federal_instance := PO_CORE_S.Check_Federal_Instance(
2903: PO_MOAC_UTILS_PVT.Get_Current_Org_Id);
2904: --
2910: END IF;
2911:
2912: -- First check the document level amount limits.
2913: check_amount_limits(p_po_header_id, p_req_num, p_req_line_num,l_check_status);
2914: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
2915: x_check_status := FND_API.G_RET_STS_ERROR;
2916: END IF;
2917:
2918: -- The following checks were adapted from the Document Submission
2911:
2912: -- First check the document level amount limits.
2913: check_amount_limits(p_po_header_id, p_req_num, p_req_line_num,l_check_status);
2914: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
2915: x_check_status := FND_API.G_RET_STS_ERROR;
2916: END IF;
2917:
2918: -- The following checks were adapted from the Document Submission
2919: -- Checks API (PO_DOCUMENT_CHECKS_PVT.check_releases):
2986: FOR i IN 1..l_error_messages.COUNT LOOP
2987: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
2988: END LOOP;
2989: IF l_error_messages.COUNT > 0 THEN
2990: x_check_status := FND_API.G_RET_STS_ERROR;
2991: END IF;
2992:
2993: ----------------------------------------------
2994:
3052: g_linemsg||g_delim||l_req_line_num||g_delim||
3053: l_error_messages(i));
3054: END LOOP;
3055: IF l_error_messages.COUNT > 0 THEN
3056: x_check_status := FND_API.G_RET_STS_ERROR;
3057: END IF;
3058:
3059: END IF; -- l_purch_enc_flag check
3060:
3103: l_error_messages(i));
3104: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3105: END LOOP;
3106: IF l_error_messages.COUNT > 0 THEN
3107: x_check_status := FND_API.G_RET_STS_ERROR;
3108: END IF;
3109:
3110: --------------------------------------------------
3111:
3175: FOR i IN 1..l_error_messages.COUNT LOOP
3176: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3177: END LOOP;
3178: IF l_error_messages.COUNT > 0 THEN
3179: x_check_status := FND_API.G_RET_STS_ERROR;
3180: END IF;
3181:
3182: ---------------------------------------------
3183:
3244: FOR i IN 1..l_error_messages.COUNT LOOP
3245: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3246: END LOOP;
3247: IF l_error_messages.COUNT > 0 THEN
3248: x_check_status := FND_API.G_RET_STS_ERROR;
3249: END IF;
3250:
3251: ---------------------------------------------------------
3252:
3252:
3253: -- Check that the release shipment price is within the tolerance
3254: -- of the requisition line.
3255: check_rel_reqprice(l_check_status);
3256: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
3257: x_check_status := FND_API.G_RET_STS_ERROR;
3258: END IF;
3259:
3260: ----------------------------------------------------------
3253: -- Check that the release shipment price is within the tolerance
3254: -- of the requisition line.
3255: check_rel_reqprice(l_check_status);
3256: IF (l_check_status = FND_API.G_RET_STS_ERROR) THEN
3257: x_check_status := FND_API.G_RET_STS_ERROR;
3258: END IF;
3259:
3260: ----------------------------------------------------------
3261: --
3280: FROM po_headers_all
3281: WHERE po_header_id = p_po_header_id;
3282: EXCEPTION
3283: WHEN OTHERS THEN
3284: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3285: END;
3286:
3287: -- Call PO_FV_INTEGRATION_PVT.val_vendor_site_ccr_regis to check the
3288: -- Central Contractor Registration (CCR) status of the vendor site
3295: l_textline := FND_MESSAGE.get_string('PO', 'PO_VENDOR_SITE_CCR_INVALID');
3296: FND_FILE.put_line(FND_FILE.LOG, substr(g_reqmsg||g_delim
3297: ||p_req_num||g_delim||g_linemsg||g_delim
3298: ||p_req_line_num||g_delim||l_textline,1,240));
3299: x_check_status := FND_API.G_RET_STS_ERROR;
3300: END IF; -- l_valid_registration check
3301: END IF; -- l_vendor_id and l_vendor_site_id check
3302: END IF; -- l_federal_instance check
3303: --
3324: FOR i IN 1..l_error_messages.COUNT LOOP
3325: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3326: END LOOP;
3327: IF l_error_messages.COUNT > 0 THEN
3328: x_check_status := FND_API.G_RET_STS_UNEXP_ERROR;
3329: END IF;
3330:
3331: l_progress := '019';
3332: IF g_fnd_debug = 'Y' THEN
3353: FOR i IN 1..l_error_messages.COUNT LOOP
3354: FND_FILE.put_line(FND_FILE.LOG, l_error_messages(i));
3355: END LOOP;
3356: IF l_error_messages.COUNT > 0 THEN
3357: x_check_status := FND_API.G_RET_STS_UNEXP_ERROR;
3358: END IF;
3359:
3360: EXCEPTION
3361:
3405:
3406: l_progress VARCHAR2(3) := '001';
3407:
3408: BEGIN
3409: l_return_status := FND_API.G_RET_STS_SUCCESS;
3410:
3411: IF (g_fnd_debug = 'Y') THEN
3412: IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
3413: FND_LOG.string (
3431: p_line_id => NULL,
3432: p_line_location_id => NULL
3433: );
3434:
3435: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3436: RAISE FND_API.G_EXC_ERROR;
3437: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3438: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3439: ELSE
3432: p_line_location_id => NULL
3433: );
3434:
3435: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3436: RAISE FND_API.G_EXC_ERROR;
3437: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3438: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3439: ELSE
3440: NULL;
3433: );
3434:
3435: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3436: RAISE FND_API.G_EXC_ERROR;
3437: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3438: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3439: ELSE
3440: NULL;
3441: END IF;
3434:
3435: IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3436: RAISE FND_API.G_EXC_ERROR;
3437: ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3438: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3439: ELSE
3440: NULL;
3441: END IF;
3442:
3440: NULL;
3441: END IF;
3442:
3443: EXCEPTION
3444: WHEN FND_API.G_EXC_ERROR THEN
3445: ROLLBACK TO PORELGEN_1;
3446: -- Bug 3570793 Write the message list to the concurrent program log.
3447: PO_DEBUG.write_msg_list_to_file (
3448: p_log_head => c_log_head || l_api_name,
3448: p_log_head => c_log_head || l_api_name,
3449: p_progress => l_progress
3450: );
3451:
3452: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3453: ROLLBACK TO PORELGEN_1;
3454: -- Bug 3570793 Write the message list to the concurrent program log.
3455: PO_DEBUG.write_msg_list_to_file (
3456: p_log_head => c_log_head || l_api_name,
3559: x_msg_data => l_msg_data,
3560: p_caller => 'CREATE_RELEASE',
3561: x_po_gms_interface_obj => l_gms_po_interface_obj);
3562:
3563: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3564: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3565: END IF;
3566:
3567: l_progress := '003';
3560: p_caller => 'CREATE_RELEASE',
3561: x_po_gms_interface_obj => l_gms_po_interface_obj);
3562:
3563: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3564: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3565: END IF;
3566:
3567: l_progress := '003';
3568:
3574: WHERE po_distribution_id = l_gms_po_interface_obj.distribution_id(i);
3575:
3576: EXCEPTION
3577:
3578: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3579:
3580: -- Bug 3570793 Write the message list to the concurrent program log.
3581: PO_DEBUG.write_msg_list_to_file (
3582: p_log_head => c_log_head || l_api_name,