Error when trying to validate EDI message against the schema: [29] Invalid count specified at the interchange, group or message level

Posted: July 10, 2012  |  Categories: BizTalk EDI

As I mentioned in my last post, when we are in the development phase of a BizTalk project is normal to validate test instances of messages that are provided with respective schemas before we make final tests, the same happens when we are dealing with EDI (EDIFACT) messages.

When we perform this validation, we can detect if some enumerators in the existing EDI Schema contain all admissible values, or if your partner has some values customized and we have to reflect them in the schema.

Another common problem when we are trying to validate dummy EDI message, provided by our partners, against the schema using Visual Studio is:

” Invoking component…
C:\TestFiles\myEDIsample.txt: error BEC2004: Non Segment level : [29] Invalid count specified at interchange, group or message level“.

This is a very basic mistake and usually, occurs when dummy messages are delivered to us for testing.

Sample message:

UNA:+,?*'
UNB+UNOB:1+UNB2.1+UNB3.1+012301:0123+UNB5'
UNH+1000100+ORDERS:D:93A:UN:EAN007'
BGM+220+01521710'
DTM+137:120530:101'
DTM+64:120604:101'
DTM+63:120004:101'
FTX+AAI+++SOME TEXT'
FTX+AAI+++SOME TEXT'
FTX+AAI+++SOME TEXT'
NAD+BY+8000000001164::9'
NAD+DP+8000000009463::9'
NAD+IV+8000000013002::9'
NAD+SU+8000001459008::9'
NAD+PR+8000000016003::9'
LIN+1++4001518722937:EN'
PIA+1+00:PV+14001518722937:EN'
IMD+F+M+:::SOME DESCRIPTION'
QTY+21:52'
LIN+2++5000014010034:EN'
PIA+1+00:PV+15701014010031:EN'
IMD+F+M+:::SOME DESCRIPTION'
QTY+21:152'
LIN+3++5000014016142:EN'
PIA+1+00:PV+15701014016149:EN'
IMD+F+M+:::SOME DESCRIPTION'
QTY+21:304'
LIN+4++5006879009752:EN'
PIA+1+00:PV+15776879009759:EN'
IMD+F+M+:::SOME DESCRIPTION'
QTY+21:720'
UNS+S'
UNT+30+1000100'
UNZ+1+UNB5'

Cause

This error is a notification that the number of groups, messages, or segments don’t match the number given in the UNZ, UNE, UNT, or UST segment; or that the length of an object or the length of encrypted data is not equal to the length stated in the UNO, UNP, USD, or USU segment, i.e., the control count does not match number of instances received.

UNT Segment: UNT is the Message Trailer segment of an EDIFACT document. The UNT segment elements provide information about the number of segments in a message and the reference number for the message. This segment indicates the end of a document.

The following table lists the mandatory elements that the UNT segment contains:

  • Number of Segments in the Message: This element contains the total number of segments in the message.
  • Message Reference Number: This element contains a unique reference number for the message assigned by the sender. This number must be unique to the functional group and must match the Message Reference Number in the UNH Segment.

So the problem is that in the sample message the Number of Segments in the Message in UNH segment is 30 and the message has in fact 31 (starting counting from the UNH segment up to UNT segment).

Solution

You have to change the Number of Segments in the Message element in UNT segment so that contains the correct number of groups, messages, or segments, in this case, 31.

Other interesting resources:

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top