Standard Purchase Order Mode – Using the Extension PackageThe Extension Package is called once per Header.
Extension package ‘validation errors’ encountered in any section of the Purchase Order will result in the entire record (Header, Children, Grandchildren…) being rejected. For example, just one distribution error will reject the entire Purchase Order.
All messages from the extension package are returned to the HEADER SECTION’s message column. Messages CAN NOT be returned to any of the child section’s message columns. However, you can include row numbers and section names in your message. Eg Extension Error: Forbidden Charge Account Distributions: Rows, 15,16
![]() Procedure m4aps_pow_extension.stdpo
The procedure stdpo provides access to the uploaded data. Modify this procedure to suit your requirements.
The uploaded data parameters match the structure of the purchase order open interface tables:
· po_headers_interface
· po_lines_interface
· po_price_diff_interface
· po_distributions_interface
Note: Both the Lines and the Shipments are loaded into the po_lines_interface table. This means that line data is duplicated across shipments for the same line.
Parameters
Relevant m4aps_powizard objects:
Using the Extension Package for Additional Validation
This example:
· Rejects a Purchase Order if any of its distributions have a NULL value for ATTRIBUTE1.
· Example return message in the Wizard for this code - Extension Error: Distribution Attribute1 is required. Row 13,14,15,16
![]() Using the Extension Package to Update a Line Value
Because both the lines and shipments are loaded into the po_lines_interface table. The lines are stored in a de-normalised form. Line values are repeated for all its corresponding shipments. Any updates to line values must be applied to all records in the table for that line. If you do not update all lines, the update may not be reflected in the imported purchase order, or the import may fail.
Processing Distributions for Each Shipment
This example processes distributions for each line/shipment. Similar code would be used to update Price Breaks for each line.
Business Rule: If a line has a line type of ‘Goods’ return a message back to the wizard when a distribution does not have a value for Distribution Attribute1. This message includes the row number of the line and the distributions. This message is printed to the header section in the Wizard.
Example Message:
Extension Error: Distributions Attribute1 requires a value for Lines with a type of Goods: Shipment Row 14 – Dist Row 14, Shipment Row 15 – Dist Row 15, Shipment Row 16 – Dist Row 16, Shipment Row 16 – Dist Row 17
![]() Price Break Peculiarities
The Price Breaks index is linked to the last combination of Line and Shipment for each individual line. This is because Price Breaks can't be loaded until Lines are loaded first. Since the po_lines table is denormalized (it stores data for both lines and shipments), Lines need to be loaded along with their corresponding Shipments.
When there are errors in price breaks, if including Line information in your message is required, it's easier to report the Line Number in your message instead of the Line’s row number in the spreadsheet.
Recommended messages:
· Line 1: Price Break 3
· Line 1: Price Break row 16
Rather than message: Line row 14: Price Break row 16
Refer to section:
|