Template Allocations. Other alternative to post Activities

Template Allocations. Other alternative to post Activities: Hi Friends!  I was looking for a topic that no much info is post on the internet and found interesting write about Template Allocation.

Im going to share a  example of what you can do with Templates. The topic is huge and you can find lot info in SAP Help or in the ABC Costing academy course… this is just an appetizer, in order to kwow a bit of this functionality.

The basic:

There are lots ways to post a activity to a receiver (I guess you understand the concept of a sender and a receiver, and also know what is an activity type and how to plan), Examples are PP/PM/PS Notifications, KB21N from CO, CATS (I love cats!), indirect activity allocations or with bapi BAPI_ACC_ACTIVITY_ALLOC_POST.

Imaginary scenario:

PP Work Center have a max of 6 activities to post. Lot of companies say this is to few (well in PM/PS system thees only have 1, i dont understand why, but this is not our topic). Imagine you want to post aditional activities at PeriodEndClosing. Imagine your key user want to post 2 activities, 1 based on the ActualScrap of the PP Order and other based in a activity PP Boys post to the order with CO11N (yep, 6 are not enough).

If you analize carefully all the  options i mention, non of them can accomplish the desired behavior (Well the ZBAPI can do whatever).

*** PS. the indirect activity allocation cant face the requirement of post based in actual activity posted on the PP Order. If you want to validate, go on!

The Customizing

1. I create a Template (tcode CPT2), that have 2 records>



– Type: Represent what the row of the template is going to do. In my example, post activity from cost center.

– Object: Refer to the type, in this case the Sender CostCenter/Activity Type. In this example, is static but we can change it dynamically.

– Actual Quantity: the way the template calculate the actual QTY we will post to the reciever object, in our scenario a PP Order.

+ The 1st line post from the cost center 6000_PP001 with the activity PP0001 (Column Object) to the Reciever Order Based on the actual scrap posted

In order to do that, i use the standard method “OrderHeaderScrapQtyConfirm” that calculate the value. No abap code needed for this. This TemplateFunction do all the hard work!!

+ The 2nd line post from the cost center 6000_PP001 with the activity PP0002 to the Reciever Order, based on the actual quantity of the activity type ‘PP0000’ previosly posted to the PP Order (PP boys post this activvity wth CO11N) , activity ‘PP0000’  was posted from cost center “6000_PP001”.

In order to do this, i create a template function “ZAllocatedActualQtyOrder01” as a copy of standard TemplateFunction “AllocatedActualQtyObjects” and did few changes (2 aditional variables, and 1 line of code).  I did because the standard Function dont accomplish exactly what i want. The message here is I spend less than 10 minutes modifying the function, OK i know the function and also i did by my self so i dont need to tell a abap, give a specification and all the typical stuff necesary for a requirement but this is 1000 times easier and faster than create a ztcode from the scratch).

You specify the parameters that enter to the function. In this case, i set HardCode the Activity Type, but the cost center is a parameter {SenderCostCenter} and as you can imagine refer to the cost center in the column {Object} of the template, in our case “6000_PP001”

2. Create all the overhead stuff and assign to the PP Order. In tcode KTPF assing the Template to the Controlling Area / CostingSheet/Overhead Key/Enviroment. This is the only difference with the classical Overhead customizing .

* there are lot of info of overhead on the internet, so im not going to explain this custo.

The Master Data  (No details, there are lot of info about this on the internet)

+ Create Activity, CostElements for activity Posting, Plan the activity in the cost center, and more…

+ Create a New Material FERT. Assing a OverheadGroup. This is our link to the template.

+ Create a WorkCenter

+ Create BOM, Routing,

+ Create PP Order, Post Activity and Scrap.

The Template in action:

1. Check the PP Order. You can see the actual activity qty PP0000 is 10.


2. Also In the next screen you can see the actual Scrap “15” posted to the PP Order.


I run the Template Allocation Posting (tcode CPTA )

System post activity pp0001 with qty = 15 = The confirmed scrap in the pp order and pp0002 with qty = 10 = the actual post of activity pp0000.


Now you check the PP Order Cost and find the activity pp0001 and PP0002 posted with the template


What do you think?

The template use TemplateFunctions, assigned to a ABAP function. You can copy and modify the standard functions. In tcode CTU6 you can see all the available standard functions.


PS. I spend about 4hours doing the custo and creating the master data from the scratch, taking the screenshots and writing here .. Copy a standard funcion minimize the abap effort.


New NetWeaver Information at SAP.com

Very Helpfull



User Rating: Be the first one !