Sterling B2B Integration

Sterling B2B Integration

Come for answers, stay for best practices. All we're missing is you.

 View Only

From Errors to EDI 810: The TDS, Decimal & Mapping Mistakes That Cost Me Hours And How I Fixed Them

By Shanmuga Sundari Palani posted 04/17/26 08:12 AM

  

Before diving into the technical challenges, let’s start with a quick overview. A Map Editor is a tool used to transform data from one format to another, commonly from structured formats like XML, CSV/Excel, flat files into standard EDI documents such as ANSI X12, EDIFACT and vice versa (EDI to XML/flat file). In real world integrations, input data can come in various forms, including JSON, CXML, EDI or even PDFs. This data is typically converted into a structured XML format, which is the most commonly used format, and then defined using an XSD (XML Schema Definition) to establish the input structure. Once the schema is in place, the mapping process begins, where each element from the input is transformed into the required EDI output format. In this article, I’ll walk through a practical scenario where I converted an XML invoice into an EDI 810 document and the real issues I encountered along the way.

A Practical Implementation: XML Invoice to EDI 810

My input was an XML file structured according to the following schema.

image 1
Simple XML. However, converting this into a proper EDI 810 output involved significant troubleshooting. Here is every problem I hit and how I fixed it.

Problem 1: Mandatory Block Missing The TDS Segment

When I ran my first test translation, the map compiled fine but the translation report showed:

image

TDS is the Total Dollar Summary segment in EDI 810. The standard map has it set as mandatory by default. My input XML had no total field just individual amounts per service.

Later, I understood that Sterling first checks the structure. It verifies whether a mandatory segment like TDS has a proper mapping to generate output. Since I didn’t map it initially, the system threw the error even before running the accumulator logic. I tried to make TDS optional by changing the field inside it. That did nothing. The segment itself was still mandatory.

The fix: You need to change the segment, not the field.

  • Right click the TDS segment in the output tree
  • Properties → Looping tab
  • Change Minimum from 1 to 0

Problem 2: Line Number Counter Using Accumulator

My output needed IT1-01 to be a line number 1, 2, 3 for each service. But my XML had no line number field. I needed to generate it automatically.The solution is an Accumulator Sterling's built in counter.

  1. Click IT1-01 field → Properties → Standard Rule tab
  2. Select Use Accumulator
  3. Click New to create an accumulator entry
  4. Set:
    • Primary Accumulator: 0
    • Name: LineCounter
    • First operation: Increment primary
  5. Click New again for a second entry:
    • Primary Accumulator: 0
    • First operation: Use the primary accumulator

Important: You need both entries. Increment adds 1 to the counter. Use outputs the current value. Without both, nothing appears.
Second important thing: My IT1-01 was outputting 1.0, 2.0, 3.0 instead of 1, 2, 3. This is
because the field format was set to Real (decimal). Fix it by going to IT1-01 →
Properties → Validation tab → change format from R to N0.

image

Problem 3: Handling Tax and Discount — TXI and SAC Segments

I had both Tax and Discount in my XML. My first instinct was to put both in TXI segments. But there is an important difference:

  • TXI (Tax Information): Use this strictly for tax amounts
  • SAC (Service, Promotion, Allowance or Charge): Use this for discounts, allowances, or surcharges

So the correct mapping is:

  • Tax → TXI-02 (with TXI-01 hardcoded as GS)
  • Discount → SAC-05 (with SAC-01 hardcoded as A and SAC-02 hardcoded as D240)

In my XML there was no discount code field just the discount amount. So I hardcoded SAC-01 and SAC-02 as constants and only mapped the amount from XML.

Problem 4: The Decimal N2 vs N0

My output was showing:

image
SAC*A*D240***500~
Instead of:
SAC*A*D240***5~
The discount value 5 was becoming 500. The tax value 10 was becoming 1000.
The cause: SAC-05 field format was set to N2 which means 2 implied decimal places. Sterling interprets 5 as 0.05 and then outputs it as 500 in the EDI format.
The fix:
  • Click SAC-05 → Properties → Validation tab
  • Change format from N2 to N0
  • Click OK

N0 means no implied decimals. Your value 5 outputs as 5. Always check this when amounts look wrong in your output.

Same issue can happen on IT1-04 for unit price. Check every amount field's format in the Validation tab.

image

Testing the Map: Moving from Design to Execution

Once the visual mapping is finished, the next step is testing. When you save your work in the IBM Sterling Map Editor, you are actually managing two different types of files:

  • The .mxl File (Source): This is the file you see on your screen. It contains all the loops, extended rules, constants, and structures. It is human readable, but it is not executable. You can think of this as your "source code."
  • The .txo File (Compiled): To make the map run, you have to compile it. Compiling turns your .mxl into a .txo file. This is the machine readable version that the Sterling B2B Integrator engine actually uses to process data.

The "Pre Flight" Check

Before you ever upload a map to the server, you should always run a local test within the Map Editor.

When you run a test, the editor generates a Translation Report.

  • Warnings: These usually tell you if there is a data mismatch (like a field being too short for the data).
  • Errors: These will stop the translation entirely. They often point to mandatory fields being empty or loop keys that don't match.

In my case, even though the map compiled successfully, the output initially showed errors related to missing mandatory segments. By analyzing the report and output together, I was able to identify issues in structure and mapping, make the necessary fixes, and re run the test until the output matched the expected EDI format.

image

Final Thoughts

Mapping in IBM Sterling isn't just about connecting dots. It’s about looking at a raw file and seeing the layers underneath. Whether you are fixing a date format or building a complex nested loop, the goal is always the same: Clean, repeatable, and accurate data.

0 comments
18 views

Permalink