Functional documentation for the Aiden WMS sales return inbound mapper.
This document describes what happens after the mapper is installed: how a WMS sales return completion is enriched with SAP Business One (B1) return request data, which B1 document is posted (Returns or Credit Notes), and which field rules apply. It is intended for end-users and functional consultants.
1. Overview
|
|
|
|---|---|
|
Source |
Aiden WMS sales return / inbound return completion (Kafka) |
|
Enrichment |
SAP B1 Return Request ( |
|
Target |
SAP B1 Returns or Credit Notes (POST via Service Layer / Kafka) |
|
Purpose |
Confirm warehouse return receipt against open return request(s) in B1 |
After installation, when WMS finishes receiving a sales return, the integration:
-
Reads return request
DocEntryvalues from the WMS message -
Loads matching B1 return request line data
-
Maps WMS picked/saved quantities (serials, batches, plain lines, sales BOM) into B1 document lines
-
Posts either a Return or a Credit Note, depending on base type
Document type selection (runtime)
|
Condition |
B1 endpoint |
HTTP method |
|---|---|---|
|
First line |
|
POST |
|
Any other / missing BaseType |
|
POST |
Base type
13is the B1 object type for A/R Invoice. When the return is based on an invoice, WMS/B1 expect a credit note; otherwise a return document is posted against the return request (object type234000031in many line paths).
2. What the mapper uses as input
2.1 WMS message
Typical structure:
-
transaction.id— WMS transaction id (external application id +U_AEN_WMS_TRANSID) -
transaction.type/ dates — present on payload; type not used for endpoint routing in Java -
documents[]:-
businessPartner.businessPartnerId→ B1CardCode -
processDate→ B1DocDate -
customFields.externalId— B1 base document entry used on lines (BaseEntry) -
customFields.objectType— used in BaseType valuemap for some line paths -
customFields.DocEntry— Return Request DocEntry(s) used for B1 GET filter -
customFields.DocumentAdditionalExpenses[]— header expenses (map to B1 headerDocumentAdditionalExpenses) -
lines[]— planned/document lines (lineNum, salesBom, quantity, …) -
lines[].customFields.DocumentAdditionalExpenses[]— line expenses (WMS name); on B1 output these becomeDocumentLines[].DocumentLineAdditionalExpenses[] -
savedLines[]— actual received units (quantity, batch, serial, license, carrier, baseQuantity)
-
2.2 B1 Return Request enrichment (automatic)
Before mapping, the integration:
-
Splits
documents[]and collects eachcustomFields.DocEntry -
Builds an OData filter:
DocEntry eq <id>(or multipleorclauses for unique entries) -
GET
ReturnRequest?$select=DocEntry,DocNum,DocumentLines&$filter=… -
Stores the response as the second MapForce input
Business impact: return request documents must already exist in B1, and WMS must carry the correct customFields.DocEntry. Wrong/missing DocEntry yields empty enrichment and incomplete base-line matching (especially for BOM).
2.3 Correlation / monitoring
|
Value |
Source |
Use |
|---|---|---|
|
Integration message id |
Kafka key |
XIAM correlation |
|
External application id |
|
XIAM |
|
B1 |
|
Trace WMS tx on B1 document |
3. Business behavior
3.1 Header of each B1 document
For each WMS documents[] entry, the mapper produces a B1 document object with:
|
B1 field |
Source |
Rule |
|---|---|---|
|
|
|
Direct |
|
|
|
Direct |
|
|
|
Direct |
|
|
— |
Not mapped |
3.2 How lines are built
WMS savedLines drive quantities and tracking (serial/batch). They are matched to document lines (via documentLine / lineNum) and, for sales BOM, to Return Request lines (DocEntry, LineNum, VisualOrder).
MapForce emits several parallel DocumentLines expansions (clones), similar to other inbound goods mappers:
|
Expansion (logical) |
When |
Quantity |
Tracking |
|---|---|---|---|
|
Serial |
|
Sum of saved qty per base line |
|
|
Batch |
Batch present on saved line |
Sum of saved qty per base line |
|
|
Non batch/serial |
Residual path (no serial/batch tracking on that path) |
Aggregated qty |
No batch/serial blocks |
|
BOM articles |
Sales BOM structure + Return Request join |
Derived from WMS qty and BOM |
Expenses can still attach |
Base document references on lines (typical):
|
B1 line field |
Typical source |
|---|---|
|
|
WMS |
|
|
Matched document/return-request line number (group key / lineNum / VisualOrder+1 depending on path) |
|
|
Valuemap from |
3.3 BaseType valuemap (customFields.objectType)
Used on the serial (and related) path:
|
WMS |
B1 |
|---|---|
|
|
|
|
|
|
|
Other |
Passthrough / default input mode |
Many non-serial / BOM / expense base-type fields are forced to constant 234000031 (B1 Return Request object type), so returns against return requests keep a stable base type even when objectType valuemap does not apply.
3.4 Serial lines
-
Filter: serial number not equal to empty
-
Group-by document line; sum quantities
-
B1
SerialNumbers[].InternalSerialNumber← WMS serial -
B1
SerialNumbers[].Quantity← saved quantity (per serial row path) -
Line
Quantity← aggregated sum for that base line
3.5 Batch lines
-
Filter: batch number present (empty batch excluded from this path)
-
Group-by document line; sum quantities
-
B1
BatchNumbers[]:BatchNumber,ExpiryDate,Quantityfrom saved lines -
Line
Quantity← aggregated sum
3.6 Non batch/serial lines
-
Intermediate JSON path labeled for non-batch/serial units
-
BaseType often
234000031 -
Quantity from aggregated saved quantities without serial/batch sub-structures
3.7 Sales BOM lines
When WMS lines carry salesBom (parent, parentLine, singleQuantity, respectSingleQuantity):
-
Mapping joins B1 Return Request lines where:
-
Return request
DocEntrymatches WMS external/base document context -
Return request visual order context matches (
VisualOrder + 1compared to parent line, etc.)
-
-
Component quantities use singleQuantity and min/divide against WMS line quantities so BOM components stay consistent with kit structure
-
Output lines use Return Request base type
234000031on the BOM expansion
Consultant impact: Visual order and sales BOM flags on the original return request / WMS message must stay consistent. Broken parent/child links produce wrong component quantities or missing BOM lines.
3.8 Additional expenses
Header and line expenses use different B1 structures.
Header expenses from documents.customFields.DocumentAdditionalExpenses:
-
Copied to B1 document-level
DocumentAdditionalExpenses[] -
BaseDocEntry← WMSexternalId -
BaseDocLine← expenseLineNum -
BaseDocType← constant234000031(typical) -
ExpenseCode,LineTotal,GroupCode,DistributionMethod,VatGroupcopied
Line expenses from lines.customFields.DocumentAdditionalExpenses:
-
Attached on matching DocumentLines expansions (serial / batch / non-batch-serial / BOM) as B1
DocumentLineAdditionalExpenses[](not the header-shaped expense block) -
Mapped fields:
ExpenseCode,LineTotal,GroupCode,DistributionMethod,VatGroup -
No
BaseDocEntry/BaseDocLine/BaseDocTypeon line expenses (removed in the line-expense mapping) -
LineNumberexists on the output schema but is not mapped -
BaseGroupis only wired on the non-batch/serial path (from WMSGroupCode); serial, batch, and BOM line-expense paths do not mapBaseGroup
3.9 Packages
DocumentPackages exists on the output schema. In the current MapForce definition, package fields are largely not wired (no reliable license/carrier package generation like the goods-delivery mapper). Do not expect SSCC packages from this mapper unless the MFD is extended.
4. Field mapping tables
Columns: B1 target field | WMS / ReturnRequest source | What happens | Notes
4.1 Header
|
B1 target field |
WMS / source input |
What happens |
Notes |
|---|---|---|---|
|
|
|
Direct |
Customer |
|
|
|
Direct |
|
|
|
|
Direct |
Traceability |
|
|
— |
Not mapped |
|
|
Document endpoint |
|
|
Java routing, not MFD |
4.2 Document lines (common)
|
B1 target field |
WMS / source input |
What happens |
Notes |
|---|---|---|---|
|
|
|
Direct / join |
Base document |
|
|
lineNum / group key / VisualOrder+1 |
Match + transform |
Path-dependent |
|
|
|
Valuemap or constant |
See §3.3 |
|
|
|
Sum / min / divide |
Path-dependent |
4.3 Serials (conditional)
|
B1 target field |
WMS / source input |
What happens |
Notes |
|---|---|---|---|
|
Serial path used? |
|
Filter |
Empty serial → other path |
|
|
|
Direct |
|
|
|
saved line qty |
Direct / aggregate |
|
|
Line |
saved qtys |
Sum per base line |
|
4.4 Batches (conditional)
|
B1 target field |
WMS / source input |
What happens |
Notes |
|---|---|---|---|
|
Batch path used? |
|
Filter |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
saved qty |
Direct / aggregate |
|
|
Line |
saved qtys |
Sum per base line |
|
4.5 Sales BOM (conditional)
|
B1 target field |
WMS / ReturnRequest source |
What happens |
Notes |
|---|---|---|---|
|
BOM path used? |
|
Join on DocEntry / visual order |
Needs GET ReturnRequest |
|
Component |
WMS qty + |
min / divide logic |
Kit consistency |
|
|
— |
Often |
Return request |
4.6 Header additional expenses
Document-level B1 DocumentAdditionalExpenses[] (distinct from line-level DocumentLineAdditionalExpenses).
|
B1 target field |
WMS / source input |
What happens |
Notes |
|---|---|---|---|
|
|
Header expense |
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
expense |
Direct |
|
|
|
— |
Constant |
|
4.7 Line additional expenses
B1 target collection: DocumentLines[].DocumentLineAdditionalExpenses[].
WMS source collection: lines.customFields.DocumentAdditionalExpenses[] (name differs from B1 output).
|
B1 target field |
WMS / ReturnRequest source |
What happens |
Notes |
|---|---|---|---|
|
|
|
Attached on serial / batch / non-batch-serial / BOM expansions |
Output name ≠ WMS input name |
|
|
Line expense |
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
|
Direct |
|
|
|
— |
Not mapped |
Present on schema only |
|
|
WMS |
Copied only on non-batch/serial path |
Unwired on serial / batch / BOM |
|
|
— |
Not used on line expenses |
Header expenses still use BaseDoc* (see §4.6) |
5. Value translations (reference)
5.1 Endpoint routing
|
|
B1 POST endpoint |
|---|---|
|
|
|
|
Other / empty |
|
5.2 Object type → BaseType (valuemap)
|
WMS |
B1 |
|---|---|
|
|
|
|
|
|
|
Unlisted |
Default/input mode (passthrough) |
5.3 Return request object type constant
|
Constant |
Meaning in this mapper |
|---|---|
|
|
B1 Return Request object type — used as BaseType / BaseDocType on many return-request-based lines and expenses |
5.4 B1 GET
|
Setting |
Value |
|---|---|
|
Endpoint |
|
|
Select |
|
|
Filter |
|
6. What is not mapped / important omissions
|
Topic |
Behavior |
|---|---|
|
|
Not mapped |
|
Document packages / SSCC |
Schema present; not effectively mapped in current MFD |
|
Warehouse / bin on B1 return lines |
Not a primary mapped line attribute in this MFD (base-linked quantities dominate) |
|
Line expense |
On |
|
Line expense |
Only on non-batch/serial expansion (from |
|
Line expense BaseDoc* |
Not mapped on line expenses (unlike header |
|
Scenario samples |
|
|
Endpoint choice |
Driven only by first document’s first line |
|
Credit note vs return content |
Same MapForce mapping; only the Service Layer endpoint changes |
7. End-to-end expectation (happy path)
-
WMS completes a sales return receipt and publishes a message with
savedLinesand return requestDocEntry. -
Integration GETs B1 Return Request line data.
-
Mapper builds B1 document(s): customer, date, WMS transaction id, lines with base refs, serials/batches/BOM as applicable, expenses.
-
If first line BaseType is
13→ POST CreditNotes; else POST Returns. -
Support uses
U_AEN_WMS_TRANSID/transaction.idand base document refs for reconciliation.
8. Example (illustrative shape)
Scenarios in-repo are placeholders. Expected shape from MFD + runtime:
WMS input (conceptual)
|
Field |
Example |
|---|---|
|
|
|
|
BP |
|
|
|
|
|
|
Return request |
|
|
Base doc entry as used for BaseEntry |
|
|
empty/ |
|
|
Qty + optional serial/batch |
B1 output (conceptual)
|
Field |
Example |
|---|---|
|
Endpoint |
|
|
|
|
|
|
process date |
|
|
|
|
Lines |
BaseEntry/BaseLine/BaseType + Quantity; serial and/or batch children as received |
|
Header expenses |
|
|
Line expenses |
|
9. Implementation checklist for consultants
-
Return requests exist in B1 before WMS confirmation.
-
WMS sends correct
customFields.DocEntry(return request) andexternalId/ line numbers for base linking. -
Set
lines[].customFields.BaseType = 13when the business case must post a Credit Note; otherwise expect Returns. -
For serial/batch items, populate
savedLinesserial/batch/expiry completely. -
For sales BOM, keep
salesBomand return-request VisualOrder consistent. -
Use
transaction.id/U_AEN_WMS_TRANSIDfor support. -
Do not expect package/SSCC generation from this mapper today.
-
Validate header expenses (
DocumentAdditionalExpenses) and line expenses (DocumentLineAdditionalExpensesfrom WMS lineDocumentAdditionalExpenses) if freight must copy to the B1 return/credit note.
10. Source artifacts (for reference)
|
Artifact |
Role |
|---|---|
|
|
MapForce mapping (field logic) |
|
|
WMS input contract |
|
|
ReturnRequest enrichment schema (naming historical) |
|
|
B1 Returns/CreditNotes-shaped output |
|
|
Kafka, BaseType routing, mapper |
|
|
GET ReturnRequest |
|
|
DocEntry filter aggregation |
|
|
MapForce (WMS + return body) |
|
|
Placeholder samples |
Generated from the mapping definition and integration behavior in this project. If the MapForce mapping or routing changes, this document should be reviewed and updated.
Maintaining this document
For the original documentation intent, when to update, source-of-truth checklist, and a ready-made refresh prompt, see README.md and the repository AGENTS.md.