Module edifact.d03a.supplychain
ballerinax/edifact.d03a.supplychain Ballerina library
Overview
UN/EDIFACT D03A Supply Chain group EDI parser: reads and writes the 29 messages covering purchase orders, changes and responses, delivery schedules and just-in-time calls, despatch and receiving advices, inventory and order status reports, party information, documentary credit messages, cargo insurance claims, and superannuation messages.
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.
Key Features
- Typed records for all 29 messages in the supplychain 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.supplychain 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.supplychain; import ballerinax/edifact.d03a.supplychain.mORDERS;
Step 2: Read an EDI message
Convert an EDIFACT interchange into a Ballerina record.
public function main() returns error? { string ediText = check io:fileReadString("orders.edi"); mORDERS:EDI_ORDERS_ORDERS message = check supplychain:fromEdiString(ediText, supplychain:EDI_ORDERS).ensureType(); io:println(message); }
supplychain: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 supplychain:toEdiString(message, supplychain:EDI_ORDERS);
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 |
|---|---|---|
APERAK | Application error and acknowledgement | edifact.d03a.supplychain.mAPERAK |
DELFOR | Delivery schedule | edifact.d03a.supplychain.mDELFOR |
DELJIT | Delivery just in time | edifact.d03a.supplychain.mDELJIT |
DESADV | Despatch advice | edifact.d03a.supplychain.mDESADV |
DESTIM | Equipment damage and repair estimate | edifact.d03a.supplychain.mDESTIM |
DMSTAT | Data maintenance status report/query | edifact.d03a.supplychain.mDMSTAT |
DOCADV | Documentary credit advice | edifact.d03a.supplychain.mDOCADV |
DOCAMA | Advice of an amendment of a documentary credit | edifact.d03a.supplychain.mDOCAMA |
DOCAMI | Documentary credit amendment information | edifact.d03a.supplychain.mDOCAMI |
DOCAMR | Request for an amendment of a documentary credit | edifact.d03a.supplychain.mDOCAMR |
DOCAPP | Documentary credit application | edifact.d03a.supplychain.mDOCAPP |
DOCARE | Response to an amendment of a documentary credit | edifact.d03a.supplychain.mDOCARE |
DOCINF | Documentary credit issuance information | edifact.d03a.supplychain.mDOCINF |
ICSOLI | Insurance claim solicitor's instruction | edifact.d03a.supplychain.mICSOLI |
IFTICL | Cargo insurance claims | edifact.d03a.supplychain.mIFTICL |
IFTSTQ | International multimodal status request | edifact.d03a.supplychain.mIFTSTQ |
INVRPT | Inventory report | edifact.d03a.supplychain.mINVRPT |
ORDCHG | Purchase order change request | edifact.d03a.supplychain.mORDCHG |
ORDERS | Purchase order | edifact.d03a.supplychain.mORDERS |
ORDRSP | Purchase order response | edifact.d03a.supplychain.mORDRSP |
OSTENQ | Order status enquiry | edifact.d03a.supplychain.mOSTENQ |
OSTRPT | Order status report | edifact.d03a.supplychain.mOSTRPT |
PARTIN | Party information | edifact.d03a.supplychain.mPARTIN |
RECADV | Receiving advice | edifact.d03a.supplychain.mRECADV |
RECECO | Credit risk cover | edifact.d03a.supplychain.mRECECO |
STLRPT | Settlement transaction reporting | edifact.d03a.supplychain.mSTLRPT |
SUPCOT | Superannuation contributions advice | edifact.d03a.supplychain.mSUPCOT |
SUPMAN | Superannuation maintenance | edifact.d03a.supplychain.mSUPMAN |
SUPRES | Supplier response | edifact.d03a.supplychain.mSUPRES |