METHOD07 - Count Method
Overview
The Count Method uses existing handling unit data from document detail lines or warehouse activities instead of calculating handling unit quantities. This method is useful when handling units have already been assigned or created in the system and you want to count them.
Purpose
This method calculates the Expected Shipment Handling Unit Qty. by:
- Counting handling units from document detail lines (if available)
- Counting handling units from warehouse activities (if available)
- Using different counting methods based on configuration
- Falling back to default calculation if no existing data is found
Parameters
| Parameter Name | Type | Description | Default |
|---|---|---|---|
COUNT UNIQUE CARR |
Boolean | If true, count all handling units (including duplicates); if false, count only unique handling units | false |
COUNT METHOD |
Integer | Counting method: 0=Unique Handling Units (Document), 1=Unique Handling Units (Line), 2=Detail Lines | (empty) |
SKIP DFLT CARRIER |
Boolean | Skip default handling unit quantity calculation if no existing data found | false |
SET CARRIER QUANTITY |
Boolean | Set Handling Unit Quantity if Result = 0 (requires SKIP DFLT CARRIER = true) | false |
Algorithm
Step 1: Initialize Counting
Initialize the result counter and temporary handling unit tracking.
Step 2: Count from Document Detail Lines
If detail lines exist for the document line:
If COUNT METHOD = 0 (Unique Handling Units - Document level):
- Count unique handling units that haven't appeared in previous document lines
- For each detail line handling unit:
- Check if handling unit already counted in previous lines
- If not, add to count
If COUNT METHOD = 1 (Unique Handling Units - Line level):
- Count unique handling units within the current document line only
- Each unique handling unit number counts as 1
If COUNT METHOD = 2 (Detail Lines):
- Count all detail lines (one handling unit per detail line)
- Simple count of detail line records
Step 3: Count from Warehouse Activities
If warehouse activities exist for the document line:
Apply the same counting method (0, 1, or 2) as used for detail lines.
Step 4: Handle Zero Result
If result = 0 after counting:
If SKIP DFLT CARRIER = false:
- If no detail lines AND no activities exist:
- Calculate using METHOD06 (Simple Calculation)
- Use this as the result
If SKIP DFLT CARRIER = true:
- If SET CARRIER QUANTITY = true:
- Set
DocumentLine."Handling Unit Quantity"as the result
- Set
- Else:
- Return 0
Calculation Steps
Counting Methods Explained
Method 0: Unique Handling Units (Document)
- Counts handling units that are unique across the entire document
- A handling unit that appears in multiple lines is counted only once
- Checks previous lines to avoid double-counting
Method 1: Unique Handling Units (Line)
- Counts unique handling units within the current document line only
- Each unique handling unit number counts as 1
- Does not check previous lines
Method 2: Detail Lines
- Simple count of detail line records
- Each detail line = 1 handling unit
- No uniqueness check
Examples
Example 1: Count Unique Handling Units (Document Level)
Scenario:
- Document has 3 lines
- Line 1: Handling Units A, B
- Line 2: Handling Units B, C (B already counted)
- Line 3: Handling Unit D
- COUNT METHOD = 0
Calculation:
- Line 1: Count A, B → 2 handling units
- Line 2: Count C only (B already counted) → 1 handling unit
- Line 3: Count D → 1 handling unit
- Total: 2 + 1 + 1 = 4 unique handling units
Result: 4 handling units
Example 2: Count Unique Handling Units (Line Level)
Scenario:
- Document line has detail lines with handling units: A, B, B, C
- COUNT METHOD = 1
Calculation:
- Unique handling units in line: A, B, C
- Count: 3 handling units
Result: 3 handling units
Example 3: Count All Detail Lines
Scenario:
- Document line has 5 detail lines
- COUNT METHOD = 2
Calculation:
- Count all detail lines: 5 handling units
Result: 5 handling units
Example 4: Fallback to Default Calculation
Scenario:
- No detail lines exist
- No warehouse activities exist
SKIP DFLT CARRIER= falseQuantity= 100 piecesCarrierTypeUOM."Qty. per UOM Code"= 50 pieces per handling unit
Calculation:
- No existing data found
- Fallback to METHOD06 calculation: 100 / 50 = 2 handling units
Result: 2 handling units
Example 5: Use Handling Unit Quantity Field
Scenario:
- No detail lines exist
SKIP DFLT CARRIER= trueSET CARRIER QUANTITY= trueDocumentLine."Handling Unit Quantity"= 3
Calculation:
- No existing data found
- Use handling unit quantity field: 3 handling units
Result: 3 handling units
Important Notes
- This method relies on existing handling unit data in the system
- If no data exists, it can fall back to calculation or use the handling unit quantity field
- The counting method determines how handling units are counted (unique vs. all)
- Handling Unit Stack ID is considered when checking for uniqueness
- Warehouse activities are checked in addition to detail lines