SD Program Custom development Form

Sales Invoice and Delivery Note Forms for Domestic, Export and Export-Registered Sales with Email Sending

Short answer: A custom form and output program that prints invoices and delivery notes with the right layout for each type of sale. Domestic, export and export-registered sales each get their own layout, language and annotation texts; the PDF is emailed to the customer's contact person and every sending can be traced in the output record.

Estimated effort
M · 7–10 working days
System
ECC and S/4HANA
Tables
12
Scope
Global
Built by
NeKuDos Teknoloji
Last updated

Why is the standard not enough?

The standard system ships with sample forms for invoices and deliveries; they offer one generic layout and do not print a different heading, language, currency or annotation text depending on whether the sale is domestic, export or export-registered. VF31 and VL71 reprocess output in bulk but do not decide which layout to use, and the email address is usually taken only from the customer's main address. The custom solution picks the layout from the document data, prints the amount in words and a tax summary, and sends the PDF to the right person.

Who uses it? Billing teams, shipping and warehouse staff, export operations teams and customer service.

Closest standard alternatives

  • VF31 Output from Billing Documents. Reprocesses billing output in bulk; does not choose a layout by type of sale or email the contact person.
  • VL71 Output from Outbound Deliveries. Processes delivery output in bulk; the delivery note is printed with the standard sample form.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
VBRKBilling Document HeaderInvoice header: billing type, date, currency, recipient country (driving table)ReadECC + S/4
VBRPBilling Document: Item DataInvoice items: material, quantity, net value, taxReadECC + S/4
LIKPDelivery HeaderDelivery note header: goods issue date, ship-to, weightReadECC + S/4
LIPSDelivery Item DataDelivery note items: material, batch, delivery quantityReadECC + S/4
VBPASales Document: PartnersPayer, ship-to and contact person with address numbersReadECC + S/4
ADR6E-Mail Addresses (Business Address Services)Email address of the contact person or the customerReadECC + S/4
KNA1Customer Master (General Section)Customer name, language and countryReadECC + S/4
VBKDSales Document: Business DataIncoterms and payment termsReadECC + S/4
KONVConditions (Transaction Data)Price and tax lines (ECC)ReadECC only
PRCD_ELEMENTSPricing Elements (Document Conditions)Price and tax lines (S/4HANA)ReadS/4HANA only
NASTMessage StatusOutput record and processing statusReadECC + S/4
TNAPRProcessing Programs for OutputLink of the output type to program and formReadECC + S/4

S/4HANA notes

  • KONV → PRCD_ELEMENTS: In S/4HANA document conditions are stored in PRCD_ELEMENTS; custom code reading KONV must be adapted.

BAPIs and functions used

  • SSF_FUNCTION_MODULE_NAMEGet Smart Form Function Module Name. Finds the generated function name of the form when Smart Forms is used
  • FP_FUNCTION_MODULE_NAMEGet Adobe Form Function Module Name. Finds the interface function of the form when Adobe Forms is used
  • READ_TEXTRead Long Text. Reads document header and item texts
  • SD_PRINT_TERMS_OF_PAYMENTFormat Terms of Payment for Printing. Prepares the payment terms as printable text
  • SO_NEW_DOCUMENT_ATT_SEND_API1SAPoffice: Send New Document with Attachments. Sends the PDF as an email attachment

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
S_VKORGSales organizationRange / multipleVBRK-VKORGYes1000
S_FKDATBilling dateRange / multipleVBRK-FKDATYes01.11.2026 – 16.11.2026
S_VBELNBilling documentRange / multipleVBRK-VBELNNo90031245
S_FKARTBilling typeRange / multipleVBRK-FKARTNoF2
P_KSCHLOutput typeSingle valueNAST-KSCHLYesRD00
P_LIKPAlso send the related delivery notesCheckbox—NoX
P_PREVPreview only (do not send)Checkbox—No—
P_PRINTPrint in addition to emailCheckbox—No—

Result list columns

