Friday, August 31, 2012

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.