Financial Management Blogs by SAP
Get financial management insights from blog posts by SAP experts. Find and share tips on how to increase efficiency, reduce risk, and optimize working capital.
Showing results for 
Search instead for 
Did you mean: 
SAP Profitability & Performance Management (PaPM) is an amazing application to manage Cost Allocation needs of an organization. Its advanced and flexible business modelling capability provides amplified insights with multidimensional profit & cost analysis.

In one of my PaPM engagements in the early part of the current year, I came across some of the complex cost allocation use cases but never imagined that PaPM can simply the solution by building robust & flexible data modelling and at the same time provide sustainable solution to dynamic cost allocation needs. In the same engagement there was a need to post cost allocation results as Secondary Posting to give similar impact of KB15N (Manual Cost Allocation) to the books of accounts in SAP S/4HANA. Thus Remote Function Adaptor (abbreviated as RFA)Type  "Finance General Ledger Items" was not considered as the right option and led  to the solution of RFA type "External Function" and call custom function module built on "BAPI_ACC_MANUAL_ALLOC_POST" in SAP ERP system.   Refer the blog -

But with the release of SP13 of PaPM 3.0 few months back, we now have an out of box capability to post Secondary Cost Element Posting back in SAP ERP systems (SAP S/4HANA for example) and avoid a custom function module.

In this blog I have attempted to explain how to setup a RFA type "Secondary Cost Element Posting" with an example of simple cost allocation based on Headcounts. The business need is to allocate a cost from cost pool (combination of certain Primary Expense GL Accounts & Cost Centers) of a specific Business Unit (abbreviated as BU) to Production Cost Center based on its head counts and subsequently consider this allocated cost for Production Activity Rate Calculation. Thus this cost allocation is like an absorption of cost originally booked to cost pool and which needs to be accounted with Secondary Cost Elements (Cost Element Type : 42 - Assessment) to ensure that Primary GL Account's periodic balances are intact.

In this example, Cost Allocation is happening from specific sender cost center to specific set of receiver cost centers as shown in below picture. Thus allocation settings are maintained accordingly.


Let's begin with Allocation function and then move to  RFA setup for Secondary posting.

  • Cost Allocation Setup &  Results

Allocation Type is set to 'Allocation with Offset Records' to ensure offset records are generated with opposite sign (+/-)

Rule Type is set to 'Direct' to ensure cost allocation from  specific sender cost center to specific set of receiver cost centers

Both Sender & Receiver data are provided through a View function where they enriched with a common parameter i.e. 'Allocation Cycle' (UC01 for example) to allow direct allocation to happen.


Sender Cost is summarized by GL Account & Cost Center for each Allocation Cycle

Receiver / Allocation Driver Data is consolidated by Receiver Cost Centers and their head counts (Statistical Key Figure in this example) for each Allocation Cycle

Allocation function is performed for Cost allocation based on Head Count associated to each receiver cost center


  • Compiling data for Secondary Posting

Cost Allocation results are read in a View function and enriched with GL Account of Cost Element category 42. An identifier is assigned for each unique combination of record to consider each one as a separate record  for subsequent RFA function


  • RFA Secondary Cost Element Posting Setup and Results

This section is dealt with RFA setup which is assigned with 'Secondary Cost Element Posting' as Remote Function Adaptor Type which uses standard BAPI 'BAPI_ACC_MANUAL_ALLOC_POST'.

In this example , as postings are going to happen in same instance where both SAP PaPM & SAP ERP system reside thus RFC Destination not maintained.

Input Tab

Here Input function which is a source of allocated cost results with additional values required to post CO Secondary document is assigned. It should provide all field values which are to be mapped to the required components of the RFA Secondary Posting shown in Rules Tab. Like in this example, both Sender & Receiver Cost Centers  and GL Account are few of the required fields which need to be mapped.


Signature Tab

Under 'Signature' Tab, assign standard field 'BELNR - Document Number' to capture the CO Document in PaPM which is generated from SAP ERP as an output of the RFA Secondary Posting run.


Rules tab

It has following fields, under component column which can be categorized as Header, item and Grouping Control. They are explained below:

  • Header components which are of Input type and marked mandatory,  are to capture inputs for header section of the document.

  • Input components which are of Input type and marked mandatory,  are to capture inputs for line item section of the document.

  • Grouping Control gives input to select the records which can be grouped together in a single document.

  • There is one header Component of output type which returns the CO Document generated in SAP ERP. It needs to be mapped to a field meant to this as output.

Against the relevant components,  the column 'Field' is maintained, either with those fields which are part of Input Function or with the values using Formula option.


In this example, mostly all components values are derived from the input function, except few like Posting Date which is hardcoded using formula option. It is just to showcase the capability of formula where you can either hardcode the values or select variable field as input.


Details of the component & field mapping are mentioned in below table.

Component Field Based on Input Function / Formula
co_area Controlling Area Input Function
doc-hdr_tx Custom Field (Identifier for each unique record) Input Function
doc_no (output) Document Number (BELNR assigned in Signature Tab) Formula
postgdate '20201021' (YYYYMMDD) Formula
trans_curr Transaction Currency Input Function
username SY-UNAME Formula
grouping Custom Field (Identifier for each unique record) Input Function
send_cctr Sender CC Input Function
cost_elem Posting GL Accounts Input Function
value_tcur Amount in Transaction Currency Input Function
rec_cctr Receiver CC Input Function


Once the RFA function is executed, Secondary Posting is performed to account for Cost allocation results. CO Document is captured in mapped field 'BELNR' and can be seen on result screen.


In SAP ERP system, CO Secondary Posting  can be verified using T.code KSB5 - Display Actual Cost Document and associated FI Posting also can be checked


I hope this blog would have given relevant inputs on how to use RFA with Secondary Cost Element Posting option and meet such similar business requirement by leveraging  this out of box capability of PaPM.

Thanks for spending time on this blog. If you have any feedback, please leave a comment.


Here are some supporting links on this topic:

SAP Notes on RFA - Secondary Posting

3106191 - FS-PER-OP Rel 3.0 SP16 - Activation error for RFA type PR and RFA type SP

3014983 - FS-PER Rel 3.0 SP14 - New Remote Function Adapter Types: Purchase Order and Manual Cost Al...

3084037 - FS-PER-OP Rel 3.0 SP15 - New structure "customer_fields" added for RFA Secondary Cost Elem...


SAP PaPM User Guide (Rel 3.0 | SP15)