# Sales Order Gross Margin Report by Item

> A custom ALV report that compares the net value of every sales order item with the cost determined in pricing and shows the gross profit and margin percentage. Items below a chosen threshold are flagged, so sales teams see low-margin orders before they are billed.

- Type: Report, Custom development, ALV report
- Module: SD
- Estimated effort: M (3–5 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/reports/sales-order-gross-margin-by-item-report/


## Why is the standard not enough?

VA05 lists orders with their net value but does not show cost or margin; the margin is visible only on the pricing screen of a single order in VA03. KE30 profitability analysis works on billed data with a configured operating concern and does not give the margin of open order items. Seeing low-margin items right after order entry needs a custom report.

### Closest standard alternatives

- VA05: Lists orders with net value; shows no cost or margin.
- KE30: Profitability analysis reports; need billed data and a configured CO-PA, and do not show open order items.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| VBAK | Order header, sales area, customer and pricing document number (driving table) | Read | - | ECC + S/4 |
| VBAP | Item net value and cost | Read | VBAP-VBELN = VBAK-VBELN | ECC + S/4 |
| KNA1 | Customer name | Read | KNA1-KUNNR = VBAK-KUNNR | ECC + S/4 |
| KONV | Cost condition check in ECC | Read | KONV-KNUMV = VBAK-KNUMV AND KONV-KPOSN = VBAP-POSNR | ECC only |
| PRCD_ELEMENTS | Cost condition check in S/4HANA | Read | PRCD_ELEMENTS-KNUMV = VBAK-KNUMV AND PRCD_ELEMENTS-KPOSN = VBAP-POSNR | S/4HANA only |

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_VKORG | Sales organization | Range / multiple | VBAK-VKORG | Yes |
| S_VTWEG | Distribution channel | Range / multiple | VBAK-VTWEG | No |
| S_VKBUR | Sales office | Range / multiple | VBAK-VKBUR | No |
| S_AUDAT | Order date range | Range / multiple | VBAK-AUDAT | Yes |
| S_KUNNR | Sold-to party | Range / multiple | VBAK-KUNNR | No |
| S_MATKL | Material group | Range / multiple | VBAP-MATKL | No |
| P_MINPCT | Margin threshold (%) | Single value | - | No |
| P_NOREJ | Exclude rejected items | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| Sales order | VBAK-VBELN |
| Item | VBAP-POSNR |
| Order date | VBAK-AUDAT |
| Sold-to | VBAK-KUNNR |
| Customer name | KNA1-NAME1 |
| Material | VBAP-MATNR |
| Item description | VBAP-ARKTX |
| Quantity | VBAP-KWMENG |
| Unit | VBAP-VRKME |
| Net value | VBAP-NETWR |
| Cost | VBAP-WAVWR |
| Gross profit | Calculated: VBAP-NETWR − VBAP-WAVWR |
| Margin % | Calculated: Gross profit ÷ VBAP-NETWR × 100 |
| Currency | VBAK-WAERK |
| Flag | Calculated: "Low margin" when the margin is below the threshold, "cost missing" when there is no cost |

## How does the report work?

1. VBAK and VBAP are read with the selection criteria; items with a reason for rejection (ABGRU) can be excluded.
2. The item cost comes from VBAP-WAVWR; this value is taken from the cost condition in pricing (usually VPRS).
3. When the cost is zero or empty, the pricing conditions are read from KONV in ECC and from PRCD_ELEMENTS in S/4HANA with VBAK-KNUMV and the item number, and the value (KWERT) of the cost condition is checked; if it is still missing the item is flagged as "cost missing".
4. Gross profit = VBAP-NETWR − VBAP-WAVWR, margin % = gross profit ÷ net value × 100. When the margin is below the threshold parameter the line is shown in red.
5. The customer name is added from KNA1; the ALV gives subtotals per customer, material group and sales office. The total margin is calculated as total profit ÷ total net value, not as the average of item margins.

## Authorization objects

- V_VBAK_VKO: Sales document authorization by sales area
- V_VBAK_AAT: Authorization by sales document type

## Frequently asked questions

### Where does the cost value come from?

From the cost condition in the pricing procedure (usually VPRS). At order time it takes the moving average or standard price of the material and writes it to VBAP-WAVWR.

### How are orders in different currencies totalled?

Items are shown in the document currency. For totals, extra columns converted to the company code currency at the order date rate can be added.

### What changes on S/4HANA?

On S/4HANA the pricing conditions are stored in PRCD_ELEMENTS instead of KONV. VBAP-WAVWR stays the same, so the main logic does not change; only the fallback table does.

---
Let us build this report for your system: https://nekuhub.com/en/request-a-quote/?report=sd-sales-order-gross-margin
