
Need help with field mapping in custom dmc
Hi everyone,
I am building a custom DMC object using a standard bapi and facing an issue with field mapping in LTMOM.
My source structure is a flat structure containing 15 quantity/UOM fields in a single source row, and I need to map them into a repeating target structure as 15 individual target rows.
Requirement example:
Source:
- 1 row
- Fields like ADD_QTY1...ADD_QTY15 and UOM1...UOM15
Target:
- Repeating target node
- 15 separate rows generated from the single source row
To achieve this, in the target structure mapping I defined:
- Relation type = Split
- Target occurrences = 15
Then in field mapping, for the target quantity field, I created a custom rule with a CASE statement based on "sy-index" to map the corresponding source field.
Example idea:
- sy-index = 1 → ADD_QTY1
- sy-index = 2 → ADD_QTY2
- etc.
However, "sy-index" always seems to point to the first occurrence only, and the output becomes:
- 15 target rows generated correctly
- but the same value repeats in all rows
I also tried:
- using a global variable as a counter in Global Data section
- passing sy-index via importing parameters
- structure-level rules
but either the variable is not accessible inside the rule, or the result is still repetitive.
Constraints:
- I cannot redesign/change the source structure
- Source must remain flat
How can I achieve this ? Pls help 🙏
Attaching mapping screenshot for reference.