AP Invoice Wizard

×
Menu
  • Extension Package

Extension Package

 
Purpose of the Extension Package
 
AP Invoice Wizard includes an extension package (M4APS_PIW_EXTENSION), that you can modify to meet your unique requirements.  It is automatically installed by the Wizard if it doesn’t already exist in your instance and will contain no additional code at this point in time.  The Wizard will always callout to this package, however modifying the extension package is optional.  By default, the CALLOUT procedure in the package does nothing.
 
The extension package can be used to perform additional validation or override values in the interface table(s) at both the Header and Distribution Lines level or perform any other desired operation.
 
You can choose to have the extension package return an Error, either when validating or uploading, see the example code below. 
Returning status = ‘E’ and a message will cause the Invoice or Distribution to be rejected.  The error message will be written to the spreadsheet.  A rejected invoice header will cause all the related Distributions to be ignored.
 
Modify the Extension Package
 
Modifying the extension package will require technical knowledge of PL/SQL (i.e. a developer or DBA resource) as well as functional knowledge to determine the logic.
 
Included in the piw_install.zip file are the files (M4APS_PIW_EXTENSION.pkb and M4APS_PIW_EXTENSION.pks).  Make the necessary changes to the callout procedure.  Compile the package into a test database and test thoroughly before compiling it into production.
 
If a status of ‘E’ is returned, the insert into the relevant interface table (for this record) will be rolled back and the error message will be returned to the worksheet.
 
The package uses the following parameters:
-    p_status must be set to E for the insert to be rolled back.
-    p_message length greater than 592 characters will be truncated.
-    p_id is the INVOICE_ID column in AP_INVOICES_INTERFACE or INVOICE_LINE_ID column in AP_INVOICE_LINES_INTERFACE.
-    p_table is either AP_INVOICES_INTERFACE or AP_INVOICE_LINES_INTERFACE.
 
Note:  It is really helpful for Support if you add the prefix ‘EXTPKG’ to your custom messages so that if they need to help you with a related issue, they can immediately determine the error messages origin – one of your custom messages, or the Wizard’s.
 
 Example Code to return an Error message to the Wizard
 
IF p_table = ‘ap_invoices_interface’ then
select invoice_amount into inv_amount from ap_invoices_interface
where invoice_id = p_id;
if inv_amount > 25000 then
    p_status := ‘E’;
    p_message := ‘EXTPKG - You cannot load invoices exceeding $25,000’;
end if;
 
END IF;