List of Use Cases Implemented by the AP910 Program Suite¶
The AP910
program suite, comprising AP910.rpgle
(vendor master maintenance/inquiry) and AP9104.rpgle
(vendor master delete/restore), called via AP910P
from the OCL program AP910P99.ocl36.txt
, implements the following use cases in the accounts payable system on IBM AS/400 or IBM i:
- Vendor Master Maintenance:
- Description: Allows users to create, update, or view vendor master records in the
APVEND
file, with support for 1099 processing. Includes validations for mandatory fields, reference data, and 1099-specific requirements (e.g., IRS Name Control, EIN, Box 1). - Program:
AP910.rpgle
-
Details: Supports maintenance (
MNT
) mode for adding/updating vendor records and inquiry (INQ
) mode for viewing. Validates fields like vendor name, sort field, hold status, GL account, carrier, terms, category, and 1099 codes. Optionally synchronizes with an SQL vendor table (commented out). -
Vendor Master Inactivation/Reactivation:
- Description: Enables marking a vendor as inactive (
I
) or reactivating it (A
) in theAPVEND
file, with support for 1099 processing via year-specific file overrides. - Program:
AP9104.rpgle
- Details: Provides a window interface to toggle the
vndel
flag. Originally included balance checks (invoices, monthly balances, inventory history) to prevent inactivation, but these are disabled, allowing unrestricted status changes.
Function Requirement Document: Vendor Master Management Function¶
Vendor Master Management Function Requirements¶
Overview¶
The Vendor Master Management function handles the creation, update, inquiry, inactivation, and reactivation of vendor master records in the accounts payable system. It supports 1099 processing with year-specific file overrides and enforces data integrity through validations.
Inputs¶
- Company Code (
p$co
): Identifier for the company (numeric). - Vendor Number (
p$vend
): Identifier for the vendor (numeric). - Run Mode (
p$mode
, 3A):MNT
(maintenance) orINQ
(inquiry). - File Name (
p$file
, 10A): Optional year-specific vendor file (e.g.,APVN2025
) for 1099 processing. - File Group (
p$fgrp
, 1A):G
orZ
for file overrides. - Vendor Data (for
MNT
mode, structure mirroringAPVEND
): - Name (
vnname
): Vendor name (non-blank). - Sort Field (
vnsort
): Short name for sorting (non-blank). - Name Overflow (
vnnovf
):Y
orN
. - Hold (
vnhold
):H
(check),A
(ACH),W
(wire),E
,U
(utility auto-pay), or blank. - Single Payee (
vnsngl
):S
or blank. - Expense GL Account (
vnexgl
): General ledger account number. - Carrier (
vncaid
): Carrier ID. - Terms (
vnterm
): Payment terms code. - Category (
vncatg
): Vendor category code. - 1099 Code (
vn1099
): 1099 reporting code. - IRS Name Control (
vnnmct
): Required ifvn1099
isM
orN
. - IRS EIN (
vnidno
): Required ifvn1099
isM
orN
. - IRS Box 1 (
vnbox1
): Required ifvn1099
isM
orN
. - Country (
vnctry
): Country code (e.g.,US
). - Zip Code (
vnzip5
): Required ifvnctry = 'US'
,vn1099 ≠ 'X'
, andvnhold ≠ 'E'
. - Payee 1 (
vnpyn1
): Primary payee name. - Payee 2 (
vnpyn2
): Secondary payee name (requiresvnpyn1
if non-blank). - ACH Fields (optional, commented out):
- Bank Account (
vnabk#
): Bank account number. - Account Type (
vnacos
):C
(checking) orS
(savings). - ACH Class (
vnacls
):CCD
. - Routing Code (
vnarte
): Bank routing number.
- Bank Account (
- Action (for inactivation/reactivation):
REACTIVATE
orINACTIVATE
.
Outputs¶
- Vendor Data: Updated or retrieved vendor record (structure mirroring
APVEND
). - Return Flag (
p$flag
, 1A): Indicates result: 1
: Successful create/update (maintenance).A
: Successful reactivation.D
: Successful inactivation.- Error Messages: List of validation errors (if any).
Process Steps¶
- Validate Inputs:
- Verify
p$co
exists inAPCONT
. - For
MNT
orINQ
, check ifp$co
andp$vend
exist inAPVEND
(optional forMNT
if creating new). -
Apply file overrides for
APVEND
,APCONT
,GLMAST
,GSTABL
,BBCAID
,APOPNH
,INFIL4
based onp$fgrp
(G
orZ
) orp$file
(e.g.,APVN2025
). -
Maintenance Mode (
MNT
): -
Create/Update:
- Validate input fields:
- Mandatory:
vnname
,vnsort
non-blank. vnnovf
:Y
orN
.vnhold
:H
,A
,W
,E
,U
, or blank.vnsngl
:S
or blank.vnexgl
: Exists inGLMAST
, not deleted or inactive, not special.vncaid
: Exists inBBCAID
, not deleted.vnterm
: Exists inGSTABL
, not deleted.vncatg
: Exists inGSTABL
.vn1099
: Exists inGSTABL
, not deleted, non-blank.- If
vn1099 = 'M'
or'N'
:vnnmct
,vnidno
non-blank.vnbox1
non-zero.
- If
vnctry = 'US'
andvn1099 ≠ 'X'
andvnhold ≠ 'E'
,vnzip5
non-zero. - If
vnpyn2
non-blank,vnpyn1
non-blank. - ACH (if enabled): If
vnabk#
non-blank,vnacos
(C
/S
),vnacls
(CCD
),vnarte
non-zero; ifvnhold = 'A'
andvnabk#
blank, error. - If valid, update or create record in
APVEND
: - If vendor exists, update
apvendpf
if changed. - If vendor does not exist, write new
apvendpf
withvnco = p$co
,vnvend = p$vend
. - Set
p$flag = '1'
. - (Optional, disabled) Synchronize with SQL vendor table via external call.
-
Inquiry Mode (
INQ
): - Retrieve vendor record from
APVEND
usingp$co
andp$vend
. -
Return vendor data without modifications.
-
Inactivation/Reactivation:
- Reactivate:
- If vendor exists in
APVEND
andvndel = 'I'
, setvndel = 'A'
, updateapvendpf
, setp$flag = 'A'
.
- If vendor exists in
-
Inactivate:
- If vendor exists in
APVEND
andvndel ≠ 'I'
, setvndel = 'I'
, updateapvendpf
, setp$flag = 'D'
. - (Disabled) Prevent inactivation if open invoices (
APOPNH
), non-zero balances (vnpurc
,vnpay
,vndmtd
), or inventory history (INFIL4
).
- If vendor exists in
-
Error Handling:
- Return error messages for validation failures (e.g., “Invalid Response...H or A or W or blank”, “Field Cannot be Blank, If Vendor receives a 1099”).
Business Rules¶
- Data Integrity:
- Mandatory fields (
vnname
,vnsort
,vn1099
) must be non-blank. - Reference fields (
vnexgl
,vncaid
,vnterm
,vncatg
,vn1099
) must exist in respective files (GLMAST
,BBCAID
,GSTABL
) and not be deleted (exceptvncatg
). - 1099-specific fields (
vnnmct
,vnidno
,vnbox1
) required forvn1099 = 'M'
or'N'
. - Zip code (
vnzip5
) required for US vendors unlessvn1099 = 'X'
orvnhold = 'E'
. - Payee hierarchy:
vnpyn2
requiresvnpyn1
. - 1099 Processing:
- Supports year-specific vendor files (e.g.,
APVN2025
) viap$file
. - File overrides (
G
orZ
) ensure access to correct data sets. - Status Management:
- Inactivation marks
vndel = 'I'
, reactivation marksvndel = 'A'
. - (Disabled) Inactivation restricted if vendor has outstanding activity.
- Mode Restrictions:
MNT
allows create/update,INQ
allows view only.- Inactivation/reactivation is a maintenance action.
Calculations¶
- Message Data Length:
- For error messages, calculate length as
%len(%trim(m@data))
forQMHSNDPM
. - No Other Calculations: The function performs validations and status updates without numerical computations.
Dependencies¶
- Files:
APVEND
: Vendor master (update).APCONT
: Company data (input).GLMAST
: General ledger accounts (input).GSTABL
: Reference data (terms, category, 1099 codes) (input).BBCAID
: Carrier data (input).APOPNH
: Open invoices (input, used in disabled checks).INFIL4
: Inventory history (input, used in disabled checks).- External Programs (for validations):
LGLMAST
: GL account lookup.LBBCAID
: Carrier lookup.LGSTABL
: Terms, category, 1099 code lookup.- (Disabled)
AP915P
: Vendor contact maintenance/inquiry. - (Disabled)
STRPCOCLP
/UpdateVendor.EXE
: SQL table sync. - System Programs:
QCMDEXC
: File overrides.QMHSNDPM
,QMHRMVPM
: Message handling.
Error Handling¶
- Return descriptive error messages for validation failures.
- Set
p$flag
to indicate success (1
,A
,D
) or leave unset for errors.
Assumptions¶
- Input data conforms to
APVEND
record format. - File overrides are correctly configured for
p$fgrp
andp$file
. - Disabled features (ACH validation, balance checks, SQL sync) are not required.