# Mass Internal Order Creation from Excel with Settlement Rule

> A custom program that creates internal orders in bulk from file rows, with order type, company code, responsible cost center and profit center, and adds the settlement rule to each order in the same step. It checks in test mode and lists the created order numbers.

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


## Why is the standard not enough?

KO01 creates internal orders one at a time; copying from a reference order saves time, but every order is still entered separately. The settlement rule is maintained on a separate screen, often added later with KO02, and forgotten rules cause errors in the month-end settlement. Hundreds of campaign or project orders need bulk creation from a file.

### Closest standard alternatives

- KO01: Creates internal orders one at a time; no bulk creation from a file.
- KO02: Adds the settlement rule later, one order at a time.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| AUFK | Internal order master: type, short text, company code, profit center, responsible cost center | Write | - | ECC + S/4 |
| COBRB | Settlement rule: receiving cost center, percentage, settlement type | Write | COBRB-OBJNR = AUFK-OBJNR | ECC + S/4 |
| CSKS | Validity check of the responsible and receiving cost centers | Read | CSKS-KOKRS = AUFK-KOKRS AND CSKS-KOSTL = AUFK-KOSTV | ECC + S/4 |

## BAPIs and functions used

- BAPI_INTERNALORDER_CREATE: Creates the internal order with master data and settlement rule
- BAPI_TRANSACTION_COMMIT: Saves successful orders permanently
- BAPI_TRANSACTION_ROLLBACK: Rolls back the change in test mode and for failed rows

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Upload file (XLSX or CSV) | Single value | - | Yes |
| P_KOKRS | Controlling area | Single value | AUFK-KOKRS | Yes |
| P_TEST | Test mode (check without posting) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Order type | AUFK-AUART | Yes |
| Short text | AUFK-KTEXT | Yes |
| Company code | AUFK-BUKRS | Yes |
| Plant | AUFK-WERKS | No |
| Profit center | AUFK-PRCTR | No |
| Responsible cost center | AUFK-KOSTV | No |
| Receiving cost center | COBRB-KOSTL | Yes |
| Settlement percentage | COBRB-PROZS | No |
| Settlement type | COBRB-PERBZ | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Order | AUFK-AUFNR |
| Short text | AUFK-KTEXT |
| Status | Calculated: From the BAPI return messages: created, checked or error |
| Message | Calculated: First error or success message from the BAPI return table |

## How does the program work?

1. The file is read from the user's PC or, in a background job, from the application server; the first row is skipped as the header.
2. Every row is checked: order type, company code and profit center must exist; the responsible and receiving cost centers must be valid in the controlling area (CSKS); the settlement percentage must be between 0 and 100 and the settlement type PER or FUL.
3. The row is mapped to the master data structure of BAPI_INTERNALORDER_CREATE (order type, short text, company code, plant, profit center, responsible cost center) and to the settlement rule lines.
4. In test mode the BAPI is called and rolled back with BAPI_TRANSACTION_ROLLBACK, so every error is visible without posting.
5. In a real run BAPI_TRANSACTION_COMMIT is called after each successful order; the created order number and messages are listed per row.

## Authorization objects

- K_ORDER: Internal order create authorization by order type

## Frequently asked questions

### Can a budget be loaded to the orders too?

Budget entry is outside the scope of this program and is done with the standard budgeting transactions. If needed, a budget column can be added to the same file with a step that enters the budget after the orders are created; this extension adds 1–2 days to the effort range.

### How are order numbers assigned?

If the order type's number range is internal, the system assigns the number. If external numbering is used, an order number column is added to the template and the numbers from the file are used.

### Is the order released after creation?

The initial status of the order follows the status profile of the order type. If release right after creation is required, a separate status change step can be added to the program.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=co-internal-order-mass-create
