List of Use Cases Implemented by the BB802 Call Stack¶
The BB802 call stack, comprising programs BB802A, BB802B, BB802E, BB802F, BB802P, BB802H, BB802I, BB802G, and BB800E, implements a Customer Order and Invoice Inquiry system. The system retrieves and displays data for customer orders, invoices, canceled orders, and related details, with additional functionality to display accessorials and marks. Below is a list of distinct use cases derived from these programs, focusing on their data processing and inquiry capabilities:
- Retrieve Open Order Header Data:
- Description: Queries and aggregates open order header data from
BBORDH
into theBB802W
work file for inquiry display. - Program: BB802A
-
Purpose: Supports inquiries for open orders, providing header-level details like customer, order number, ship-to, and salesman.
-
Retrieve Open Order Detail Data:
- Description: Queries and aggregates open order detail data from
BBORDD
andBBORDH
(viaBB802BQF
) into theBB802W
work file. - Program: BB802B
-
Purpose: Provides detailed order information, including products, quantities, and locations, for open order inquiries.
-
Retrieve Sales History Header Data:
- Description: Queries and aggregates sales history header data from
SA5SHP
into theBB802W
work file. - Program: BB802E
-
Purpose: Supports inquiries for invoiced orders, providing header-level details like invoice number, ship date, and tracking number.
-
Retrieve Sales History Detail Data (Standard):
- Description: Queries and aggregates sales history detail data from
SA5FILD
andSA5SHP
(viaBB802FQF
) into theBB802W
work file. - Program: BB802F
-
Purpose: Provides detailed invoice information, including products and quantities, for standard sales history inquiries.
-
Retrieve Sales History Move Detail Data:
- Description: Queries and aggregates sales history move detail data from
SA5MOVD
andSA5SHP
(viaBB802PQF
) into theBB802W
work file when product move flag (P$PMOV = 'Y'
) is set. - Program: BB802P
-
Purpose: Supports inquiries for move-specific sales history, focusing on product movement details.
-
Retrieve Canceled Order Header Data:
- Description: Queries and aggregates canceled order header data from
BBCNH
andBBCNOR
(viaBB802HQF
) into theBB802W
work file. - Program: BB802H
-
Purpose: Supports inquiries for canceled orders, including cancel reasons, at the header level.
-
Retrieve Canceled Order Detail Data:
- Description: Queries and aggregates canceled order detail data from
BBCND
,BBCNH
, andBBCNOR
(viaBB802IQF
) into theBB802W
work file. - Program: BB802I
-
Purpose: Provides detailed information for canceled orders, including products and quantities.
-
Enrich Work File with Ship-To Location Data:
- Description: Updates the
BB802W
work file with city and state data from theSHIPTO
file based on ship-to codes. - Program: BB802G
-
Purpose: Enhances inquiry data with geographic details for display.
-
Display Customer Order or Ship-To Accessorials and Marks:
- Description: Queries and displays accessorials and marks data for customer orders (from
BBORA1
,BBORDH
) or ship-to records (fromBBSHSA1
,SHIPTO
) using a subfile interface. - Program: BB800E
- Purpose: Provides detailed inquiry for accessorials and marks, supporting both order-specific and ship-to-specific data.
Function Requirement Document¶
Customer Order and Invoice Inquiry Function¶
Purpose¶
The Customer Order and Invoice Inquiry function retrieves and aggregates data for open orders, canceled orders, sales history (including move details), and accessorials/marks for customer or ship-to inquiries, consolidating data into a work file for processing and optionally displaying accessorials/marks details.
Inputs¶
- Company Code (
p$co
, 2 digits): Identifies the company. - Customer or Order Number (
p$csor
, 6 digits): Specifies the customer or order to query. - Ship-To Code (
p$ship
, 3 digits): Specifies the ship-to location (optional, '000' for order-level inquiries). - File Group (
p$fgrp
, 1 character): 'G' or 'Z' to select the appropriate library. - Product Move Flag (
p$pmov
, 1 character): 'Y' to include sales history move details, else 'N'.
Outputs¶
- Consolidated Inquiry Data: Aggregated data in the
BB802W
work file, including order, invoice, and canceled order details with city/state. - Accessorials/Marks Data: Detailed accessorials and marks for orders or ship-to records (if requested).
Process Steps¶
- Validate Inputs:
- Verify
p$co
,p$csor
,p$ship
, andp$fgrp
are provided and valid. -
Exit with error if parameters are missing or invalid.
-
Apply File Overrides:
-
Use
p$fgrp
('G' or 'Z') to override file libraries (e.g.,GBBORDH
/ZBBORDH
,GSA5SHP
/ZSA5SHP
). -
Aggregate Open Order Header Data:
- Read
BBORDH
records matchingp$co
andp$csor
. -
Write to
BB802W
with fields: company, customer, order number, ship-to, purchase order, salesman, carrier, freight details, andw1oori = 'O'
. -
Aggregate Open Order Detail Data:
- Read
BB802BQF
(joiningBBORDD
andBBORDH
) for matching records. -
Write to
BB802W
with additional fields: location, product, container, quantity, unit of measure, andw1oori = 'O'
. -
Aggregate Sales History Header Data:
- Read
SA5SHP
records matchingp$co
andp$csor
. -
Write to
BB802W
with fields: invoice number, ship date, tracking number, andw1oori = 'I'
. Update tow1oori = 'B'
if matching order exists. -
Aggregate Sales History Detail Data:
- If
p$pmov = 'Y'
, readBB802PQF
(joiningSA5MOVD
andSA5SHP
); else, readBB802FQF
(joiningSA5FILD
andSA5SHP
). -
Write to
BB802W
with additional fields: location, product, container, quantity, unit of measure, order process, andw1oori = 'I'
. Update tow1oori = 'B'
if matching order exists. -
Aggregate Canceled Order Header Data:
- Read
BB802HQF
(joiningBBCNH
andBBCNOR
) for matching records. -
Write to
BB802W
with fields: cancel reason, andw1oori = 'C'
. -
Aggregate Canceled Order Detail Data:
- Read
BB802IQF
(joiningBBCND
,BBCNH
, andBBCNOR
) for matching records. -
Write to
BB802W
with additional fields: location, product, container, quantity, unit of measure, cancel reason, andw1oori = 'C'
. -
Enrich with Ship-To Location:
- For each
BB802W
record, readSHIPTO
using:w1co
,w1cust
,w1ship
forw1ship
between001
–899
or900
–998
(if no order-specific record).w1co
,w1ord#
,999
forw1ship ≥ 900
if order-specific record exists.
-
Update
BB802W
withw1dstc
(city) andw1dsts
(state). -
Retrieve Accessorials/Marks (Optional):
- If
p$ship = '000'
, readBBORA1
andBBORDH
for order accessorials/marks. - If
p$ship ≠ '000'
, readBBSHSA1
andSHIPTO
for ship-to accessorials/marks. - Return data for display or further processing.
- If
Business Rules¶
- Data Scope: Queries open orders (
BBORDH
,BBORDD
), sales history (SA5SHP
,SA5FILD
/SA5MOVD
), canceled orders (BBCNH
,BBCND
,BBCNOR
), and accessorials/marks (BBORA1
,BBSHSA1
) based onp$co
andp$csor
. - Uniqueness: Ensures no duplicate
BB802W
records using keys (w1co
,w1cust
,w1ord#
,w1inv#
). - Origin Indicator:
w1oori = 'O'
: Open order.w1oori = 'I'
: Invoice (sales history).w1oori = 'C'
: Canceled order.w1oori = 'B'
: Combined order and invoice (updated inBB802E
,BB802F
,BB802P
).- Ship-To Logic:
- For
w1ship
between001
–899
, use customer-specific ship-to (w1co
,w1cust
,w1ship
). - For
w1ship
between900
–998
, prefer order-specific ship-to (w1co
,w1ord#
,999
) if available, else customer-specific. - Product Move: If
p$pmov = 'Y'
, processSA5MOVD
instead ofSA5FILD
for sales history details. - Accessorials/Marks:
- Order-level (
p$ship = '000'
): Retrieve fromBBORA1
and validate withBBORDH
. - Ship-to level (
p$ship ≠ '000'
): Retrieve fromBBSHSA1
and validate withSHIPTO
,ARCUST
. - File Overrides: Use
p$fgrp
('G' or 'Z') to select library (e.g.,GBBORDH
vs.ZBBORDH
). - Data Integrity: Clear
BB802W
records before writing to prevent residual data.
Calculations¶
- No explicit calculations are performed; the function aggregates and maps data fields directly.
- Date fields (e.g.,
w1sdat
,w1indt
) are copied as-is (e.g.,borqd8
,shimdy
). - Quantities (
w1qty
) and totals (w1tolo
,w1inva
,w1lovo
) are copied from source files without manipulation.