βš™οΈSAPTools

VBAK: Sales Document: Header Data

SD

VBAK is the header table for sales documents. Inquiries, quotations, sales orders, contracts and returns are all stored here and told apart by the document category (VBTYP) and the sales document type (AUART). It holds order-level data such as the sold-to party, net value, currency, sales organization and distribution channel.

Primary key

VBELN

plus the client field

Module

SD

Fields in this reference

11

How the VBAK key works

The primary key is MANDT plus VBELN. Sales document numbers are numeric and stored with leading zeros, so apply the ALPHA conversion exit when you take them from user input.

VBAK fields

FieldType / data elementLengthDescription
πŸ”‘MANDTCLNT3Client
πŸ”‘VBELNVBELN10Sales Document Number
ERDATDATUM8Created On
ERZETUZEIT6Created At
ERNAMUNAME12Created By
AUARTAUART4Sales Document Type
KUNNRKUNNR10Sold-to Party
NETWRNETWR15Net Value
WAERKWAERK5Currency
VKORGVKORG4Sales Organization
VTWEGVTWEG2Distribution Channel

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 VBAK

" Open SQL applies the client (MANDT) automatically, so it is not part of the WHERE clause.
DATA lv_vbeln TYPE vbak-vbeln.

SELECT erdat, erzet, ernam
  FROM vbak
  WHERE vbeln = @lv_vbeln
  INTO TABLE @DATA(lt_vbak).

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.

VBAK in SAP S/4HANA

Sales documents are still stored in VBAK and VBAP in SAP S/4HANA, but the status tables VBUK and VBUP were merged into them, so the status fields now live directly on the header and item. Code written for ECC that joins VBUK or VBUP needs to be adjusted.

Tables related to VBAK

  • VBAP (joined on VBELN): Item data of the sales document.
  • KNA1 (joined on KUNNR): Customer master data of the sold-to party.
  • VBFA (joined on VBELV + POSNV): Document flow: use it to move from an order to its deliveries and invoices.

Practical tips for VBAK

  • VBELN is the only fully selective key. To find the orders of a customer, combine KUNNR with a date range on ERDAT.
  • NETWR is stated in the document currency WAERK, so convert before summing across currencies.
  • The reliable way from an order to its deliveries and invoices is the document flow table VBFA.

VBAK FAQ

What is the difference between VBAK and VBAP?

VBAK holds one row per sales document (header data) and VBAP one row per item of that document. They are linked by VBELN.

How do I tell an order from a quotation in VBAK?

Use the document category VBTYP together with the sales document type AUART. A sales order has document category C and a quotation has B.

Keep exploring