CO Program Custom development Mass upload

Mass Internal Order Creation from Excel with Settlement Rule

Short answer: 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.

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

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.

Who uses it? Controllers, teams that manage marketing and campaign budgets, and CO teams that open many internal orders at the start of the year.

Closest standard alternatives

  • KO01 Create Internal Order. Creates internal orders one at a time; no bulk creation from a file.
  • KO02 Change Internal Order. Adds the settlement rule later, one order at a time.

Tables used

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

TableRoleAccessSystem
AUFKOrder Master DataInternal order master: type, short text, company code, profit center, responsible cost centerWriteECC + S/4
COBRBSettlement Rule Distribution RulesSettlement rule: receiving cost center, percentage, settlement typeWriteECC + S/4
CSKSCost Center Master RecordValidity check of the responsible and receiving cost centersReadECC + S/4

BAPIs and functions used

  • BAPI_INTERNALORDER_CREATECreate Internal Order. Creates the internal order with master data and settlement rule
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves successful orders permanently
  • BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back the change in test mode and for failed rows

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
P_FILEUpload file (XLSX or CSV)Single value—YesC:\temp\kampanya_siparisleri_2027.xlsx
P_KOKRSControlling areaSingle valueAUFK-KOKRSYes1000
P_TESTTest mode (check without posting)Checkbox—NoX

Input file columns

The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.

#ColumnTarget fieldRequired
1Order typeAUFK-AUARTYes
2Short textAUFK-KTEXTYes
3Company codeAUFK-BUKRSYes
4PlantAUFK-WERKSNo
5Profit centerAUFK-PRCTRNo
6Responsible cost centerAUFK-KOSTVNo
7Receiving cost centerCOBRB-KOSTLYes
8Settlement percentageCOBRB-PROZSNo
9Settlement typeCOBRB-PERBZNo

Sample upload file

1Order type *Short text *Company code *PlantProfit centerResponsible cost centerReceiving cost center *Settlement percentageSettlement type
204002027 spring campaign10001000PC120043004300100PER
30400Dealer meeting January 202710001000PC120043004310100FUL
40400Trade fair stand 20271000PC120043004399100PER
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1RowCalculated Row number in the file
2OrderAUFK-AUFNR
3Short textAUFK-KTEXT
4StatusCalculated From the BAPI return messages: created, checked or error
5MessageCalculated First error or success message from the BAPI return table

Sample result list

RowOrderShort textStatusMessage
24002012027 spring campaignCreatedOrder 400201 created with settlement rule
3400202Dealer meeting January 2027CreatedOrder 400202 created with settlement rule
4Trade fair stand 2027ErrorCost center 4399 does not exist in controlling area 1000
A view built with fictional sample data; not real system data.

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.

Performance notes

Files with a few hundred orders run in the foreground; for thousands of orders a background job is recommended. Committing per order isolates failed rows.

Features

  • Test mode (check without posting)
  • Line-by-line result and error log
  • Download failed lines as a separate file Failed rows can be downloaded to a separate file, corrected and uploaded again.
  • Export to Excel An empty upload template can be downloaded as Excel.
  • Runs as a background job

Authorization objects

  • K_ORDERInternal 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.

Related reports

CO Report Custom ALV report

Internal Order Budget Availability Report

A custom ALV report that compares the annual or overall budget of internal orders with actual costs and open commitments, and shows the remaining …

AUFK · BPJA · BPGE · COSP

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: Mass Internal Order Creation from Excel with Settlement Rule