# Mass Sales Order Creation from Excel Program

> A custom program that creates sales orders in bulk from the rows of an order file sent by the customer. It groups rows into orders by customer PO number, converts customer material numbers to SAP materials, shows price and confirmed quantity in test mode without saving, and lists the result of every row.

- Type: Program, Custom development, Mass upload
- Module: SD
- Estimated effort: M (5–7 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/mass-sales-order-creation-from-excel-program/


## Why is the standard not enough?

VA01 creates orders one at a time by hand. Automatic orders through IDoc ORDERS need an EDI partner setup and a fixed mapping, while many customers send their orders as Excel sheets. LSMW recordings break when screens change. Teams that enter hundreds of order lines a week need an upload with a test mode that recognizes customer material numbers and prevents duplicate orders.

### Closest standard alternatives

- VA01: Creates orders one at a time by hand; does not read files.
- LSMW: Can load from files but relies on screen recordings and needs technical maintenance.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| VBAK | Order header: type, sales area, sold-to | Write | - | ECC + S/4 |
| VBAP | Order items: material, quantity, plant | Write | - | ECC + S/4 |
| VBEP | Schedule lines: requested delivery date | Write | - | ECC + S/4 |
| VBKD | Customer PO number and date; also read for the duplicate check | Read / write | - | ECC + S/4 |
| VBPA | Ship-to partner | Write | - | ECC + S/4 |
| KNVV | Customer sales area data (check) | Read | KNVV-KUNNR = sipariş veren | ECC + S/4 |
| KNMT | Conversion from customer material number to SAP material | Read | KNMT-KUNNR = sipariş veren AND KNMT-KDMAT = dosyadaki müşteri malzemesi | ECC + S/4 |
| MVKE | Sales organization data of the material (check) | Read | MVKE-MATNR = malzeme | ECC + S/4 |

## BAPIs and functions used

- ALSM_EXCEL_TO_INTERNAL_TABLE: Reads the XLSX file cell by cell
- BAPI_SALESORDER_SIMULATE: Prices and confirms the order in test mode without saving
- BAPI_SALESORDER_CREATEFROMDAT2: Creates the sales order for each order group
- BAPI_TRANSACTION_COMMIT: Saves successful orders permanently

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Order file (XLSX or CSV) | Single value | - | Yes |
| P_AUART | Order type | Single value | VBAK-AUART | Yes |
| P_VKORG | Sales organization | Single value | VBAK-VKORG | Yes |
| P_VTWEG | Distribution channel | Single value | VBAK-VTWEG | Yes |
| P_SPART | Division | Single value | VBAK-SPART | Yes |
| P_DUPCHK | Skip orders whose customer PO number already exists | Checkbox | - | No |
| P_TEST | Test mode (simulate without saving) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Customer PO number | VBKD-BSTKD | Yes |
| Customer PO date | VBKD-BSTDK | No |
| Sold-to | VBAK-KUNNR | Yes |
| Ship-to | VBPA-KUNNR | No |
| Material | VBAP-MATNR | No |
| Customer material (if material is blank) | KNMT-KDMAT | No |
| Quantity | VBAP-KWMENG | Yes |
| Sales unit | VBAP-VRKME | No |
| Requested delivery date | VBEP-EDATU | No |
| Plant | VBAP-WERKS | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Customer PO number | VBKD-BSTKD |
| Sales order | VBAK-VBELN |
| Item | VBAP-POSNR |
| Material | VBAP-MATNR |
| Net value | VBAP-NETWR |
| Status | Calculated: From the BAPI return messages: simulated, created, skipped or error |
| Message | Calculated: First error or success message from the BAPI return table |

## How does the program work?

1. The file (XLSX or CSV) is read from the user's PC or, in a background job, from the application server; rows are grouped into orders by customer PO number (BSTKD), sold-to and ship-to.
2. Checks: the sold-to must exist in the selected sales area (KNVV); if the material is blank, the customer material number is converted to the SAP material through KNMT; the material must have sales organization data (MVKE).
3. With the duplicate check selected, a group is skipped when an order with the same customer PO number (VBKD-BSTKD) already exists for the customer.
4. In test mode BAPI_SALESORDER_SIMULATE is called; net price, confirmed quantity and messages are shown without saving.
5. In a real run BAPI_SALESORDER_CREATEFROMDAT2 is called per group, followed by BAPI_TRANSACTION_COMMIT for successful orders. Order number, item, net value and messages are listed per row; failed rows can be downloaded as a separate file.

## Authorization objects

- V_VBAK_VKO: Sales document create authorization by sales area
- V_VBAK_AAT: Create authorization by order type

## Frequently asked questions

### Are prices taken from the file or from the system?

By default the price comes from SAP pricing. If the price agreed with the customer must come from the file, a column can be added that is passed as a manual pricing condition.

### What if the customer uses their own material codes?

The material column can be left blank and the customer material number entered. The program finds the SAP material from the customer-material info record in KNMT; without a record, the row returns an error.

### Can this program be used on S/4HANA?

Yes. BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_SALESORDER_SIMULATE are supported on S/4HANA; although customer master data is kept through the business partner, the sales area data is checked the same way.

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