During the Payables Invoice Interface process, one of the validations involve validating the Vendor Number for which the Invoice is being created for. The Validation logic checks in the system to see if a vendor already exists for that vendor number. If Yes, then an Invoice can be created for that Supplier. Else, since that Supplier doesn’t exist, Invoices cannot be created against that supplier and the validation should result in error.
DECLARE p_vendor_num ap_suppliers.segment1%TYPE; l_vendor_id ap_suppliers.vendor_id%TYPE; CURSOR cur_vendor_num_chk (cp_vendor_num ap_suppliers.segment1%TYPE) IS SELECT vendor_id FROM ap_suppliers WHERE segment1 = cp_vendor_num; BEGIN OPEN cur_vendor_num_chk (p_vendor_num); FETCH cur_vendor_num_chk INTO l_vendor_id; IF (cur_vendor_num_chk%FOUND) THEN DBMS_OUTPUT.put_line ( 'Supplier exists in the system ' || CHR (10) || ' Thus, Invoice Can be created for this vendor.'); ELSE DBMS_OUTPUT.put_line ( 'Supplier does not exist and Invoice cannot be created using this Supplier'); END IF; CLOSE cur_vendor_num_chk; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line ('Error while validation: ' || SQLERRM); END;