EDIFACT UNA
You don't have to explicitly generate UNA segment. EdifactWriter will automatically detect if the separators are different than the default and will write the final message with the correct UNA.
If you want to write UNA explicitly then use the Write() overload which takes UNA as a parameter.
To create a UNA, you can either manually populate it, or use the ToUna() method of the Separators object.
EDIFACT UNA Specification
EDIFACT UNA specification is available at:
EDI Tools for .NET C# Examples
The example below is part of the EDI Tools for .NET C# Code Examples.
How to generate EDIFACT UNA with EDI Tools for .NET
var invoice = EdifactTransactionBuilders.BuildInvoice("1");
using (var stream = new MemoryStream())
{
using (var writer = new EdifactWriter(stream))
{
// Set a custom segment separator
var separators = new Separators('|',
Separators.Edifact.ComponentDataElement,
Separators.Edifact.DataElement,
Separators.Edifact.RepetitionDataElement,
Separators.Edifact.Escape);
// Write custom UNA
writer.Write(separators.ToUna());
// Write the UNB with the custom separator set
writer.Write(SegmentBuilders.BuildUnb("1"), separators);
writer.Write(invoice);
}
}
Comments
0 comments
Please sign in to leave a comment.