840 Request for Quotation (007030)

This is the standard X12 007030 spec, with 22 loops and 161 segment positions, as OpenEDI JSON, an ediFabric C# template and an ediFabric Native model. To change it for a trading partner, customize it in the EDI Spec Builder.

Loading the spec…
The spec as an OpenAPI 3 schema with x-openedi-* extensions, for ediFabric Native, ediFabric Cloud and the EDI Spec Builder. Download OpenEDI (209 KB) Generate classes
The ediFabric .NET template, class TS840. It needs the common segments, composites and codes of X12 007030, one download for every transaction in the version. Download C# (2 KB) Common files (232 KB)
The intermediary model ediFabric Native loads with set_map. Download Native (165 KB)

Use the 840 spec in your code

ediFabric .NET

Add the C# template and its common files to your project, or reference the template NuGet package, and read 840 files into TS840 objects. See ediFabric .NET.

ediFabric Native

Map version 007030 to the Native model with set_map, then parse 840 files to JSON from Python, Java, C or C#. See Convert between EDI and JSON.

OpenEDI

Select Customize in Spec Builder to copy the spec under your own name, change it for your partner, and parse files against it in EdiNation, ediFabric Native or ediFabric Cloud. Read about OpenEDI.

Generate 840 classes in Python, Java, Node.js, Go, Rust or C

ediFabric Native returns each 840 as JSON, with the property names of the OpenEDI schema. To work with that JSON as typed objects, generate classes from the OpenEDI file in your language and deserialize the JSON into TS840. Serialize the objects back to JSON to build EDI with ediFabric Native. The classes keep the loops, segments, lengths and code lists, but not the EDI data formats, so validate files with ediFabric Native. Read more in Generate a class from OpenEDI.

Python: datamodel-code-generator. Node.js: openapi-typescript. Java, Go, Rust and C: OpenAPI Generator.

840 structure

Loops and segments of the standard 840, with their usage and maximum repeats.

IDNameUsageMax use
STTransaction Set HeaderMandatory1
BQTBQTMandatory1
CURCUROptional1
INCINCOptional1
REFREFOptional99999
PERPEROptional3
TAXTAXOptional3
FOBFOBOptional99999
CTPCTPOptional99999
PAMPAMOptional10
CSHCSHOptional25
SACSACOptional25
ITDITDOptional99999
DISDISOptional20
DTMDTMOptional10
LINLINOptional5
PIDPIDOptional200
MEAMEAOptional40
PWKPWKOptional25
PKGPKGOptional200
TD1TD1Optional2
TD5TD5Optional12
TD3TD3Optional12
TD4TD4Optional5
MANMANOptional10
RRARRAOptional100
CTBCTBOptional99999
Loop LDTLDTOptional99999
LDTLDTMandatory1
QTYQTYOptional99999
MTXMTXOptional99999
Loop N9N9Optional1000
N9N9Mandatory1
DTMDTMOptional99999
MTXMTXOptional99999
PWKPWKOptional99999
EFIEFIOptional99999
Loop N1N1Optional10000
N1N1Mandatory1
N2N2Optional2
N3N3Optional2
N4N4Optional99999
REFREFOptional12
PERPEROptional99999
SISIOptional99999
FOBFOBOptional1
TD1TD1Optional2
TD5TD5Optional12
TD3TD3Optional12
TD4TD4Optional5
PKGPKGOptional200
RRARRAOptional25
Loop SPISPIOptional1
SPISPIMandatory1
REFREFOptional5
DTMDTMOptional5
MTXMTXOptional99999
Loop N1N1Optional20
N1N1Mandatory1
N2N2Optional2
N3N3Optional2
N4N4Optional1
REFREFOptional20
G61G61Optional1
MTXMTXOptional99999
Loop CB1CB1Optional99999
CB1CB1Mandatory1
REFREFOptional20
DTMDTMOptional5
LDTLDTOptional1
MTXMTXOptional99999
Loop PCTPCTOptional99999
PCTPCTMandatory1
AMTAMTOptional99999
Loop ADVADVOptional99999
ADVADVMandatory1
DTMDTMOptional99999
MTXMTXOptional99999
Loop LMLMOptional99999
LMLMMandatory1
LQLQMandatory99999
Loop PO1PO1Mandatory100000
PO1PO1Mandatory1
LINLINOptional99999
G53G53Optional1
CURCUROptional1
CN1CN1Optional1
PO3PO3Optional25
CTPCTPOptional99999
PAMPAMOptional10
CTBCTBOptional99999
MEAMEAOptional40
Loop PIDPIDOptional1000
PIDPIDMandatory1
MEAMEAOptional10
PWKPWKOptional25
PKGPKGOptional200
PO4PO4Optional99999
REFREFOptional99999
PERPEROptional3
SACSACOptional25
IT8IT8Optional25
CSHCSHOptional99999
ITDITDOptional99999
DISDISOptional20
INCINCOptional1
TAXTAXOptional3
FOBFOBOptional99999
SDQSDQOptional50
DTMDTMOptional10
FSTFSTOptional99999
TD1TD1Optional1
TD5TD5Optional12
TD3TD3Optional12
TD4TD4Optional5
MANMANOptional10
RRARRAOptional25
MTXMTXOptional99999
SPISPIOptional99999
Loop LMLMOptional99999
LMLMMandatory1
LQLQMandatory99999
Loop QTYQTYOptional99999
QTYQTYMandatory1
SISIOptional99999
Loop SCHSCHOptional104
SCHSCHMandatory1
TD1TD1Optional2
TD5TD5Optional12
TD3TD3Optional12
TD4TD4Optional5
REFREFOptional99999
Loop LDTLDTOptional99999
LDTLDTMandatory1
QTYQTYOptional99999
MTXMTXOptional99999
Loop LMLMOptional1
LMLMMandatory1
LQLQMandatory1
Loop SLNSLNOptional1000
SLNSLNMandatory1
MTXMTXOptional99999
PIDPIDOptional1000
ADVADVOptional99999
Loop QTYQTYOptional99999
QTYQTYMandatory1
SISIOptional99999
Loop N9N9Optional1000
N9N9Mandatory1
DTMDTMOptional99999
MTXMTXOptional99999
PWKPWKOptional99999
EFIEFIOptional99999
Loop N1N1Optional99999
N1N1Mandatory1
N2N2Optional2
N3N3Optional2
N4N4Optional1
QTYQTYOptional99999
REFREFOptional12
PERPEROptional3
SISIOptional99999
DTMDTMOptional1
FOBFOBOptional1
SCHSCHOptional200
TD1TD1Optional2
TD5TD5Optional12
TD3TD3Optional12
TD4TD4Optional5
PKGPKGOptional200
RRARRAOptional25
CTPCTPOptional1
PAMPAMOptional10
Loop LDTLDTOptional99999
LDTLDTMandatory1
MANMANOptional10
QTYQTYOptional5
MTXMTXOptional99999
Loop PCTPCTOptional99999
PCTPCTMandatory1
AMTAMTOptional99999
CTTCTTOptional1
SETransaction Set TrailerMandatory1