Module edifact.d03a.manufacturing
ballerinax/edifact.d03a.manufacturing Ballerina library
Overview
UN/EDIFACT is the United Nations standard for electronic data interchange, used to exchange business documents such as orders, invoices and despatch advices between trading partners.
This package provides Ballerina record types and parser functions for the 17 UN/EDIFACT D03A messages grouped under manufacturing: product service and project task planning, quality and safety/hazard data, utilities master data and time series, metered services consumption, repair calls, in-transit reports, and accounting entries and statements of account.
Key Features
- Typed records for all 17 messages in the manufacturing group, each in its own submodule, so a program only pulls in the records for the messages it handles.
- Envelope-aware parsing and serialization: an interchange is read from
UNBthroughUNZ, including theUNH/UNTmessage header and trailer. - Round-trips in both directions — EDI text to records, and records back to
conformant EDI text with the
UNTsegment count recomputed. - Generated from the UN/EDIFACT D03A directory with the Ballerina EDI tool, so the records follow the published specification.
Quickstart
To use the edifact.d03a.manufacturing package in your Ballerina application, modify the .bal file as follows:
Step 1: Import the module
Import the package and the submodules for the messages you handle.
import ballerina/io; import ballerinax/edifact.d03a.manufacturing; import ballerinax/edifact.d03a.manufacturing.mCNTCND;
Step 2: Read an EDI message
Convert an EDIFACT interchange into a Ballerina record.
public function main() returns error? { string ediText = check io:fileReadString("cntcnd.edi"); mCNTCND:EDI_CNTCND_CNTCND message = check manufacturing:fromEdiString(ediText, manufacturing:EDI_CNTCND).ensureType(); io:println(message); }
manufacturing:getEDINames() returns every message name this package
supports. interchangeFromEdiString gives access to the full UNB/UNZ
interchange, and headersFromEdiString reads just the headers.
Step 3: Write an EDI message
Convert a Ballerina record back into an EDIFACT interchange.
string ediText = check manufacturing:toEdiString(message, manufacturing:EDI_CNTCND);
Use interchangeToEdiString to write the full interchange rather than the
message body alone.
Step 4: Run the Ballerina application
bal run
Supported messages
| Message | Description | Module |
|---|---|---|
CNTCND | Contractual conditions | edifact.d03a.manufacturing.mCNTCND |
DMRDEF | Data maintenance request definition | edifact.d03a.manufacturing.mDMRDEF |
ENTREC | Accounting entries | edifact.d03a.manufacturing.mENTREC |
IMPDEF | EDI implementation guide definition | edifact.d03a.manufacturing.mIMPDEF |
INFENT | Enterprise accounting information | edifact.d03a.manufacturing.mINFENT |
ITRRPT | In transit report detail | edifact.d03a.manufacturing.mITRRPT |
MSCONS | Metered services consumption report | edifact.d03a.manufacturing.mMSCONS |
PROSRV | Product service | edifact.d03a.manufacturing.mPROSRV |
PROTAP | Project tasks planning | edifact.d03a.manufacturing.mPROTAP |
QALITY | Quality data | edifact.d03a.manufacturing.mQALITY |
RELIST | Reinsured objects list | edifact.d03a.manufacturing.mRELIST |
RPCALL | Repair call | edifact.d03a.manufacturing.mRPCALL |
SAFHAZ | Safety and hazard data | edifact.d03a.manufacturing.mSAFHAZ |
STATAC | Statement of account | edifact.d03a.manufacturing.mSTATAC |
UTILMD | Utilities master data | edifact.d03a.manufacturing.mUTILMD |
UTILTS | Utilities time series | edifact.d03a.manufacturing.mUTILTS |
WASDIS | Waste disposal information | edifact.d03a.manufacturing.mWASDIS |