Aller au contenu principal

Database Schema

Database Schema

NomaUBL stores UBL 2.1 invoice data in five Oracle custom tables within the JDE schema (e.g. CRPDTA). All are linked to the JDE editique tracking table F564230 (SUIVI_EDITIQUE) via the compound key DOC / DCT / KCO.

Relational schema

F564230 (SUIVI_EDITIQUE — JDE tracking)

├──────► F564231 (UBL_HEADER) 1:1 Invoice header
├──────► F564233 (UBL_LINES) 1:N Invoice detail lines
├──────► F564234 (UBL_VAT_SUMMARY) 1:N VAT summary by rate
├──────► F564235 (UBL_LIFECYCLE) 1:N PA status history
└──────► F564236 (UBL_VALIDATION) 1:N Validation results

Naming conventions

TableLogical nameDescriptionColumn prefix
F564231UBL_HEADERInvoice header (EN 16931)UH
F564233UBL_LINESInvoice detail linesUL
F564234UBL_VAT_SUMMARYVAT subtotals by rateUV
F564235UBL_LIFECYCLEPA lifecycle status historyUS
F564236UBL_VALIDATIONSchematron validation resultsUV

Oracle data types

JDE typeOracle typeSizeUsage
StringVARCHAR230–1024Short text
Math NumericNUMBER(15,2)Amounts
DateDATEBusiness dates
DateTimeTIMESTAMPAudit trail
Large TextCLOBXML, JSON
BinaryBLOBEncoded PDF

Data dictionary aliases (new)

AliasTypeSizeDescription
Y56PYINSTRING3Payment mode code
Y56UMSTRING3Unit of measure
Y56RULESTRING20Validation rule ID

F564231 — UBL_HEADER

Invoice header conforming to EN 16931.

Primary key: DOC, DCT, KCO
Relations: DOC → F564230.DOC, DCT → F564230.DCT, KCO → F564230.KCO

ColumnTypeSizeNullDefaultDescriptionUBL ref
DOCNUMERIC8NoSequenceDocument number (PK)
DCTSTRING2NoSequenceDocument type (PK)
KCOSTRING5NoSequenceCompany code (PK)
ODOCNUMERIC8NoOriginal invoice number
ODCTSTRING2NoSequenceOriginal document type
OKCOSTRING5NoSequenceOriginal company code
K74FLENSTRING25NoUBL invoice numberBT-1
K74XMLVSTRING4YesProfile ID (S1, M1…)BT-23
K74LDDJDATE6NoInvoice issue dateBT-2
DDJDATE6YesPayment due dateBT-9
K74LEDTSTRING5NoInvoice type code (380, 381, 384…)BT-3
ATXANUMERIC15,2Yes0Total excl. tax (quick ref)BT-109
STAMNUMERIC15,2Yes0Total VAT (quick ref)BT-110
AGNUMERIC15,2Yes0Total incl. tax (quick ref)BT-112
AAPNUMERIC15,2Yes0Amount payableBT-115
CRCDSTRING3YesEURDocument currency codeBT-5
K74MSG2STRING1024YesInvoice noteBT-22
55RSFSTRING50YesPurchase order referenceBT-13
Y74CTIDNUMERIC10YesContract referenceBT-12
AN8NUMBER8YesJDE customer address book number
ALKYSTRING20YesCustomer number
TXFTCLOBYesFull UBL XML source
K74RSCDSTRING2YesCREATEDStatus code
K74MSG1VARCHAR21024YesStatus reason / error details
Y56EPIDSTRING30YesCustomer endpoint IDBT-34, BT-49
Y56EPSCSTRING10YesCustomer endpoint scheme (0190, 0192…)BT-34-1, BT-49-1
Y56PYINVARCHAR230NoPayment means code (30, 58, 48, 49…)BT-81
USERSTRING10YesLast modified by
PIDSTRING10YesNOMAUBLProgram ID
JOBNSTRING10YesJob / batch ID
UPMJDATE6YesLast modification date
TDAYDATE6YesLast modification time

F564233 — UBL_LINES

Invoice detail lines (InvoiceLine) with article, quantity, and price information.

Primary key: DOC, DCT, KCO, LNID
Relations: DOC → F564230.DOC, DCT → F564230.DCT, KCO → F564230.KCO

