# Sales Order Confirmation and Proforma Invoice Output with Automatic Email

> A custom form program that prepares the order confirmation and, when needed, the proforma invoice as PDF the moment the sales order is saved and emails them to the customer's contact person. The confirmation shows the confirmed quantity and date per item, the proforma shows bank details and a validity date, and a new confirmation with a revision number goes out when the order changes.

- Type: Program, Custom development, Form
- Module: SD
- Estimated effort: M (5–8 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/sales-order-confirmation-and-proforma-invoice-output/


## Why is the standard not enough?

The standard order confirmation output is a generic sample form; the confirmed date per item, the customer's language and revision information do not appear in the required format. In the standard, a proforma invoice is obtained by creating a separate proforma billing document with VF01; this is an extra step and must be repeated when the order changes. The custom solution produces both documents directly from the order and sends them automatically to the right person.

### Closest standard alternatives

- VA02: Triggers output manually from the order; uses the standard sample form and the customer's main address.
- VF01: Creates a proforma billing document; a separate step that must be repeated when the order changes.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| VBAK | Order header: customer, date, net value, currency (driving table) | Read | - | ECC + S/4 |
| VBAP | Order items: material, order quantity, price | Read | VBAP-VBELN = VBAK-VBELN | ECC + S/4 |
| VBEP | Schedule lines: confirmed quantity and date | Read | VBEP-VBELN = VBAP-VBELN AND VBEP-POSNR = VBAP-POSNR | ECC + S/4 |
| VBKD | Payment and delivery terms, customer PO number | Read | VBKD-VBELN = VBAK-VBELN | ECC + S/4 |
| VBPA | Contact person, payer and sales representative | Read | VBPA-VBELN = VBAK-VBELN | ECC + S/4 |
| ADR6 | Recipient's email address | Read | ADR6-ADDRNUMBER = VBPA-ADRNR | ECC + S/4 |
| KNA1 | Customer name and language | Read | KNA1-KUNNR = VBAK-KUNNR | ECC + S/4 |
| KONV | Price, discount and tax lines (ECC) | Read | KONV-KNUMV = VBAK-KNUMV | ECC only |
| PRCD_ELEMENTS | Price, discount and tax lines (S/4HANA) | Read | PRCD_ELEMENTS-KNUMV = VBAK-KNUMV | S/4HANA only |
| T012K | Bank account printed on the proforma | Read | - | ECC + S/4 |
| NAST | Output records and revision count | Read | NAST-OBJKY = VBAK-VBELN | ECC + S/4 |
| CDHDR | Order changes since the last sending | Read | CDHDR-OBJECTCLAS = 'VERKBELEG' AND CDHDR-OBJECTID = VBAK-VBELN | ECC + S/4 |

## BAPIs and functions used

- SSF_FUNCTION_MODULE_NAME: Finds the form function when Smart Forms is used
- FP_FUNCTION_MODULE_NAME: Finds the form interface when Adobe Forms is used
- SD_PRINT_TERMS_OF_PAYMENT: Prepares the payment terms as printable text
- READ_TEXT: Reads order header and item texts
- SO_NEW_DOCUMENT_ATT_SEND_API1: Sends the confirmation and proforma as PDF attachments

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_VKORG | Sales organization | Range / multiple | VBAK-VKORG | Yes |
| S_VBELN | Sales order | Range / multiple | VBAK-VBELN | No |
| S_AUDAT | Order date | Range / multiple | VBAK-AUDAT | No |
| S_AUART | Order type | Range / multiple | VBAK-AUART | No |
| R_CONF | Order confirmation | Radio button | - | No |
| R_PROF | Proforma invoice | Radio button | - | No |
| P_PREV | Preview only (do not send) | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Sales order | VBAK-VBELN |
| Document | Calculated: Order confirmation or proforma invoice |
| Revision | Calculated: Number of processed NAST records for this output type |
| Customer | VBAK-KUNNR |
| Customer name | KNA1-NAME1 |
| Recipient email | ADR6-SMTP_ADDR |
| Net value | VBAK-NETWR |
| Currency | VBAK-WAERK |
| Latest confirmed date | Calculated: Maximum VBEP-EDATU (VBEP-BMENG > 0) |
| Status | Calculated: Sent, previewed or error |
| Message | Calculated: Return message of sending or form processing |

## How does the program work?

1. Two output types (order confirmation and proforma) are defined for the order and linked to the custom program in NACE. An output determination condition is added so that the proforma is only determined for orders with prepayment terms or export orders.
2. Order data comes from VBAK/VBAP, confirmed quantity and date from the schedule lines (VBEP: BMENG, EDATU), price and tax lines from KONV (PRCD_ELEMENTS in S/4HANA), and payment and delivery terms from VBKD.
3. The proforma is calculated from the order without creating a billing document: net amount, VAT, grand total, amount in words, validity date and the company's bank account for the currency (T012K) are printed.
4. When the order is changed the output is created again; the revision number is the count of processed NAST records of that output type. Items changed since the last sending are found in the change documents (CDHDR) and marked on the form.
5. The PDF is sent to the customer's contact person on the order (VBPA → ADR6) with SO_NEW_DOCUMENT_ATT_SEND_API1; the sales representative gets a copy.
6. The mass resend screen produces the confirmation or proforma again for the selected orders and returns a result list.

## Authorization objects

- V_VBAK_VKO: Order display and output authorization by sales organization
- V_VBAK_AAT: Authorization by order type
- S_OC_SEND: Authorization to send external email from SAP

## Frequently asked questions

### Is a billing document created for the proforma?

No. Proforma amounts are calculated directly from the order, so no extra document appears in the billing flow. If the proforma must be a numbered document, it can be set up to work with the standard proforma billing type.

### Is the customer informed when the delivery date changes?

Yes. When the confirmed date or quantity changes, output is determined again and a new confirmation with a higher revision number is sent; the changed items are marked on the form.

### Are the documents printed in the customer's language?

The document language comes from the output record, which by default is the customer's communication language. Form texts are kept translated for each language, and date and amount formats follow the language.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=sd-order-confirmation-proforma
