Background:
Recently, the user reported that some invoices that have been fully paid can still be selected and paid with no amount, currently, this feature is not enabled (enable the Allow Zero Payments option in the Payables Options region of the Bank Accounts window .)
Cause:
I personally think it may be a bug, resulting in the failure to synchronously update the flag.
Measures:
1> Find the corresponding invoice;
SELECT DISTINCTAi. invoice_id, ai. invoice_num,
Pv. segment1 vendor_num, pv. vendor_name,
'The fully Paid invoice shoshould be closed! 'Status
FROMAp. ap_invoices_all ai,
Po. po_vendors pv,
Ap. ap_payment_schedules_all aps
WHEREAi. invoice_id = aps. invoice_id
ANDAi. set_of_books_id = & sob
ANDAi. invoice_amount = ai. amount_paid
ANDAi. cancelled_dateIS NULL
ANDAi. vendor_id = pv. vendor_id
AND(Ai. payment_status_flag <> 'y'
ORAps. payment_status_flag <> 'y'
)
2> Update the corresponding flag to meet the actual business needs;
Update ap_invoices_all
Set payment_status_flag = 'y'
Where invoice_id = & invoice_id;
Update ap_payment_schedules_all
Set payment_status_flag = 'y'
Where invoice_id = & invoice_id;
Conclusion:Test found
1> in the two tablesPayment_status_flag. If either one is Y and the other is N or P, the invoice cannot be selected on the Payment workbench;
2> in the two tablesPayment_status_flag is not Y. Whether N or P is used, you can select an invoice on the Payment workbench.
Metalink feedback [SR:7571908.994]
CAUSE DETERMINATION
================================
The cause of the issue is invalid/incorrect data in AP_PAYMENT_SCHEDULES_ALL and AP_Invoices_All tables
Extra row (s) with AMOUNT_REMAINING, BATCH_ID, DUE_DATE, GROSS_AMOUNT fields shoshould not be null in
AP_PAYMENT_SCHEDULES_ALL table PAYMENT_STATUS _ FLAG shocould not be P in AP_Invoices_All table
SOLUTION/ACTION PLAN
======================================
To implement the solution, please execute the following steps:
1. Ensure that you have taken a backup of your system before applying the recommended s
Olution.
2. Run the following scripts in a TEST environment first:
Create table TAR_7571908_994_APSA
Select * from ap_payment_schedules_all
Where amount_remaining is null and
Batch_id is null and
Due_date is null and
Gross_amount is null and
Payment_status_flag = 'P ';
Create table TAR_7571908_994_AIA
Select * from AP_Invoices_All
Where INVOICE_ID in (485237,492 065) and
PAYMENT_STATUS_FLAG = 'P ';
Delete from ap_payment_schedules_all
Where amount_remaining is null and
Batch_id is null and
Due_date is null and
Gross_amount is null and
Payment_status_flag = 'P ';
-- This shoshould delete all extra row (s) rows with null values fields in ap_payment_schedules_all
Update AP_Invoices_All
Set PAYMENT_STATUS_FLAG = 'y'
Where INVOICE_ID in (485237,492 065 );
-- This shocould update PAYMENT_STATUS_FLAG field in the invoices specified