ColumnTypeSizeNullDefaultDescriptionUBL ref
DOCNUMERIC8NoSequenceDocument number (PK)
DCTSTRING2NoSequenceDocument type (PK)
KCOSTRING5NoSequenceCompany code (PK)
LNIDNUMBER6NoLine number (PK)BT-126
DSC1STRING40YesItem descriptionBT-153
LITMSTRING35YesSeller item codeBT-155
Y56QNTYNUMBER15,4NoInvoiced quantityBT-129
Y56UMSTRING2YesUnit of measureBT-130
UPRCNUMBER15,4NoNet unit priceBT-146
ATXANUMBER15,2NoLine amount excl. taxBT-131
REBLNUMBER15,4Yes0Allowance / discount amountBT-147
CRCDSTRING3YesEURCurrency code
K74TVCCSTRING10NoVAT category (S, AA, Z, E, AE)BT-151
TXR1NUMBER7,3YesVAT rate (percentage)BT-152
K74EXRCSTRING10YesVAT exemption reasonBT-121
USERSTRING10YesLast modified by
PIDSTRING10YesNOMAUBLProgram ID
JOBNSTRING10YesJob / batch ID
UPMJDATE6YesLast modification date
TDAYDATE6YesLast modification time

F564234 — UBL_VAT_SUMMARY

VAT subtotals grouped by rate and category (TaxSubtotal).

Primary key: DOC, DCT, KCO, SEQN
Relations: DOC → F564230.DOC, DCT → F564230.DCT, KCO → F564230.KCO

ColumnTypeSizeNullDefaultDescriptionUBL ref
DOCNUMERIC8NoSequenceDocument number (PK)
DCTSTRING2NoSequenceDocument type (PK)
KCOSTRING5NoSequenceCompany code (PK)
SEQNNUMBER5,0NoSequence number (unique per invoice)
K74TVCCVARCHAR210NoVAT category (S, AA, Z, E, AE)BT-118
TXR1NUMBER5,2NoVAT rate (percentage)BT-119
ATXANUMBER15,2NoTaxable base amountBT-116
STAMNUMBER15,2NoVAT amountBT-117
CRCDVARCHAR23YesEURCurrency code
K74EXRCVARCHAR2500YesExemption reasonBT-120
USERSTRING10YesLast modified by
PIDSTRING10YesNOMAUBLProgram ID
JOBNSTRING10YesJob / batch ID
UPMJDATE6YesLast modification date
TDAYDATE6YesLast modification time

F564235 — UBL_LIFECYCLE

Full history of invoice status transitions in the PA lifecycle.

Primary key: DOC, DCT, KCO, SEQN
Relations: DOC → F564230.DOC, DCT → F564230.DCT, KCO → F564230.KCO

ColumnTypeSizeNullDefaultDescription
DOCNUMERIC8NoSequenceDocument number (PK)
DCTSTRING2NoSequenceDocument type (PK)
KCOSTRING5NoSequenceCompany code (PK)
SEQNNUMBER5,0NoSequence number (unique per invoice, PK)
K74RSCDVARCHAR210NoPA status code
K74MSG1VARCHAR2500YesStatus reason / error details
TRDJDATE6NoStatus date/time (source: PA)
USERSTRING10YesLast modified by
PIDSTRING10YesNOMAUBLProgram ID
JOBNSTRING10YesJob / batch ID
UPMJDATE6YesLast modification date
TDAYDATE6YesLast modification time

F564236 — UBL_VALIDATION

Detailed results of Schematron validation (EN 16931, CIUS-FR).

Primary key: DOC, DCT, KCO, SEQN
Relations: DOC → F564230.DOC, DCT → F564230.DCT, KCO → F564230.KCO

ColumnTypeSizeNullDefaultDescription
DOCNUMERIC8NoSequenceDocument number (PK)
DCTSTRING2NoSequenceDocument type (PK)
KCOSTRING5NoSequenceCompany code (PK)
SEQNNUMBER5,0NoSequence number (unique per invoice, PK)
Y56LEVELVARCHAR210NoSeverity: FATAL, ERROR, WARNING, INFO
SRCLVARCHAR250NoValidation source: XSD, EN16931, CIUS-FR
Y56RULEVARCHAR250YesRule ID (e.g. BR-1, BR-FR-1)
K74MSG1VARCHAR22000NoValidation message
USERSTRING10YesLast modified by
PIDSTRING10YesNOMAUBLProgram ID
JOBNSTRING10YesJob / batch ID
UPMJDATE6YesLast modification date
TDAYDATE6YesLast modification time

Indexes

Primary indexes

TableIndexColumns
F564231F564231_1DOC, DCT, KCO
F564233F564233_1DOC, DCT, KCO, LNID
F564234F564234_1DOC, DCT, KCO, SEQN
F564235F564235_1DOC, DCT, KCO, SEQN
F564236F564236_1DOC, DCT, KCO, SEQN

Reference codes

