I'm not familiar with EDIFACT, but just from the context I'd assume that
a) there is something on the other end that expects the data to be exactly in a specific format, which may not be documented correctly or in a language your devs can read,
b) the consequences of not getting it 100% right are expensive,
c) there are a lot of these "somethings", each potentially requiring their own format/special quirks for which the provider may have already built workarounds.
Is that the case? If so, trying to build anything yourself will be a nightmare, and my first approach would be to find something that handles this part and beat my data into it, even if it means using some fully-featured software package just for this feature.
The beauty of EDIFACT by the way, is that with enough time and effort it can get parsed and validated using any text processing tool at your disposal because everything is _rigorously_ specified by the UN.
For example I once had to do it with a set of specs, standard Linux text processing tools and a sprinkle of shell scripting for a school assignment.
a) there is something on the other end that expects the data to be exactly in a specific format, which may not be documented correctly or in a language your devs can read,
b) the consequences of not getting it 100% right are expensive,
c) there are a lot of these "somethings", each potentially requiring their own format/special quirks for which the provider may have already built workarounds.
Is that the case? If so, trying to build anything yourself will be a nightmare, and my first approach would be to find something that handles this part and beat my data into it, even if it means using some fully-featured software package just for this feature.