Mass Primary Cost Reposting Upload from Excel
Short answer: A custom program that moves primary costs posted to the wrong cost center or internal order to the right object in bulk from Excel rows. It reposts in CO without touching the FI document, checks everything in test mode first and lists the CO document number of every row.
- Estimated effort
- M · 3–5 working days
- System
- ECC and S/4HANA
- Tables
- 6
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
KB11N enters one reposting document on a screen; it reads no file and gives no per-row check list. The dozens of corrections that come from cost center owners at month-end are therefore keyed in by hand. Reversing and re-posting in FI is usually unwanted because it affects tax and subledgers.
Who uses it? Controllers, month-end close teams and cost accountants who collect cost center corrections.
Closest standard alternatives
- KB11N Enter Manual Repostings of Costs. Enters one reposting document on screen; no bulk posting from a file.
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| COBKCO Object: Document Header | Header of the resulting CO reposting document | Write | ECC + S/4 |
| COEPCO Object: Line Items (by Period) | Sender and receiver object line items | Write | ECC + S/4 |
| CSKSCost Center Master Record | Check that the cost center is valid and open for posting | Read | ECC + S/4 |
| AUFKOrder Master Data | Existence and object number of the internal order | Read | ECC + S/4 |
| CSKBCost Elements (Controlling Area Data) | Check that the cost element is primary | Read | ECC + S/4 |
| COSPCO Object: Cost Totals for External Postings | Period balance of the sending object (optional check) | 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.
- COSP → ACDOCA: In S/4HANA COSP is a view, not a table; actual totals are calculated from ACDOCA.
BAPIs and functions used
- BAPI_ACC_PRIMARY_COSTS_POSTAccounting: Post Primary Costs. Reposts primary costs in CO from sender to receiver
- BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves successful documents permanently
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| P_FILE | Upload file (XLSX or CSV) | Single value | — | Yes | C:\temp\maliyet_duzeltme.xlsx |
| P_KOKRS | Controlling area | Single value | COBK-KOKRS | Yes | 1000 |
| P_TEST | Test mode (check without posting) | Checkbox | — | No | X |
| P_BALCHK | Check the sender balance | 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 | Document key | By rule Rows with the same key are posted in one CO document | Yes |
| 2 | Posting date | COBK-BUDAT | Yes |
| 3 | Sending cost center | CSKS-KOSTL | No |
| 4 | Sending order | AUFK-AUFNR | No |
| 5 | Receiving cost center | CSKS-KOSTL | No |
| 6 | Receiving order | AUFK-AUFNR | No |
| 7 | Cost element | CSKB-KSTAR | Yes |
| 8 | Amount | COEP-WTGBTR | Yes |
| 9 | Currency | COEP-TWAER | Yes |
| 10 | Item text | COEP-SGTXT | No |
Sample upload file
| 1 | Document key * | Posting date * | Sending cost center | Sending order | Receiving cost center | Receiving order | Cost element * | Amount * | Currency * | Item text |
|---|---|---|---|---|---|---|---|---|---|---|
| 2 | D01 | 11/28/2026 | 4310 | 4120 | 770100 | 12,500 | TRY | Calibration service correction | ||
| 3 | D01 | 11/28/2026 | 4310 | 4125 | 770100 | 4,800 | TRY | Laboratory share | ||
| 4 | D02 | 11/28/2026 | 5200 | 700145 | 760100 | 18,000 | TRY | Trade fair stand invoice to order |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Row | Calculated Row number in the file |
| 2 | Document key | Calculated Document key from the file |
| 3 | CO document | COBK-BELNR |
| 4 | Status | Calculated Posted, test passed or error |
| 5 | Message | Calculated First error or success message from the BAPI return table |
Sample result list
| Row | Document key | CO document | Status | Message |
|---|---|---|---|---|
| 2 | D01 | 200091204 | Posted | Document 200091204 posted |
| 3 | D01 | 200091204 | Posted | Document 200091204 posted |
| 4 | D02 | Error | Order 700145 is TECO, posting not allowed |
How does the program work?
- The file is read; rows with the same document key are collected into one CO document.
- Every row is checked for the existence and postability of sender and receiver: the cost center must be valid in CSKS on the posting date and not locked for actual primary costs, and the internal order must exist in AUFK with a status that allows posting.
- The cost element is confirmed as primary through CSKB-KATYP; if selected, the sender is checked for enough balance on that period and cost element to move.
- Rows are mapped to the BAPI_ACC_PRIMARY_COSTS_POST structures: document header (controlling area, posting date, text) and sender/receiver lines. In test mode the BAPI is called as a test.
- In a real run BAPI_TRANSACTION_COMMIT is called; the resulting CO document (COBK/COEP) and messages are listed per row.
Performance notes
Each document key is one BAPI call; files with a few hundred rows run in seconds in the foreground. The balance check reads COSP by object and period key.
Features
- Test mode (check without posting)
- Line-by-line result and error log
- Download failed lines as a separate file Failed rows can be corrected and uploaded again with the same template.
- Export to Excel An empty upload template can be downloaded as Excel.
Authorization objects
- K_CCAActual posting authorization in cost center accounting
- K_ORDERPosting authorization for internal orders
Frequently asked questions
Does the program change the FI document?
No. The reposting happens only in CO; the FI document, tax and subledgers are not affected. If profit center or functional area changes, the new general ledger or, on S/4HANA, the real-time integration carries it to the FI side as well.
Can I repost into a closed period?
No. The CO period lock (OKP1) and the FI period opening settings apply. The program shows rows in a locked period as errors in test mode.
Can the original document be referenced?
Yes. An original FI document number column can be added to the template; the program then reads the original line, checks amount and cost element, and reposts per line much like KB61.
Packages that include this solution
Cost Center Reorganization Pack
A four-component pack for rebuilding the cost center structure after an organizational change: mass cost center creation and change from Excel, cost …
Related reports
Mass Direct Activity Allocation Upload from Excel
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 …
Cost Center Line Items with Vendor, Purchase Order and Employee Report
A custom ALV report that shows cost center actual line items on one row with the purchase order, vendor name, employee name and source document. The …
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.