Comments (6)
@softmade-timobruentjen - thank you for the example. I've added it to the Wiki with some modifications: https://github.com/xlate/staedi/wiki/Writing-EDI-Data-(Simple)#edifact-example. Please take a look at how the composite elements are written. That may simplify your process. As always, please open up a new issue if you have any problems. Thanks
from staedi.
Havent´t seen so far. Is it possible for you to add an example to the wiki pages for a regular UN-EDIFACT Message like INVOIC? I stumbled to the code to get it running, maybe others won´t have to. I can send you my example to take it over to the wiki pages?
from staedi.
@softmade-timobruentjen - I would be happy to add to the wiki and if you have an example that would be great. Are you using a validation schema for INVOIC as well?
from staedi.
Well, i´ve use the one given by StAEDI. It was very strictly against errors ;-) in the EDIFACT Code.
Here is what i´ve done to get the main EDI Part running for INVOIC 96A Standard:
` // (1) Create an EDIOutputFactory
EDIOutputFactory factory = EDIOutputFactory.newFactory();
// (2) Optionally specify delimiters - here the given values are the same as default
factory.setProperty(EDIStreamConstants.Delimiters.SEGMENT, '\'');
factory.setProperty(EDIStreamConstants.Delimiters.DATA_ELEMENT, '+');
factory.setProperty(EDIStreamConstants.Delimiters.COMPONENT_ELEMENT, ':');
factory.setProperty(EDIStreamConstants.Delimiters.RELEASE, '?');
factory.setProperty(EDIStreamConstants.Delimiters.REPETITION, ' ');
// Write each segment on a new line
//factory.setProperty(EDIOutputFactory.PRETTY_PRINT, true);
// (3) Create an EDIStreamWriter. Any OutputStream may be used - here we are writing to a file
OutputStream stream = null;
try {
stream = new FileOutputStream("someFileNameYouPrefer");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
EDIStreamWriter writer = factory.createEDIStreamWriter(stream);
// (4) Start the interchange
writer.startInterchange();
// (5) Write the three segments necessary for the INVOIC (UNA, UNB, UNH)
writer.writeStartSegment("UNA").writeEndSegment();
writer.writeStartSegment("UNB");
writer.writeStartElement().writeElementData("UNOC");
writer.writeEmptyComponent().writeComponent("3");
writer.endElement();
writer.writeStartElement().writeElementData("0123456789012");
writer.writeEmptyComponent().writeComponent("14");
writer.endElement();
writer.writeStartElement().writeElementData("0123456789012");
writer.writeEmptyComponent().writeComponent("14");
writer.endElement();
writer.writeStartElement().writeElementData("200702");
writer.writeEmptyComponent().writeComponent("0734");
writer.endElement();
writer.writeStartElement().writeElementData("00000563").endElement();
writer.writeEndSegment();
writer.writeStartSegment("UNH");
writer.writeStartElement().writeElementData("0001").endElement();
writer.writeStartElement().writeElementData("INVOIC");
writer.writeEmptyComponent().writeComponent("D");
writer.writeComponent("96A");
writer.writeComponent("UN");
writer.writeComponent("EAN008");
writer.endElement();
writer.writeEndSegment();
//Begin Message BGM
writer.writeStartSegment("BGM");
writer.writeStartElement().writeElementData("380").endElement();
writer.writeStartElement().writeElementData("1676245").endElement();
writer.writeStartElement().writeElementData("9").endElement();
writer.writeEndSegment();
//From Here do further INVOIC related segments like DTM and so on
// (6) End the interchange
writer.endInterchange();
// (7) Close the EDIStreamWriter. This must be done to ensure the output is written
writer.close();`
from staedi.
Great Work, Thanks
from staedi.
Closing this issue for now due to lack of interest for EDIFACT interactive messages. This may be revisited in the future if there is interest.
from staedi.
Related Issues (20)
- write X12 file HOT 3
- Add support for obtaining enumeration title values from schema for the element_data HOT 1
- Resolve GitHub action warnings HOT 1
- Control reference and count validation inactive for X12 HOT 3
- Read X12 File Error HOT 6
- Support to Split mulitple GS into separate EDI files HOT 9
- Repetition Elements are not being correctly identified HOT 3
- Error reported when reading ANSI encoded txt file HOT 27
- Missing Mandatory Segments HOT 8
- Does enumerated elements really requires minLength and maxLength? HOT 12
- Reporting a vulnerability HOT 2
- How to apply relational condition in schema HOT 11
- X12 unexpected segment error occurred when first segment of loop is missing HOT 5
- Support multiple ISA segments in an X12 EDI file
- Validator should be reset at end of interchange
- titles for segments like BGN, ST, INS are not accessible in 834 EDI HOT 1
- Adding condition to writeSegment HOT 4
- Option to ignore repetition separator in the ST/SE segments HOT 8
- default decimal mark is point (.) when UNA segment is not present HOT 2
- HL Segment is not interpreted correctly by ReaderService HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from staedi.