Hi Diane,
EDI contains the segment UNH contains the count of no of segment in the EDI file.
UNT M(1) : Message trailer
A service segment ending a message, giving the total number of segments in the message (including the UNH & UNT) and the control reference number of the message.
you need to provide the count in source (other then EDI) to EDI mapping. for this you need to use the function provide by SAP with B2B add on. please refer the below links for more details
The new B2B Add-On for SAP NetWeaver Process Integration
regards,
Harish