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.
Hi there,
ReplyDeleteWhere 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?
Did you ever get an nswer to this question? I would also like to have this called during the invoice validation batch process.
DeleteDid you ever get an nswer to this question? I would also like to have this called during the invoice validation batch process.
DeleteI believe you add the custom hold in AP_CUSTOM_INV_VALIDATION_PKG.pkb.
ReplyDeleteYou 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*/
Dear Chandra
ReplyDeleteCould you advise how to write the Invoice Hold with PO Term - FOB:Destination then Invoice should go on Hold and not get accounted.