Mass Direct Activity Allocation Upload from Excel
Short answer: A custom program that reads hours and machine times spent by workshops, maintenance or service units from an Excel file and posts them as direct activity allocations from the sending cost center to a receiving cost center or internal order. It checks first, then lists the CO document number and message per row.
- Estimated effort
- M · 3–5 working days
- System
- ECC and S/4HANA
- Tables
- 5
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
KB21N enters a direct activity allocation on screen as one document; it does not read a file. Hour records are often kept in a tracking tool outside SAP or in Excel, and hundreds of rows are keyed in at month end. An upload with a test mode that separates failed rows and posts the rest is needed.
Who uses it? Cost accountants and controllers who allocate the hours of maintenance and service units.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| COEPCO Object: Line Items (by Period) | Activity allocation CO line items (written through the BAPI) | Write | ECC + S/4 |
| COSSCO Object: Cost Totals for Internal Postings | Secondary cost and activity quantity totals | Write | ECC + S/4 |
| CSLAActivity Type Master Data | Activity type validity and unit | Read | ECC + S/4 |
| CSKSCost Center Master Record | Validity of sending and receiving cost centers | Read | ECC + S/4 |
| AUFKOrder Master Data | Existence of the receiving internal order | Read | ECC + S/4 |
S/4HANA notes
- COEP → ACDOCA: In S/4HANA actual CO line items are stored in ACDOCA; reads on COEP go through the compatibility view V_COEP.
- COSS → ACDOCA: In S/4HANA COSS is a view, not a table; internal actual postings are read from ACDOCA.
BAPIs and functions used
- BAPI_ACC_ACTIVITY_ALLOC_CHECKAccounting: Check Activity Allocation. Checks the package without posting
- BAPI_ACC_ACTIVITY_ALLOC_POSTAccounting: Post Activity Allocation. Posts the direct activity allocation as a CO document
- BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves successful packages permanently
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| P_KOKRS | Controlling area | Single value | CSLA-KOKRS | Yes | 1000 |
| P_FILE | Upload file (XLSX or CSV) | Single value | — | Yes | C:\temp\faaliyet_ekim.xlsx |
| P_BUDAT | Posting date | Single value | COBK-BUDAT | Yes | 31.10.2026 |
| P_BLTXT | Document header text | Single value | COBK-BLTXT | No | Ekim bakım saatleri |
| P_PACK | Lines per document | Single value | — | No | 300 |
| P_TEST | Test mode (check without posting) | Checkbox | — | No | X |
Input file columns
The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.
| # | Column | Target field | Required |
|---|---|---|---|
| 1 | Sending cost center | CSKS-KOSTL | Yes |
| 2 | Activity type | CSLA-LSTAR | Yes |
| 3 | Receiving cost center | CSKS-KOSTL | No |
| 4 | Receiving internal order | AUFK-AUFNR | No |
| 5 | Quantity | COEP-MBGBTR | Yes |
| 6 | Unit | CSLA-LEINH | No |
| 7 | Text | COEP-SGTXT | No |
Sample upload file
| 1 | Sending cost center * | Activity type * | Receiving cost center | Receiving internal order | Quantity * | Unit | Text |
|---|---|---|---|---|---|---|---|
| 2 | 4110 | BAKIM | 4120 | 46 | H | Lathe line preventive maintenance | |
| 3 | 4110 | BAKIM | 4300 | 12.50 | H | Forklift repair | |
| 4 | 4110 | BAKIM | 600000211 | 30 | H | Tool shop project assembly | |
| 5 | 4150 | MAKSAAT | 4120 | 80 | H | Welding robot usage |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Row | Calculated Row number in the file |
| 2 | Sending cost center | CSKS-KOSTL |
| 3 | Activity type | CSLA-LSTAR |
| 4 | Receiver | Calculated Receiving cost center or internal order number |
| 5 | Quantity | COEP-MBGBTR |
| 6 | Status | Calculated From the BAPI return messages: posted, test OK or error |
| 7 | CO document | COBK-BELNR |
| 8 | Message | Calculated First error or success message from the BAPI return table |
Sample result list
| Row | Sending cost center | Activity type | Receiver | Quantity | Status | CO document | Message |
|---|---|---|---|---|---|---|---|
| 2 | 4110 | BAKIM | 4120 | 46 | Posted | 200015240 | Document posted |
| 3 | 4110 | BAKIM | 4300 | 12.50 | Posted | 200015240 | Document posted |
| 4 | 4110 | BAKIM | 600000211 | 30 | Posted | 200015240 | Document posted |
| 5 | 4150 | MAKSAAT | 4120 | 80 | Error | No 2026 plan price for the activity type |
How does the program work?
- The file is read; sending cost center, activity type, receiver (cost center or internal order) and quantity are mandatory on every row.
- Checks: the sending and receiving cost centers must be valid in CSKS on the posting date, the internal order must exist in AUFK, the activity type must be valid in CSLA and the unit in the file must match CSLA-LEINH.
- Rows are split into packages of P_PACK lines and checked with BAPI_ACC_ACTIVITY_ALLOC_CHECK; failed packages are resolved row by row.
- In test mode only the check result is shown. In a real run BAPI_ACC_ACTIVITY_ALLOC_POST is called and then saved with BAPI_TRANSACTION_COMMIT.
- The posted value is calculated with the planned activity price and written to COEP/COSS; the CO document number, errors and a file of failed rows are listed.
Performance notes
Keeping the package size between 200 and 500 lines keeps the number of documents reasonable and makes reprocessing easy after an error. Master data for the cost center and activity type checks is read once at the start.
Features
- Test mode (check without posting)
- Line-by-line result and error log
- Download failed lines as a separate file Failed rows are downloaded to a separate file to be fixed and uploaded again.
- Runs as a background job
Authorization objects
- K_CSKSAuthorization to post to sending and receiving cost centers
- K_ORDERAuthorization to post to the receiving internal order
- K_CCACost center accounting transaction authorization
Frequently asked questions
How is the allocated amount calculated?
The quantity is multiplied by the planned price of the activity type on the sending cost center. Without a plan price the row fails; prices are planned in KP26.
Can an incorrect upload be reversed?
Yes, the resulting CO document is reversed with KB24N. Because the program lists the document number, the reversal is easy.
Can activities be allocated to production orders too?
Activities usually reach production orders through confirmations. This program covers cost centers and internal orders; other receiver types are assessed as additional scope.
Related reports
Activity Type Plan vs Actual Rate and Under/Over-Absorption Report
A custom ALV report that compares the plan rate per cost center and activity type with the actual rate derived from actual costs, and shows the under- …
Statistical Key Figure Actuals Upload Interface
A custom interface that reads values such as headcount, kWh or square meters delivered by HR, energy monitoring or facility systems from a file and …
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.