FBA Transit-Loss Replenishment Cost Streams to Stepwise Transfer-In: A Qeasy Hands-On Guide
What This Strategy Solves
In cross-border retail, FBA warehouses frequently incur "transit loss" — goods lost, damaged, or reconciled differently between domestic shipment and the Amazon warehouse. The source ERP records these events as cost streams under the type "FBA transit-loss replenishment" (business_types=11), while the target ERP expects a stepwise transfer-in document to post the entry properly.
It may look like a simple "stream → document" transformation, but the real headaches are cross-month extraction, deduplication by source document number, dynamic lookup of organizations and owners by warehouse, and readable document numbers. In one real engagement, we packaged this into a single schedulable strategy on the Qeasy data integration platform and ran it stably for three quarters.
Data Flow and Field Mapping
Flow: source ERP (cost stream API /cost/center/api/cost/stream) => Qeasy middleware layer => target ERP (batch save batchSave).
Key field mapping (desensitized):
| Business meaning | Source (source ERP) | Middleware | Target (target ERP) |
|---|---|---|---|
| Unique key | unique_key | Pass-through | Suffix of FBillNo |
| Document number | — | concat('FBA transit-loss','-',RIGHT(unique_key,12)) | FBillNo |
| Business type | business_types=11 | Filter condition | — |
| Date | stream_date | Pass-through | FDate |
| Stock-in org | wh_name | _findCollection lookup by name | FStockOrgID |
| Owner | wh_name | Reuse lookup result | FOwnerIdHead |
| Owner type | — | Fixed constant | FOwnerTypeIdHead=BD_OwnerOrg |
| Bill type | — | Metadata config | FBillTypeID |
The middleware does two jobs: resolve warehouse names into the target ERP's stock organization/owner IDs, and prefix the document number so finance can recognize a transit-loss-replenishment bill at a glance.
How to Configure on Qeasy
On the Qeasy strategy canvas, this strategy has three stages:
-
Source component: pick the "source ERP / cost stream" interface,
method=POST. Hard-codebusiness_types=11andquery_type=01(inventory action date) in the request body. Date range uses a_functionexpression to fetch "the 1st to the last day of the previous month". This is the on-site pattern we keep seeing — centralized code mapping, keeping type and date values at the source rather than re-translating them in the middle. -
Transform component: use Qeasy's field-mapping canvas for warehouse-name → org-ID lookup and document-number concatenation.
idCheck=trueandnumber=unique_keyensure the same stream never generates a duplicate transfer-in bill. -
Target component: the target ERP's
batchSave. Org IDs reference a warehouse-to-org mapping collection maintained inside Qeasy, and the owner type is hard-coded asBD_OwnerOrg.
Implementation Steps
We recommend a three-phase rollout:
- Phase 1 — incremental starting point. Set the crontab to manual trigger at month start to fetch the previous full month, and reconcile quantities and amounts on both sides. The source crontab is
5 17 8 8 * *, the target is5 20 8 8 * *(8th of each month). The target runs 3 hours later to leave time for extraction and dedup. - Phase 2 — full-volume trigger. Run continuously for 3 months, confirming each monthly transit-loss-replenishment stream lands as a 1:1 transfer-in bill in the target with a unique document number.
- Phase 3 — stable scheduling. Open the crontab for automatic monthly runs, enable Qeasy's exception alerts and rerun mechanism, and escalate manually when a save fails.
This is the typical "incremental + full-volume dual-track" pattern at customer sites: full validation during development, incremental only after go-live.
Pitfalls We Have Hit
- Cross-month extraction is dangerous. The source explicitly states "no cross-month" for
start_date/end_date. Use "the 1st to the last day of the previous month". Never shortcut to "the 1st of this month to today" — that day's data is not closed and will cause duplicates. - Do not hard-code org IDs. Stock organizations in the target ERP vary by tenant. Always use
_findCollectionby name, otherwise switching tenants breaks the entire pipeline. - Watch document-number length. We use
RIGHT(unique_key,12). One customer once tried the full string and hit length truncation onFBillNo, breaking month-end reconciliation. Truncating the last 12 characters is the safe choice — it preserves uniqueness while controlling length. - Stock org and owner are two separate systems. Beginners often conflate them. Here
FStockOrgIDandFOwnerIdHeadboth reference the same warehouse mapping, but their semantics differ — never merge them. - Mind the dependency order. This strategy depends on prior A-sequence (product) and B-sequence (supplier) master-data sync. If materials haven't synced first, the target ERP will reject the bill with "material does not exist".
When to Use and When Not to Use
Use when: a cross-border retail/manufacturing enterprise uses a source ERP as the front-end business system and a target ERP as the back-end finance/supply-chain system, and needs to settle monthly cost streams like transit-loss replenishment, over-receipt, or reconciliation adjustments as formal documents. Do not use when: the stream must post in near-real-time (minute-level); the source business type is not 11 — other transfer or inventory-counting scenarios require separate field mapping.