All reference code lists (VAT categories, invoice types, payment means, scheme IDs, unit codes, profile IDs, etc.) are documented in Reference Lists.


Reference codes

VAT category codes (K74TVCC)

CodeRateDescriptionUsage
S20%StandardFrench standard rate
Z0%ZeroExports outside EU
E0%ExemptMedical, training, insurance
AEReverse chargeVAT due by buyer
KIntra-communityIntra-EU supplies
GExportGoods exported outside EU
OOut of scopeServices not subject to VAT
L0–20%Canary IslandsSpecial Canary Islands rates
MVariableIGIC/IPSICommunity taxes (Canaries, Ceuta, Melilla)

French standard VAT rates:

RateDescription
20.00%Standard rate
13.00%Corsica rate
10.00%Intermediate rate
5.50%Reduced rate
2.10%Special rate
0.00%Exempt or zero

Invoice type codes (K74LEDT)

CodeTypeDescription
380InvoiceStandard commercial invoice
381Credit NotePartial or full credit
384Corrected InvoiceCorrection of a previous invoice
389Self-billed InvoiceCustomer invoices on behalf of supplier
261Self-billed Credit NoteCredit note issued by customer
386Prepayment InvoiceAdvance payment invoice
387Hire InvoiceEquipment rental invoice

Payment means codes (Y56PYIN) — UN/CEFACT 4461

CodeDescriptionFrance usage
1Instrument not definedNot specified
10In cashCash
30Credit transferBank transfer
31Debit transferAccount-to-account transfer
42Payment to bank accountCheque
48Bank cardCard payment
49Direct debitDirect debit
57Standing agreementStanding order
58SEPA credit transferSEPA transfer (mandatory EU)
59SEPA direct debitSEPA direct debit
97Clearing between partnersInter-company clearing

Endpoint scheme codes (Y56EPSC) — ISO 6523 ICD

CodeIdentifierDescription
0060DUNSData Universal Numbering System
0088GLNGlobal Location Number
0190OINIdentification Number
0225SIRENLegal identifier (France)
9957TVAINTRAFRFrench intra-community VAT number

Electronic addresses follow the format schemeID:identifier, e.g. 0225:SIREN_XXX or 9957:TVAINTRAFR.

Unit of measure codes (Y56UM) — UN/ECE Recommendation 20

CodeDescription
C62Unit (piece)
KGMKilogram
MTRMetre
LTRLitre
MTKSquare metre
MTQCubic metre
HURHour
DAYDay
TNETonne (metric)
KWHKilowatt-hour
EAEach
SETSet
PRPair
PCEPiece

Lifecycle status codes (K74RSCD)

See Status Codes for the full catalog.

Validation severity levels (Y56LEVEL)

ValueMeaning
FATALBlocking fatal error — processing stops
ERRORError — PA submission not possible
WARNINGWarning — PA submission allowed (configurable)
INFOInformational message

Validation sources (SRCL)

ValueDescription
XSDXML schema validation
EN16931CEN business rules (BR-xx)
CIUS-FRFrench national rules (BR-FR-xx)

JDE date format

All DATE columns in these tables use JDE Julian format — an integer YYYYDDD, where DDD is the day of year.

-- Convert JDE Julian to Oracle DATE
TO_DATE(TO_CHAR(UPMJ), 'YYYYDDD') AS MODIFIED_DATE

Useful queries

Get the full invoice view for a document:

SELECT
h.K74FLEN AS ubl_number,
h.K74LDDJ AS issue_date,
h.K74LEDT AS invoice_type,
h.ATXA AS total_ht,
h.STAM AS total_vat,
h.AG AS total_ttc,
h.AAP AS amount_due,
h.CRCD AS currency,
h.K74RSCD AS status
FROM CRPDTA.F564231 h
WHERE h.DOC = :doc AND h.DCT = :dct AND h.KCO = :kco;

Get invoice lines:

SELECT LNID, DSC1, LITM, Y56QNTY, Y56UM, UPRC, ATXA, REBL, K74TVCC, TXR1
FROM CRPDTA.F564233
WHERE DOC = :doc AND DCT = :dct AND KCO = :kco
ORDER BY LNID;

Get VAT summary:

SELECT K74TVCC, TXR1, ATXA AS taxable_base, STAM AS vat_amount
FROM CRPDTA.F564234
WHERE DOC = :doc AND DCT = :dct AND KCO = :kco
ORDER BY SEQN;

Get pending invoices for status polling:

SELECT h.DOC, h.DCT, h.KCO, h.K74RSCD, h.K74MSG1
FROM CRPDTA.F564231 h
WHERE h.K74RSCD = '9906'
ORDER BY h.UPMJ, h.TDAY;