BSEG: Accounting Document Segment
FIBSEG stores the line items of FI accounting documents: one row per document line with the G/L account, cost center and the amounts in local and document currency. The document header is in BKPF.
Primary key
BUKRS + BELNR + GJAHR + BUZEI
plus the client field
Module
FI
Fields in this reference
9
How the BSEG key works
The primary key is MANDT, BUKRS, BELNR, GJAHR and BUZEI. The first four fields identify the document in BKPF and BUZEI is the line item number.
BSEG fields
| Field | Type / data element | Length | Description |
|---|---|---|---|
| πMANDT | CLNT | 3 | Client |
| πBUKRS | BUKRS | 4 | Company Code |
| πBELNR | BELNR | 10 | Document Number |
| πGJAHR | GJAHR | 4 | Fiscal Year |
| πBUZEI | BUZEI | 3 | Line Item Number |
| HKONT | HKONT | 10 | G/L Account |
| KOSTL | KOSTL | 10 | Cost Center |
| DMBTR | DMBTR | 15 | Amount in Local Currency |
| WRBTR | WRBTR | 15 | Amount in Document Currency |
This is a curated subset of the most commonly used fields, not the complete table definition. A real system contains more fields and can differ by release and customizing, so confirm the definition in transaction SE11 before relying on it.
Example ABAP SELECT for BSEG
" Open SQL applies the client (MANDT) automatically, so it is not part of the WHERE clause.
DATA lv_bukrs TYPE bseg-bukrs.
DATA lv_belnr TYPE bseg-belnr.
DATA lv_gjahr TYPE bseg-gjahr.
SELECT buzei, hkont, kostl, dmbtr
FROM bseg
WHERE bukrs = @lv_bukrs
AND belnr = @lv_belnr
AND gjahr = @lv_gjahr
INTO TABLE @DATA(lt_bseg).Modern Open SQL with host variables (ABAP 7.40 and later). Need a different field list or conditions? Build it in the ABAP SELECT Builder.
BSEG in SAP S/4HANA
In ECC, BSEG is a cluster table, which means it cannot be used in database joins and conditions on non-key fields are slow. In SAP S/4HANA the Universal Journal table ACDOCA is the primary source for FI line items, so check the simplification list of your release before building new reports on BSEG.
Tables related to BSEG
- BKPF (joined on BUKRS + BELNR + GJAHR): Header of the document.
- SKA1 (joined on HKONT = SAKNR): G/L account master data at chart-of-accounts level.
- SKB1 (joined on BUKRS + HKONT = SAKNR): G/L account master data at company-code level.
Practical tips for BSEG
- For open and cleared items in ECC, use the secondary index tables instead of scanning BSEG: BSIS and BSAS for G/L accounts, BSID and BSAD for customers, BSIK and BSAK for vendors.
- DMBTR is the amount in local currency and WRBTR the amount in document currency. The sign depends on the debit/credit indicator SHKZG.
- When reading a single document, always supply BUKRS, BELNR and GJAHR. Selecting by G/L account alone on a cluster table is slow.
BSEG FAQ
Why is selecting from BSEG slow?
In ECC it is a cluster table, so conditions on fields other than the document key cannot be evaluated by the database alone and the data has to be read and unpacked first. Use the secondary index tables, or ACDOCA in S/4HANA.
What is the primary key of BSEG?
MANDT, BUKRS, BELNR, GJAHR and BUZEI: the document key from BKPF plus the line item number.
Keep exploring
- SAP Table Field Lookup: search all 28 tables and their fields.
- SAP BAPI Explorer: find the BAPI that creates or changes this data.
- CDS View Generator: expose these tables through a CDS view.