#ColumnSource
1DocumentCalculated Billing document (VBRK-VBELN) or delivery (LIKP-VBELN) number
2Document kindCalculated Invoice or delivery note
3LayoutCalculated Domestic, export or export-registered (rule in step 2)
4CustomerVBRK-KUNAG
5Customer nameKNA1-NAME1
6Recipient emailADR6-SMTP_ADDR
7LanguageNAST-SPRAS
8Net valueVBRK-NETWR
9CurrencyVBRK-WAERK
10StatusCalculated Sent, previewed, printed only or error
11MessageCalculated Return message of sending or form processing

Sample result list

DocumentDocument kindLayoutCustomerCustomer nameRecipient emailLanguageNet valueCurrencyStatusMessage
90031245InvoiceDomestic200118Örnek Tekstil A.Ş.[email protected]TR148,250TRYSentPDF sent by email
80045112Delivery noteExport300045Demo Retail Ltd.[email protected]ENSentDelivery note sent in the English layout
90031260InvoiceExport-registered200342Anadolu Dış Ticaret A.Ş.[email protected]TR512,400TRYSentLegal annotation printed
90031277InvoiceExport300051Nordic Home GmbHDE23,800EURPrinted onlyNo email address found; document sent to the printer
A view built with fictional sample data; not real system data.

How does the program work?

  1. Separate output types are defined for the invoice and the delivery note and linked to the custom output program and form in NACE (TNAPR). When the document is saved, standard output determination creates the NAST record.
  2. The layout is chosen from the document data: if the recipient’s country differs from the company code country, the export layout is used; if the billing type or customer group is flagged as an export-registered sale during installation, the export-registered layout is used; otherwise the domestic layout.
  3. VBRK/VBRP are read for the invoice and LIKP/LIPS for the delivery note. Payer, ship-to and recipient addresses come from VBPA and ADRC, delivery and payment terms from VBKD, price and tax lines from KONV (PRCD_ELEMENTS in S/4HANA); header and item texts are added with READ_TEXT.
  4. In the export layout the document is printed in the customer’s language and in the document currency, with incoterms and commodity codes. The export-registered layout prints the legal annotation and the details of the exporting buyer; the annotation text is checked against current regulation during installation. The amount in words and the VAT summary are calculated inside the form.
  5. The form is converted to PDF. The recipient email is taken from the contact person on the document (VBPA → ADR6), otherwise from the customer’s default email, and the PDF is sent with SO_NEW_DOCUMENT_ATT_SEND_API1; it can also be printed at the same time.
  6. The result is written to the NAST processing status. The mass resend screen runs the same steps for the selected documents and returns a result list per document.

Performance notes

Read the form data once per document instead of separate SELECTs per item; fetch addresses and texts once per document. In a mass resend, process documents in packages, issue COMMIT WORK after each package and run the program in the background for hundreds of documents.

Features

  • Send the result by email The PDF goes to the contact person on the document, otherwise to the customer's default email.
  • Test mode (check without posting) Each document's PDF can be previewed before a mass sending.
  • Line-by-line result and error log
  • Runs as a background job A job can retry unsent documents at the end of the day.

Authorization objects

  • V_VBRK_FKABilling document display and output authorization by billing type
  • V_VBRK_VKOBilling document authorization by sales organization
  • V_LIKP_VSTDelivery authorization by shipping point
  • S_OC_SENDAuthorization to send external email from SAP

Frequently asked questions

We use electronic invoicing; is this form still needed?

The legal electronic document is produced by your e-document solution. This form is used as the information copy sent to the customer, for recipients outside the e-document scope and for the delivery note copy printed in the warehouse; the layout can be aligned with the e-document view.

How is the layout to print determined?

The program compares the recipient's country with the company code country and checks the flag set during installation for the billing type or customer group. The rule is kept in one place, so adding a new type of sale does not require changing the form itself.

Can we send the same invoice to the customer again?

Yes. When you select the document in the mass resend screen and run it, a new output record is created and the PDF is sent again; the earlier sendings remain visible in NAST with date and user.

Related reports

SD Report Custom ALV report

Billing Documents Not Posted to Accounting Report

A custom ALV report that lists billing documents which exist in SD but have no accounting document yet, with the reason code, age and amount. At …

VBRK · VBRP · BKPF · KNA1

Let us build this program for your system

Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.

Related report: Sales Invoice and Delivery Note Forms for Domestic, Export and Export-Registered Sales with Email Sending