Documentation >
MAC-PAC Technical Library >
Distribution >
Purchasing >
Programs >
Purchase Order Maintenance - Purpose >
Purchase Order Maintenance - Calculations
Purchase Order Maintenance - Calculations
PO180E
A. Housekeeping
1. See Common Processing Routines - Housekeeping of this manual for a general discussion of the Housekeeping subroutine. Processing specific to this program is described below.
2. A parameter list is set up for the fast path and help screen parameters.
3. Key lists are defined for each file retrieved by the program.
4. Workfields are defined and program constants are initialized.
a. Workfields for message constants are defined. Messages tell the user whether the purchase order is successfully closed. The workstation ID is moved into a message queue constant.
b. The company code and warehouse number workfields are defined.
5. The display file is defined as a user-controlled file. This file is not opened if the close flag is yes (indicating that processing is automatic purchase order closing).
6. The following records are retrieved from the Reference file (REFERP):
a. The applications installed records (categories 011 and 012) are retrieved, and the Shop Floor Control, Inventory Accounting, Expert Configurator, Control, and Repetitive Supply flags are saved.
b. The date format record (category 049) is retrieved. If this record is not found, the date format defaults to MMDDYY.
c. The following categories are retrieved and stored in arrays for access during processing:
· Free on board codes (category 225)
· Freight terms codes (category 226)
· Shipping instructions (category 227)
· State codes (category 326)
· Order types (category 401)
· Purchase order types (category 437)
· Purchase order comment and message print codes (category 438)
· Expedite notice codes (category 473)
· Packing type codes (category 474)
· Purchase order acknowledgment status codes (category 478)
· Purchase order hold codes (category 479)
· Purchase order document release codes (category 484)
· Document format types (G61)
· Requisition status code (474)
d. The system option assignment record (category 133) is retrieved. The single/multiple currency record is checked to determine if the base currency should be displayed on the screen(s). The address format is also checked to determine if addresses should be displayed in free-form or U.S. format.
e. All company/warehouses to which the user is authorized are retrieved from the user company/warehouse authorization record (category 409) and loaded into an array. If no records are found for the user, a flag is set authorizing the user to all company/warehouses.
f. The decimal field precision record (category 446) is retrieved.
g. If the Inventory Accounting Application is installed, the Inventory Accounting close grace period record (category 456) is retrieved.
h. All purchase order release codes to which the user is authorized are retrieved from the purchase order release authorization record (category 480) and loaded into an array. If no records are found for the user, a flag is set authorizing the user to all release codes.
i. The Purchasing application system defaults 1 record (category 491) is retrieved. The Purchase Order Number Assignment Method is saved.
j. The Purchasing application system defaults 2 record (category 492) is retrieved. The default Purchase Order Release Print Code, default Expedite Notice Code, default Expedite Notice Leadtime and Delivery Performance Statistics Date option are saved. A flag is also retrieved to determine how the maximum line quantity should be validated.
7. The default company/warehouse is retrieved from the workstation assignment record (category 428). This company/warehouse is validated against the array of authorized company/warehouses for the user.
8. The primary quotation type is retrieved from the Quotation Types category (469) on the Reference file and moved into a work field.
9. The QCAEXEC command data structure is initialized.
B. Mainline
1. The close flag is validated. If processing is automatic order closing, the order number is checked to ensure it is not closed.
a. If the order number is valid, the purchase order status is closed and files are updated.
b. The warning message indicating whether the order was successfully closed is displayed on the workstation.
2. The Purchase Order Maintenance Function Select screen (PO180S01) is formatted and displayed.
Four maintenance modes are allowed: add a purchase order (Maintenance Code = 1), change a purchase order (Maintenance Code = 2), close an order (Maintenance Code = 3), and reopen an order (Maintenance Code = 4).
3. The Function Select screen is validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules.
a. If F18 - Order Retrieval is pressed, a call is made to the Purchase Order Retrieval program (PO920E), and the returned value is displayed in the Order Number field. See Common Processing Routines, Purchase Order Retrieval, for a discussion of this processing.
b. If F22 - Item/Vendor Rel is pressed, a call is made to the Item/Vendor Relationship Inquiry program (PO840E). The vendor number and part number are passed as parameters.
4. If any errors occur during validation, the Function Select screen is redisplayed with the appropriate error messages and the fields in error highlighted.
5. If there are no errors, a purchase order header record is created (for an add transaction) or updated (for a change, close, or reopen transaction) on the Purchase Order Header file (PO180ML1U).
6. The next screen is displayed:
a. For an add transaction, the Vendor screen (PO180S02) is displayed.
b. For a change transaction, the Order Recap screen (PO180S09) is displayed.
c. For reopen transactions, the Partial Header screen (PO180S02) is displayed. All fields are for display only. A warning message is displayed instructing the user to press the ENTER key to process the reopen.
d. For close transactions, the Order Close screen (PO180S10) is displayed. All fields are for display only. A warning message is displayed to press the ENTER key to process the close. An error message is also written to the screen if the order has not been received in full.
The remainder of this program narrative will discuss each maintenance transaction separately.
ADD AN ORDER (Maintenance Code = 1)
1. If the Vendor screen (PO180S02) is displayed, the following processing is performed:
a. The fields are formatted with default values from the Vendor Master file (APMASTP) and the Warehouse Description file (IC170M).
b. The company and warehouse are validated, and the VAT/GST flag is set.
c. Other default values are set:
(1) The Purchase Order Type is set to blanket (B).
(2) The Order Type is set to warehouse ship (W), the order type on Functin Select screen.
(3) The Order Date is set to the system date.
(4) The Order Effectivity Date and Order Expiration Date are set to blank.
(5) The Target Amount is set to zero.
(6) The Print Flag is set to no (N).
(7) The Purchase Order Status is set to open (O).
d. The screen is displayed to the user. After the ENTER key is pressed, any fields that were changed are validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules.
e. If no errors occurred, the record is written to the Purchase Order Header file (PO180M1U). An audit trail record is formatted and written to the Purchase Order Header Audit Trail file (PO180BP1). The program status is set to display the Purchase Order Header screen.
f. The Order Header screen is displayed.
2. If the Purchase Order Header screen (PO180S03) is displayed, the following processing is performed:
a. The fields are formatted with default values from the Vendor Master file (APMASTP).
(1) If the system is in a tax environment (VAT Flag = N), the Tax Amount, Tax Percent and Tax Code fields are displayed and initialized with default values from the Vendor Master file. If the system is in a GST environment (VAT Flag = B) the tax amount, Tax Percent and PST code fields are displayed and initialized with default values from Reference File category 348.
(2) The Comment Flag is set to no (N). If the user changes it to yes (Y), when the ENTER key is pressed the comment screen will be displayed.
(3) In a multi-currency environment, the currency code is validated and the description is retrieved.
b. The screen is displayed to the user. After the ENTER key is pressed, any fields that were changed are validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules.
c. If no errors occurred, the Purchase Order Header file (PO180M1U) is updated with the new record. An audit trail record is formatted and written to the Purchase Order Header Audit Trail file (PO180BP1).
d. If no errors have occurred, and comments have been requested (Comments Flag = Y), the program status is set to display the Purchase Order Header Comment screen (PO180S07). Otherwise, the program status is set to display the Purchase Order Line screen (PO180S04). If a Part Number was not entered on the Function Select screen, the Purchase Order Line Partial screen will first be displayed for the user to enter a valid Part Number.
3. If the Purchase Order Line Partial screen (PO180S04) is displayed (if no Part Number was entered):
a. The Part Number must be a valid, active part on the Part Master file (DE100M). The part must have a part status that is valid for purchase orders, as defined on Reference File category D88. A valid configuration code must also be entered if the part is configuration coded. If no errors occur, the program status is set to display the Purchase Order Line screen.
4. If the Purchase Order Line screen (PO180S04) is displayed, the following processing is performed:
a. The fields are formatted and initialized.
(1) The Purchasing Unit of Measure, Conversion Factor, Expedite Notice Type, Inspection Required Code and Receiving Type fields are formatted with defaults from the Item/Vendor Relationship file (PO140M1).
(2) The Line Effectivity Date and Expiration Date are set to the Header Effectivity Date and Expiration Date, respectively.
(3) The Maximum Line Quantity and Line Target Quantity are set to zero.
(4) Unit Price and Requesting Department fields are set to blank.
(5) If the system is in a non-VAT processing environment (VAT Flag = N), the Taxable Flag field is displayed. If the system is in a VAT processing environment (VAT Flag = Y), the VAT Code is initialized with the Part VAT Code retrieved from the Item/Vendor Relationship file (PO140M1). If the system is in a GST processing environment (VAT Flag = B), the GST codes and PST taxable fields are displayed.
(6) In a job-controlled environment, the job/group number will be displayed and set to blanks if the part is job-controlled and the purchase order is not a phantom order.
(7) If the Expert Configurator is installed, the configuration code will be displayed if the part is configuration coded and the purchase order is not a phantom order.
(8) If the part is a non-standard part, an account/center can be entered. This account/center is validated against the Account/Center Master file (GLFILEL5).
(9) If a primary quotation exists on the Quotation file (P0150M1) it is retrieved and the quotation number defaults to the Line field.
b. The user can request automatic or manual pricing.
(1) The manual pricing method is assumed when the user enters a Unit Price. In this case, the Quotation Number must be blank.
(2) If the automatic method is used, the user must enter a Quotation Number. If the quotation unit of measure is different than the item/vendor relationship unit of measure, the retrieved Unit Price is automatically converted to the item/vendor relationship unit of measure.
(3) If the part is configuration coded, the Unit Price will be defaulted from the Configuration Master file for the part/configuration code combination. The user can override the Unit Price by entering a new Unit Price or a Quotation Number.
c. When the ENTER key is pressed, the user's input is validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules. If no errors have occurred, a record is written to the Purchase Order Line file (PO180M2), an audit trail record is formatted and written to the Purchase Order Line Audit Trail file (PO180BP2), and the Active Line Counter in the purchase order header record is incremented by 1.
If item/vendor comment records exist for the item/vendor relationship with Print Codes of 2 (print on purchase order) or 3 (print on purchase order and item/vendor relationship reports), the comment records are written to the Purchase Order Comment file.
d. If no errors have occurred, the program status is set to display the next screen:
(1) If the Comment Flag equals Y (yes), the Purchase Order Line Comment screen (PO180S08) is displayed.
(2) If the Comment Flag equals N (no) and the Purchase Order Type is not phantom, the Purchase Order Release screen (PO180S05) is displayed.
(3) If the Comment Flag equals N (no) and the Purchase Order Type equals phantom, the Phantom Order Release screen (PO180S06) is displayed.
5. If the Release screen (PO180S05) is displayed, the following processing is performed:
a. The first page of the subfile is loaded with blanks and displayed.
b. The user can manually or automatically enter release lines.
(1) To use the automatic method, the user must press F16 - Requisition. See Common Processing Routines: Requisition Search for a discussion of this processing. If a requisition has been selected or entered, the following validation is performed: All requisition lines selected by the user are displayed on the subfile and the Requisition Quantity is automatically converted to the purchasing unit of measure.
a) If the purchase order line covers already a sales order line (that means the purchase order line covers a requisition that covers a sales order line), the sales order number covered by the requisition must be the same as for the purchase order.
b) If this is not the first release for the purchase order line and the first release doesn't cover a requisition that covers a sales order line, the selected or entered requisition must not cover a sales order line.
c) If the order type is direct ship and the purchase order covers a sales order already (that means either another purchase order line covering a sales order line exists or another release for this purchase order line exists that covers a sales order line), and the selected or entered requisition covers a sales order line, the sales order for the requisition must be the same as for the purchase order.
d) The requisition type must be equal to the order type ('W' or 'D'). If no errors have occurred, the order type is direct ship, and at least one purchase order line covers a sales order line, the ship-to address for this sales order is retrieved from the Sales Order Header file (OP100M1) and the ship-to address on the Purchase Order Header file is changed.
(2) When the manual method is used, the Requisition Number and the Requisition Line Number must be blank; manually entered releases cannot affect a requisition.
c. When the Due Date is entered (manually or automatically from the Requisition function) the Dock Date is automatically calculated by subtracting the Dock-to-Stock Leadtime (from the Warehouse Balance file (IC140M)) from the Due Date. If no record is found on the Warehouse Balance file, the Dock Date is set equal to the Due Date.
The Dock Date and the Due Date must exist on the plant specific Calendar file (CT140M) if the Shop Floor Control application is installed.
d. The Promised Date is initialized with the Dock Date. The Original Promised Date is initialized with the Promised Date.
e. The Release Quantity cannot be set to zero.
f. The following command keys may be used on this screen:
(1) Command keys allow the user to display the Purchase Order Line screen (F4), display the Recap screen (F11), execute the Requisition function (F16) and to process the calculated balance function (F20).
g. If no error occurred during the validation of the releases subfile, the master files are updated.
(1) Each existing subfile record is updated or a new release record written to the Purchase Order Release file (PO180M3). An audit trail record is formatted and written to the Purchase Order Release Detail Audit Trail file (PO180BP3).
(2) The Warehouse Balance file (IC140M) is updated with the Release Quantity. A record is added if it does not already exist.
(3) The purchase order line detail record is updated on the Purchase Order Line file (PO180M2) and the header record is updated on the Purchase Order Header file (PO180M1).
(4) If the purchase order line covers a sales order line, the Sales Order Line file (OP100M2) is updated with the purchase order number and the purchase order line number.
h. If no errors have occurred, the program status is set to display the Partial Line screen (PO180S04).
6. If the Release (Phantom Order) screen (PO180S06) is displayed, the following processing is performed:
a. The first page of the subfile is loaded with blanks and displayed.
b. The user can manually or automatically enter phantom order release lines.
(1) To use the automatic method, the user must press F16 - Phantom Search. See Common Processing Routines: Manufacturing Order Retrieval for a discussion of this processing. All phantom orders selected by the user are displayed on the subfile.
(2) When the manual method is used, the user must enter a Manufacturing Order Number, an Operation Number and an Operation Line Number if processing an order for a part with a production type of MRP a the time of the phantom order creation. The user must enter an external workcenter with both a variable rate and accounting rate code if processing an order for a part with a production type of JIT at the time of the phantom order creation.
c. When the Due Date is entered (manually or automatically from the Phantom Order Search function) the Dock Date is automatically calculated by subtracting the Dock-to-Stock Leadtime (from the Warehouse Balance file (IC140M)) from the Due Date. If no record is found on the Warehouse Balance file, the Dock Date is set equal to the Due Date.
The Dock Date and the Due Date must exist on the Calendar file (CT140M) if the Shop Floor Control application is installed.
d. The Promised Date is initialized with the Dock Date. The Original Promised Date is initialized with the Promised Date.
e. The Release Quantity cannot be set to zero.
f. The following command keys may be used on this screen:
(1) Command keys allow the user to display the Purchase Order Line screen (F4), display the Recap screen (F11) and execute the Phantom Order Search function (F16).
g. If no errors occurred during the validation of the releases subfile, the master files are updated.
(1) Each existing subfile record is updated or a new release record written to the Purchase Order Release file (PO180M3). An audit trail record is formatted and written to the Purchase Order Release Detail Audit Trail file (PO180BP3).
(2) The purchase order line detail record is updated on the Purchase Order Line file (PO180M2) and the header record is updated on the Purchase Order Header file (PO180M1).
h. If no errors have occurred, the program status is set to display the Partial Line screen (PO180S04).
7. If the Purchase Order Header Comment screen is displayed, the following processing is performed:
a. The subfile is formatted with blanks and displayed.
b. User input is validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules.
c. If no errors have occurred, the program status is set to display the Partial Line screen (PO180S04).
8. If the Purchase Order Line Comment screen is displayed, the following processing is performed:
a. The subfile is formatted with blanks and displayed.
b. User input is validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules.
c. If no errors have occurred, the program status is set to display the Partial Line screen (PO180S04).
9. If the Order Recap screen (PO180S09) is displayed, the following processing is performed:
a. This screen is used to display the order, allowing the user to review and, if necessary, change the header, line and release records.
These functions are accomplished through the use of command keys:
(1) F4 - Display Detail redisplays the Line Detail screen.
(2) F7 - Display Header redisplays the Header screen.
(3) F12 - Display Comments redisplays the Comment screen.
(4) F16 - Display Releases redisplays the Release screen.
(5) F18 - Add New Line allows the user to add a new line.
(6) F10 - Select Function redisplays the Function Select screen.
b. If no errors occur during validation, the Purchase Order Header file (PO180M1U) is updated and the Record in Use Flag is set off. If the Purchase Order Paperwork Release Code is immediate (I), a message is sent to the asynchronous monitor to initiate the purchase order print job. The program status is set to display the Partial Header screen.
CHANGE AN ORDER (Maintenance Code = 2)
1. The Order Recap screen (PO180S09) is formatted with the values from the Purchase Order Header file (PO180M1) and Line file (PO180M2) and displayed. The Header File record is logically locked to prevent intervening updates.
2. If any warning message is stored for a line, an asterisk (*) is displayed in the Select field.
3. New lines can be added to the purchase order by using F18 - Add New Line. Existing header, line, release or comment data can be changed by using the command keys to display the desired screen, changing the data, and pressing the ENTER key. All changed data is validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Planning, for validation rules. If a line has been closed on the line detail screen, it is checked for a balance due. If there is a balance due, a warning message is written to the error subfile displayed on the order recap screen.
4. After each change, the appropriate master file is updated. When no more changes are made, the Purchase Order Header record (PO180M1), is unlocked, and the Function Selection screen is redisplayed.
CLOSE AN ORDER (Maintenance Code = 3)
1. The Order Close screen (PO180S10) is displayed.
2. Two validations steps are required to process the close to provide the user the opportunity to exit the function or to rekey the data.
a. The first time the ENTER key is pressed, a warning message is displayed informing the user that the ENTER key must be pressed again before the update is processed. A warning message, indicating that the order has not been fully received is written to the error subfile when a balance is due on any of the order lines.
b. If no command key is pressed, when the ENTER key is pressed again, the following updates are performed:
(1) The Purchase Order Header Status is changed to CLOSED in the Purchase Order Header file (PO180M1U), Purchase Order Line file (PO180M2U), and Purchase Order Release file (PO180M3U).
(2) The Release Quantity on the Purchase Order Release file is set to zero.
(3) The Release Quantity on the Requisition file (PO160M1) is decreased to the previous release quantity.
(4) The Order Quantity on the Warehouse Balance file (IC140M) for the corresponding part is decreased to the previous release quantity.
3. The warning message indicating that the order was not fully received is also displayed on the Function Select screen, the next screen to be displayed.
REOPEN AN ORDER (Maintenance Code = 4)
1. The Partial Header screen (PO180S02) is displayed. The only fields displayed are the Order Number and Vendor Number.
2. Two validation steps are required to process the reopen to provide the user the opportunity to exit the function or to rekey the data.
a. The first time the ENTER key is pressed, a warning message is displayed informing the user that the ENTER key must be pressed again before the update is processed.
b. If no command key is pressed, when the ENTER key is pressed again, the Purchase Order Header Status is changed to OPEN in the Purchase Order Header file (PO180M1U), Purchase Order Line file (PO180M2U), and Purchase Order Release file (PO180M3U).
Note: This processing is not relevant in a job-controlled environment.