Tuesday, December 23, 2014

Oracle Payables - Custom Hold on Invoices

Invoices can be put on hold using custom validations. The custom validation can be through any API or CUSTOM.pll.
The below APIs can be used to put the invoice on hold ap_holds_pkg.insert_single_hold and the hold can be released using ap_holds_pkg.release_single_hold.
Inserting Hold
ap_holds_pkg.insert_single_hold  (X_invoice_id         IN number,  -- Invoice Id to which the Hold needs to be applied
                                 X_hold_lookup_code   IN varchar2, -- Hold Look up code (select hold_lookup_code from ap_hold_codes)
                                 X_hold_type IN varchar2 DEFAULT NULL, -- Hold Type (select hold_type from ap_hold_codes)
                                 X_hold_reason IN varchar2 DEFAULT NULL, -- Can be user defined
                                 X_held_by IN number DEFAULT NULL, --Can be user defined
                                 X_calling_sequence IN varchar2 DEFAULT NULL -- Can be user defined)
Releasing the Hold
ap_holds_pkg.release_single_hold (X_invoice_id          IN number,-- Invoice Id from which the Hold needs to be released
                                 X_hold_lookup_code    IN varchar2,-- Hold Look up code (select hold_lookup_code from ap_hold_codes) This is the Hold we are trying to release.
                                 X_release_lookup_code IN varchar2, --  Release Look up code (select hold_lookup_code from ap_hold_codes) This is the Release Hold we are using to release the Hold on invoice.
                                 X_held_by IN number DEFAULT NULL,--Can be user defined ( but it has to be the same as X_held_by when the hold is applied)
                                 X_calling_sequence IN varchar2 DEFAULT NULL-- Can be user defined)
Before executing the above two procedures, define your custom hold and release using
Payables Manager --> Set up --> Hold and Release

The Hold type for the Invoice hold should be like 'INVOICE HOLD REASON' and for the release type it should be like 'INVOICE RELEASE REASON'
Also you can mention in the set up that If the hold on invoice can be released manually or not. This will be useful when you dont want to user to bypass the validation by releasing the hold manually.

5 comments:

  1. Hi there,

    Where do you call these custom hold pkg ? I have created a custom hold setup and like to be write a code to hold the invoice when validation takes place which is the batch process Payable invoice validation nightly job. where and how do I do I include this procedure or called?

    ReplyDelete
    Replies
    1. Did you ever get an nswer to this question? I would also like to have this called during the invoice validation batch process.

      Delete
    2. Did you ever get an nswer to this question? I would also like to have this called during the invoice validation batch process.

      Delete
  2. I believe you add the custom hold in AP_CUSTOM_INV_VALIDATION_PKG.pkb.

    You can replace 'NULL;' with your custom hold:

    .....
    BEGIN

    -- Update the calling sequence --

    l_debug_loc := 'AP_Custom_Validation_Hook';
    l_curr_calling_sequence := 'AP_CUSTOM_INV_VALIDATION_PKG.'||
    l_debug_loc||'<-'||
    p_calling_sequence;

    IF (G_LEVEL_PROCEDURE >= G_CURRENT_RUNTIME_LEVEL ) THEN
    l_log_msg := 'Begin of procedure '|| l_debug_loc;
    FND_LOG.STRING(G_LEVEL_PROCEDURE, G_MODULE_NAME||
    l_debug_loc, l_log_msg);
    END IF;

    NULL;

    IF (G_LEVEL_PROCEDURE >= G_CURRENT_RUNTIME_LEVEL ) THEN
    l_log_msg := 'End of procedure '|| l_debug_loc;
    FND_LOG.STRING(G_LEVEL_PROCEDURE, G_MODULE_NAME||
    l_debug_loc, l_log_msg);
    END IF;

    EXCEPTION
    .......


    like:
    /* start custom holds*/
    --NULL;
    XX_AP_INVOICE_HOLD_PKG.APPLY_HOLD(P_INVOICE_ID);
    /* end custom holds*/

    ReplyDelete
  3. Dear Chandra

    Could you advise how to write the Invoice Hold with PO Term - FOB:Destination then Invoice should go on Hold and not get accounted.

    ReplyDelete