CO Program Custom development Mass upload

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.

TableRoleAccessSystem
COBKCO Object: Document HeaderHeader of the resulting CO reposting documentWriteECC + S/4
COEPCO Object: Line Items (by Period)Sender and receiver object line itemsWriteECC + S/4
CSKSCost Center Master RecordCheck that the cost center is valid and open for postingReadECC + S/4
AUFKOrder Master DataExistence and object number of the internal orderReadECC + S/4
CSKBCost Elements (Controlling Area Data)Check that the cost element is primaryReadECC + S/4
COSPCO Object: Cost Totals for External PostingsPeriod balance of the sending object (optional check)ReadECC + 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

ParameterDescriptionTypeReference fieldRequiredExample
P_FILEUpload file (XLSX or CSV)Single value—YesC:\temp\maliyet_duzeltme.xlsx
P_KOKRSControlling areaSingle valueCOBK-KOKRSYes1000
P_TESTTest mode (check without posting)Checkbox—NoX
P_BALCHKCheck the sender balanceCheckbox—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
1Document keyBy rule Rows with the same key are posted in one CO documentYes
2Posting dateCOBK-BUDATYes
3Sending cost centerCSKS-KOSTLNo
4Sending orderAUFK-AUFNRNo
5Receiving cost centerCSKS-KOSTLNo
6Receiving orderAUFK-AUFNRNo
7Cost elementCSKB-KSTARYes
8AmountCOEP-WTGBTRYes
9CurrencyCOEP-TWAERYes
10Item textCOEP-SGTXTNo

Sample upload file

1Document key *Posting date *Sending cost centerSending orderReceiving cost centerReceiving orderCost element *Amount *Currency *Item text
2D0111/28/20264310412077010012,500TRYCalibration service correction
3D0111/28/2026431041257701004,800TRYLaboratory share
4D0211/28/2026520070014576010018,000TRYTrade fair stand invoice to order
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1RowCalculated Row number in the file
2Document keyCalculated Document key from the file
3CO documentCOBK-BELNR
4StatusCalculated Posted, test passed or error
5MessageCalculated First error or success message from the BAPI return table

Sample result list

RowDocument keyCO documentStatusMessage
2D01200091204PostedDocument 200091204 posted
3D01200091204PostedDocument 200091204 posted
4D02ErrorOrder 700145 is TECO, posting not allowed
A view built with fictional sample data; not real system data.

How does the program work?

  1. The file is read; rows with the same document key are collected into one CO document.
  2. 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.
  3. 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.
  4. 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.
  5. 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

CO Package Custom

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 …

4 components · v1.0

Related reports

CO Program Custom Mass upload

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 …

COEP · COSS · CSLA · CSKS

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 Primary Cost Reposting Upload from Excel