Stored Procedure for AP Invoice (Service) Based on PO
I have below Store Procedure for Blocking Purchase Invoice not based on Purchase Order.
IF @transaction_type IN ('A','U') AND @object_type = '18'and @error = 0
IF EXISTS (SELECT T0.DocNum FROM OPCH T0 INNER JOIN PCH1 T1 on T1.DocEntry=T0.DocEntry WHERE T1.[BaseType] <> '22'
AND T0.DOCENTRY = @list_of_cols_val_tab_del)
SELECT @Error = 15, @error_message = 'Cannot Add Document without Purchase Order'
I would like to add additional criteria for blocking if the AP Invoice Amount Exceed the Open Amount in the PO.