api to cancel ap invoice in oracle apps r12
In this post , we will be discuss about the API to cancel ap invoice in oracle apps r12. We have an standard API provided by oracle to cancel the ap invoices in oracle apps. We cannot cancel the paid AP invoice using this API . Only unpaid invoices can cancel using this API in oracle apps. I will share the detail plsql script to cancel ap invoice in oracle apps r12. Please find below the sample script to cancel the payables invoices in r12.
Standard API to Cancel AP Invoice in r12
AP_CANCEL_PKG.AP_CANCEL_SINGLE_INVOICE
AP_CANCEL_PKG.IS_INVOICE_CANCELLABLE
Detail PLSQL Script Using api to cancel ap invoice in oracle apps r12
Declare
v_cancel BOOLEAN;
v_message_name VARCHAR2(1000);
v_invoice_amount NUMBER;
v_base_amount NUMBER;
v_temp_cancelled_amount NUMBER;
v_cancelled_by VARCHAR2(1000);
v_cancelled_amount NUMBER;
v_cancelled_date DATE;
v_last_update_date DATE;
v_orig_prepay_amt NUMBER;
v_pay_cur_inv_amt NUMBER;
v_token VARCHAR2(100);
v_invoice_id NUMBER := 123333;
v_last_updated_by NUMBER:=4453;
v_last_update_login NUMBER:=4444433;
v_accounting_date DATE:=SYSDATE;
begin
v_cancel := AP_CANCEL_PKG.AP_CANCEL_SINGLE_INVOICE
(p_invoice_id => v_invoice_id,
p_last_updated_by => v_last_updated_by,
p_last_update_login => v_last_update_login,
p_accounting_date => v_accounting_date,
p_message_name => v_message_name,
p_invoice_amount => v_invoice_amount,
p_base_amount => v_base_amount,
p_temp_cancelled_amount => v_temp_cancelled_amount,
p_cancelled_by => v_cancelled_by,
p_cancelled_amount => v_cancelled_amount,
p_cancelled_date => v_cancelled_date,
p_last_update_date => v_last_update_date,
p_original_prepayment_amount => v_orig_prepay_amt,
p_pay_curr_invoice_amount => v_pay_cur_inv_amt,
P_Token => v_token,
p_calling_sequence => NULL
);
IF v_cancel
THEN
DBMS_OUTPUT.put_line ('Invoice Cancelled' );
COMMIT;
ELSE
DBMS_OUTPUT.put_line ('Invoice Cancelled Failed' );
ROLLBACK;
End if;
END;
0 comments:
Post a Comment