EDIFACT BGM segment: beginning of message.

The BGM segment opens every EDIFACT business message and identifies what the message is and what it does. Element 1 is the document type code (220=purchase order, 380=invoice, 351=despatch advice). Element 2 is the document number (your PO number, invoice number etc). Element 3 is the message function code: 9=original, 5=replace, 1=cancel, 4=change.

Tag
BGM
Full name
Beginning of message
Part of the message
Message header
Data elements
4

A BGM segment, explained

Hover any part of the segment to see what it is. Open What your system receives to see the JSON or XML CleanEDI delivers.

  1. BGM+220+PO-12345+9'
    BGMBeginning of message

    Purchase order number PO-12345, sent as original.

    BGM
    Beginning of message
    220
    Purchase order (document type)
    9
    Original (message function)

BGM structure

Elements are separated by + and their parts by :. Positions match the explainer, so 2.3 is the third part of the second element.

PositionElementParts
1Document type1.1 Code
2Document numberSingle value
3Message function3.1 Code
4Response typeSingle value

Document type (1.1)

CodeMeaning
9Price/sales catalogue
35Inventory report
220Purchase order
221Blanket order
224Rush order
226Call-off order
231Purchase order response
351Despatch advice
352Despatch advice (EANCOM)
380Commercial invoice
381Credit note
383Debit note
393Factored invoice
632Goods receipt

Message function (3.1)

CodeMeaning
1Cancellation
4Change
5Replace
7Duplicate
9Original
27Not accepted
29Accepted without amendment
31Copy

Common EANCOM and UN/EDIFACT values. Your trading partner's implementation guide is the final word on which codes they send.

BGM segment FAQ

Have a real message with BGM in it? The explainer breaks down every segment and runs in your browser.

Explain my message

What is the BGM segment in EDIFACT?

BGM is the Beginning of Message segment. The BGM segment opens every EDIFACT business message and identifies what the message is and what it does. Element 1 is the document type code (220=purchase order, 380=invoice, 351=despatch advice). Element 2 is the document number (your PO number, invoice number etc). Element 3 is the message function code: 9=original, 5=replace, 1=cancel, 4=change.

What are the common BGM document type codes?

9 means price/sales catalogue; 35 means inventory report; 220 means purchase order; 221 means blanket order; 224 means rush order; 226 means call-off order; 231 means purchase order response; 351 means despatch advice.

Where does BGM appear in an EDIFACT message?

BGM belongs to the message header part of a message, alongside UNH, DTM, FTX, RFF.

How do I read a BGM segment in my own message?

Paste the message into the free CleanEDI explainer. It breaks every BGM segment into its elements, translates the codes and shows the JSON and XML your system would receive. Nothing you paste leaves your browser.

Related segments in message header