βš™οΈSAPTools

VBAP: Sales Document: Item Data

SD

VBAP stores the items of sales documents: one row per item with the material, plant, short text, order quantity, net value and item category. Every row belongs to a header in VBAK with the same VBELN.

Primary key

VBELN + POSNR

plus the client field

Module

SD

Fields in this reference

9

How the VBAP key works

The primary key is MANDT, VBELN and POSNR. Item numbers have six digits and usually step in tens (000010, 000020), but never rely on the numbering being continuous.

VBAP fields

FieldType / data elementLengthDescription
πŸ”‘MANDTCLNT3Client
πŸ”‘VBELNVBELN10Sales Document Number
πŸ”‘POSNRPOSNR6Item Number
MATNRMATNR18Material Number
WERKSWERKS4Plant
ARKTXARKTX40Short text
KWMENGKWMENG13Order Quantity (Sales)
NETWRNETWR15Net Value
PSTYVPSTYV4Item Category

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 VBAP

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

SELECT posnr, matnr, werks, arktx
  FROM vbap
  WHERE vbeln = @lv_vbeln
  INTO TABLE @DATA(lt_vbap).

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.

Tables related to VBAP

  • VBAK (joined on VBELN): Header of the sales document.
  • MARA (joined on MATNR): Cross-plant material master data.
  • MARC (joined on MATNR + WERKS): Plant data of the ordered material.
  • VBFA (joined on VBELV + POSNV): Document flow at item level.

Practical tips for VBAP

  • KWMENG is the order quantity in sales units, not in the base unit of measure.
  • The item category PSTYV controls behaviour such as free-of-charge items, text items and returns.
  • Select with VBELN only to read all items of an order, and add POSNR to read a single item.
  • Rejected items keep their row and carry a rejection reason in ABGRU. Add ABGRU = space to the WHERE clause to list only the items that are still active.
  • Sub-items, such as the components of a bill of materials, point to their higher-level item through UEPOS, so an order can contain items that are not part of the main numbering sequence.

VBAP FAQ

What is the primary key of VBAP?

MANDT, VBELN and POSNR: the sales document number and the item number.

How do I join VBAK and VBAP?

On VBELN. A join of VBAK to VBAP on vbap~vbeln = vbak~vbeln returns one row per order item with the header fields repeated on each row.

Keep exploring