Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Thursday, April 18, 2013

API to Cancel the Oracle AP Invoice



AP_CANCEL_PKG.IS_INVOICE_CANCELLABLE:

Is_Invoice_Cancellable is a Function in the AP_CANCEL_PKG package that checks that an Invoice is cancellable or not when an Invoice Cancellation process starts.
It follows the following steps and returns a Boolean value depending on the result.
    If invoice contains distribution that does not have open GL period return FALSE.
    If invoice has an effective payment, return FALSE.
    If invoice is selected for payment, return FALSE.
    If invoice is already cancelled, return FALSE.
    If invoice is credited invoice, return FALSE.
    If invoices have been applied against this invoice, return FALSE.
    If invoice is matched to Finally Closed PO’s, return FALSE.
    If project related invoices have pending adjustments, return FALSE.
    If cancelling will cause qty_billed or amount_billed to less than 0, return FALSE.
    If none of above, invoice is cancellable return True.
Here is a small procedure to check if an Invoice is cancellable or not.

Create or replace procedure XX_INV_CANCELLABLE (p_inv_id IN NUMBER)
is
    v_boolean               BOOLEAN;
    v_error_code            VARCHAR2(100);
    v_debug_info            VARCHAR2(1000);
begin
    v_boolean := AP_CANCEL_PKG.IS_INVOICE_CANCELLABLE
                         (
                             P_invoice_id       => p_inv_id,
                            P_error_code       => v_error_code,
                            P_debug_info       => v_debug_info,
                            P_calling_sequence => NULL
                         );
    IF v_boolean=TRUE
    THEN
       DBMS_OUTPUT.put_line ('Invoice '||p_inv_id|| ' is cancellable' );
    ELSE
       DBMS_OUTPUT.put_line ('Invoice '||p_inv_id|| ' is not cancellable :'|| v_error_code );
    END IF;
End XX_INV_CANCELLABLE;

Execute XX_INV_CANCELLABLE(88888);


No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect