Module edifact.d03a.shipping
ballerinax/edifact.d03a.shipping 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 34 UN/EDIFACT D03A messages grouped under shipping: container announcement, release, gate-in/gate-out, discharge/loading and stuffing/stripping messages, bayplan and stowage plans, equipment stock and special handling orders, customs declarations, cargo reports and responses, and contract tendering and valuation messages.
Key Features
- Typed records for all 34 messages in the shipping 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.shipping 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.shipping; import ballerinax/edifact.d03a.shipping.mBAPLIE;
Step 2: Read an EDI message
Convert an EDIFACT interchange into a Ballerina record.
public function main() returns error? { string ediText = check io:fileReadString("baplie.edi"); mBAPLIE:EDI_BAPLIE_BAPLIE message = check shipping:fromEdiString(ediText, shipping:EDI_BAPLIE).ensureType(); io:println(message); }
shipping: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 shipping:toEdiString(message, shipping:EDI_BAPLIE);
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 |
|---|---|---|
BAPLIE | Bayplan/stowage plan occupied and empty locations | edifact.d03a.shipping.mBAPLIE |
COACSU | Commercial account summary | edifact.d03a.shipping.mCOACSU |
COARRI | Container discharge/loading report | edifact.d03a.shipping.mCOARRI |
CODECO | Container gate-in/gate-out report | edifact.d03a.shipping.mCODECO |
CODENO | Permit expiration/clearance ready notice | edifact.d03a.shipping.mCODENO |
COEDOR | Transport equipment stock and profile report | edifact.d03a.shipping.mCOEDOR |
COHAOR | Container special handling order | edifact.d03a.shipping.mCOHAOR |
COLREQ | Request for a documentary collection | edifact.d03a.shipping.mCOLREQ |
COMDIS | Commercial dispute | edifact.d03a.shipping.mCOMDIS |
CONAPW | Advice on pending works | edifact.d03a.shipping.mCONAPW |
CONDPV | Direct payment valuation | edifact.d03a.shipping.mCONDPV |
CONDRA | Drawing administration | edifact.d03a.shipping.mCONDRA |
CONDRO | Drawing organisation | edifact.d03a.shipping.mCONDRO |
CONEST | Establishment of contract | edifact.d03a.shipping.mCONEST |
CONITT | Invitation to tender | edifact.d03a.shipping.mCONITT |
CONPVA | Payment valuation | edifact.d03a.shipping.mCONPVA |
CONQVA | Quantity valuation | edifact.d03a.shipping.mCONQVA |
CONRPW | Response of pending works | edifact.d03a.shipping.mCONRPW |
CONTEN | Tender | edifact.d03a.shipping.mCONTEN |
CONWQD | Work item quantity determination | edifact.d03a.shipping.mCONWQD |
COPARN | Container announcement | edifact.d03a.shipping.mCOPARN |
COPAYM | Contributions for payment | edifact.d03a.shipping.mCOPAYM |
COPINO | Container pre-notification | edifact.d03a.shipping.mCOPINO |
COPRAR | Container discharge/loading order | edifact.d03a.shipping.mCOPRAR |
COREOR | Container release order | edifact.d03a.shipping.mCOREOR |
COSTCO | Container stuffing/stripping confirmation | edifact.d03a.shipping.mCOSTCO |
COSTOR | Container stuffing/stripping order | edifact.d03a.shipping.mCOSTOR |
CUSCAR | Customs cargo report | edifact.d03a.shipping.mCUSCAR |
CUSDEC | Customs declaration | edifact.d03a.shipping.mCUSDEC |
CUSEXP | Customs express consignment declaration | edifact.d03a.shipping.mCUSEXP |
CUSPED | Periodic customs declaration | edifact.d03a.shipping.mCUSPED |
CUSREP | Customs conveyance report | edifact.d03a.shipping.mCUSREP |
CUSRES | Customs response | edifact.d03a.shipping.mCUSRES |
VESDEP | Vessel departure | edifact.d03a.shipping.mVESDEP |