Statistical Key Figure Actuals Upload Interface
Short answer: 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 posts them as statistical key figures to cost centers and internal orders. It runs in the background from an application server folder, with a test mode and a per-row log.
- Estimated effort
- M · 3–5 working days
- System
- ECC and S/4HANA
- Tables
- 4
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
KB31N enters statistical key figures on screen; it cannot read a file delivered from outside and cannot be scheduled. For hundreds of cost centers the values are keyed in or pasted from Excel every month, with a high risk of errors and gaps. For the cycles to run correctly, the values need to arrive automatically before the close.
Who uses it? Cost accountants, controllers who want to automate the month-end close, and interface owners.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| COSRCO Object: Statistical Key Figure Totals | Statistical key figure period values: read for the delta, written through the BAPI | Read / write | ECC + S/4 |
| TKA03Statistical Key Figures | Key figure definition, unit and category | Read | ECC + S/4 |
| CSKSCost Center Master Record | Validity of the cost center on the posting date | Read | ECC + S/4 |
| AUFKOrder Master Data | Existence and object number of the receiving internal order | Read | ECC + S/4 |
BAPIs and functions used
- BAPI_ACC_STAT_KEY_FIG_POSTAccounting: Post Statistical Key Figures. Posts statistical key figure actuals as a CO document
- BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves successful packages permanently
- BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back the change in test mode and for failed packages
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| P_KOKRS | Controlling area | Single value | TKA03-KOKRS | Yes | 1000 |
| P_PATH | Inbound folder or file path | Single value | — | Yes | /interface/co/skf/in/ |
| P_BUDAT | Posting date | Single value | COBK-BUDAT | Yes | 31.10.2026 |
| P_DELTA | Post only the difference for totals-type key figures | Checkbox | — | No | X |
| 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 | Cost center | CSKS-KOSTL | No |
| 2 | Internal order (when cost center is blank) | AUFK-AUFNR | No |
| 3 | Statistical key figure | TKA03-STAGR | Yes |
| 4 | Value | By rule Period value; when P_DELTA is set, the difference to the current COSR value is posted | No |
| 5 | Unit | TKA03-MSEHI | No |
| 6 | Text | COEP-SGTXT | No |
Sample upload file
| 1 | Cost center | Internal order (when cost center is blank) | Statistical key figure * | Value | Unit | Text |
|---|---|---|---|---|---|---|
| 2 | 4110 | PERS | 15 | EA | October headcount | |
| 3 | 4120 | PERS | 31 | EA | October headcount | |
| 4 | 4300 | KWH | 26,900 | KWH | October energy use | |
| 5 | 600000211 | KWH | 1,250 | KWH | Tool shop project energy |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Row | Calculated Row number in the file |
| 2 | Cost center | CSKS-KOSTL |
| 3 | Internal order | AUFK-AUFNR |
| 4 | Key figure | TKA03-STAGR |
| 5 | Posted value | Calculated File value or the difference calculated with P_DELTA |
| 6 | Status | Calculated From the BAPI return messages: posted, test OK, skipped or error |
| 7 | CO document | COBK-BELNR |
| 8 | Message | Calculated First error or success message from the BAPI return table |
Sample result list
| Row | Cost center | Internal order | Key figure | Posted value | Status | CO document | Message |
|---|---|---|---|---|---|---|---|
| 2 | 4110 | PERS | 15 | Posted | 200015102 | Document posted | |
| 3 | 4120 | PERS | 31 | Posted | 200015102 | Document posted | |
| 4 | 4300 | KWH | 0 | Skipped | Value already posted for the period, no difference | ||
| 5 | 600000211 | KWH | 1,250 | Error | Order is technically completed |
How does the program work?
- The file is read from the inbound folder on the application server (background) or from the user’s PC; the processed file is moved to an archive folder.
- Every row is checked: the key figure must exist in TKA03, the cost center must be valid in CSKS on the posting date or the internal order must exist in AUFK; the unit must match TKA03-MSEHI.
- When P_DELTA is set, for totals-type key figures the current value of the period is read from COSR and only the difference is posted, so uploading the same file twice does not double the value.
- Rows are packed into the BAPI_ACC_STAT_KEY_FIG_POST structure; in test mode the BAPI is called and rolled back with BAPI_TRANSACTION_ROLLBACK.
- In a real run BAPI_TRANSACTION_COMMIT is called; the resulting CO document number, errors and skipped rows are listed in the log and can be emailed to the owner.
Performance notes
One CO document can hold hundreds of lines; splitting the file into packages by key figure or cost center group makes reprocessing easier after an error. The COSR read is done in one pass with the object list.
Features
- Test mode (check without posting)
- Line-by-line result and error log
- Runs as a background job Runs automatically at a set time after the file arrives in the folder.
- Download failed lines as a separate file
- Send the result by email Failed rows are emailed to the owner.
Authorization objects
- K_CSKSAuthorization to post to the cost center
- K_ORDERAuthorization to post to the internal order
- K_CCACost center accounting transaction authorization
Frequently asked questions
What should the file format be?
Semicolon-separated CSV or XLSX can be used. If the source system sends its own code instead of the cost center, a mapping table is included in the scope.
What happens if the same file is processed twice by mistake?
With P_DELTA on, the difference to the current value is posted, so the second upload has zero difference and the row is skipped. The processed file is moved to the archive folder.
Can plan values be uploaded too?
This interface covers actual values. A similar upload for plan statistical key figures (KP46) can be built with a separate BAPI as additional scope.
Related reports
Cost Center Cost Plan Upload from Excel
A custom program that loads periodic plan amounts per cost center and cost element from a budget file into the CO plan in bulk. It checks every row in …
Missing or Late Statistical Key Figures Check Report
A custom ALV report that checks, per cost center, whether the statistical key figures used as keys in assessment and distribution cycles (headcount, …
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.