CO Program Custom development Mass upload

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

  • KB21N Enter Direct Activity Allocation. Enters a direct activity allocation on screen; does not read a file.
  • KB23N Display Direct Activity Allocation. Displays posted activity allocations; does not upload.

Tables used

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

TableRoleAccessSystem
COEPCO Object: Line Items (by Period)Activity allocation CO line items (written through the BAPI)WriteECC + S/4
COSSCO Object: Cost Totals for Internal PostingsSecondary cost and activity quantity totalsWriteECC + S/4
CSLAActivity Type Master DataActivity type validity and unitReadECC + S/4
CSKSCost Center Master RecordValidity of sending and receiving cost centersReadECC + S/4
AUFKOrder Master DataExistence of the receiving internal orderReadECC + 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

ParameterDescriptionTypeReference fieldRequiredExample
P_KOKRSControlling areaSingle valueCSLA-KOKRSYes1000
P_FILEUpload file (XLSX or CSV)Single value—YesC:\temp\faaliyet_ekim.xlsx
P_BUDATPosting dateSingle valueCOBK-BUDATYes31.10.2026
P_BLTXTDocument header textSingle valueCOBK-BLTXTNoEkim bakım saatleri
P_PACKLines per documentSingle value—No300
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
1Sending cost centerCSKS-KOSTLYes
2Activity typeCSLA-LSTARYes
3Receiving cost centerCSKS-KOSTLNo
4Receiving internal orderAUFK-AUFNRNo
5QuantityCOEP-MBGBTRYes
6UnitCSLA-LEINHNo
7TextCOEP-SGTXTNo

Sample upload file

1Sending cost center *Activity type *Receiving cost centerReceiving internal orderQuantity *UnitText
24110BAKIM412046HLathe line preventive maintenance
34110BAKIM430012.50HForklift repair
44110BAKIM60000021130HTool shop project assembly
54150MAKSAAT412080HWelding robot usage
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1RowCalculated Row number in the file
2Sending cost centerCSKS-KOSTL
3Activity typeCSLA-LSTAR
4ReceiverCalculated Receiving cost center or internal order number
5QuantityCOEP-MBGBTR
6StatusCalculated From the BAPI return messages: posted, test OK or error
7CO documentCOBK-BELNR
8MessageCalculated First error or success message from the BAPI return table

Sample result list

RowSending cost centerActivity typeReceiverQuantityStatusCO documentMessage
24110BAKIM412046Posted200015240Document posted
34110BAKIM430012.50Posted200015240Document posted
44110BAKIM60000021130Posted200015240Document posted
54150MAKSAAT412080ErrorNo 2026 plan price for the activity type
A view built with fictional sample data; not real system data.

How does the program work?

  1. The file is read; sending cost center, activity type, receiver (cost center or internal order) and quantity are mandatory on every row.
  2. 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.
  3. Rows are split into packages of P_PACK lines and checked with BAPI_ACC_ACTIVITY_ALLOC_CHECK; failed packages are resolved row by row.
  4. 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.
  5. 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

CO Program Custom Interface

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 …

COSR · TKA03 · CSKS · AUFK

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 Direct Activity Allocation Upload from Excel