As the responsible SAP CO consultant, I recently implemented a number of S/4 HANA projects in different product versions. S/4 HANA 2021 is the newest version. I discovered that every consecutive release brought significant new features closer to realising the ultimate goal for Margin Analysis, which is the new account-based CO-PA in the Universal Journal.

I recently put several S/4 HANA projects into action in various product versions as the accountable SAP CO consultant. The newest iteration is S/4 HANA 2021. I found that each succeeding version brought important new features one step closer to achieving the ultimate aim for Margin Analysis, which is the new account-based CO-PA in the Universal Journal.

Instead, the accounts in the Universal Ledger have taken the place of the value fields, which eliminates the drawbacks of the previous CO-PA that was based on costing while attempting to reconcile with the “Financial Accounting P&L” in the General Ledger. In S/4HANA, the Finance module, this is actually one of THE key selling factors.

You may thus be pleased to learn that both the actual configuration work for CO-PA in S/4 and the resulting reporting needs have been greatly reduced. The next step is to talk about traits, and this blog post will do just that. How to use Margin Analysis “correctly” to develop custom characteristics.

This blog article consists of two sections, the first of which demonstrates a technique that doesn’t require developer knowledge. The second half will demonstrate a different approach, which may offer additional benefits but necessitates the use of developer expertise in order to be implemented.

CO-PA characteristics: Doing it “the ERP way”

If you look closer, you could see that not much appears to have changed in terms of CO-PA features except from the fact that there are now 60 available bespoke characteristics rather than the previous 50. And if you continue to add custom characteristics in the same manner that you always have, you will observe that everything functions exactly as it did in the costing-based CO-PA in ERP 6.0. In transaction KEA5, you can add a new characteristic that you generate to the relevant operational concern. There won’t be any issues for you, potentially with the exception of this one:

If you add your unique feature after the operational concern, you can encounter difficulties activating it. The Universal Ledger (table ACDOCA/P), despite the CO-PA operating concern’s objects and data structures functioning “just fine,” has not been updated as a result. The solution is to execute report FCO ADD COPA FIELD TO ACDOCA for your operational concern in the background before attempting to uncover the hint someplace concealed in the application log. The fact that the technical field names in ACDOCA terminate on “_PA” makes it easy to identify CO-PA features that were introduced to ACDOCA/P using KEA5.

Characteristic added by KEA5 in ACDOCA

Is everything okay? That’s the issue resolved, then? Well, it certainly seems that way because everything functions as planned. Everything? As soon as you use CO-PA-related Fiori apps from the S/4 Embedded Analytics, such as “Market Segments,” “Product Profitability,” or “Incoming Sales Orders,” you’ll see that your new custom characteristic is missing! Isn’t the fact that CO-PA does not support the SAP-delivered Fiori Apps a big flaw? What is the best course of action to allow businesses in the Fiori Launchpad access to CO-PA figures with customised characteristics? Do you need to develop your own unique CDS views and make them accessible for reporting utilising front end tools, such as, for example, the app “Custom Analytical Queries”?You could wonder if this is how SAP intended for Margin Analysis and Embedded Analytics to work. That would be at least one possibility. You may learn how to manually improve the SAP-delivered CDS views using extension views if you read blog entries like this excellent and thorough blog article from Masaaki Arai’s “Analytics on Universal Journal, the heart of SAP S/4HANA” – or Mayumi Lacerda Blak’s “Extending CDS view with COPA field including Key and Text”. However, it is undoubtedly tiresome, and you must become familiar with CDS views, new programming tools like Eclipse, etc. Exists a substitute choice? Yes, there is; continue reading.

New ways in S/4 HANA

That being the case, why do I think the foregoing technique is insufficient? It appears that everything is still in order from a technical standpoint as well as from the perspective of the Accounting and Controlling operations. Your custom characteristic will have been successfully modified in the new field in table ACDOCA, accounting records may be uploaded, and characteristics can be successfully derived.

My response is that there is an easier approach if you take the new path made popular by the S/4 Cloud version. Instead of using KEA5, I advise using the Fiori app “Custom Fields and Logic” to add a new custom characteristic to CO-PA. However, S/4 HANA 2020 must be used at the very least for this. A new field called “Market Segments” can be added to the Business Context in that app. By doing this, you can give SAP the ability to update the associated ODATA services and CDS views in an automatic manner. The SAP-delivered CO-PA Fiori reporting apps in particular can be used in their entirety.

So in the App we add a field (+) and choose “Accounting: Market Segment” as a “Business Context”:

Fiori App Custom Fields and Logic 1

Here we add a new field for “Material type”. We are not done, before we have not determined the data type of the new field. Here are the options:

  • Code list
  • Numerical Text
  • Text

Only “Code list” provides us the choice to give the end user a technical key and a name for the contents of that field. “Code list” is therefore the best choice in this case. Another choice would be “Text,” but in that case the user would only see the text and not any keys. The “Code list” approach’s drawback is that the app’s code list values must be manually updated even if, in this case, all current values are already maintained via datatype “MTART” in the ABAP data dictionary.

The ABAP data dictionary would be a better strategy, but SAP isn’t planning on using it at this time. Please refer to the second part of this article if you’re looking for a solution that interfaces with existing ABAP data types, albeit doing so will take some programming expertise.

However, as the material kinds are frequently open to extremely stable customization, it is acceptable to move further with this strategy.

We proceed with “Create and modify” after verifying the “Code list” with length 4 and entering the first value:

Fiori App Custom and fields and logic: Code list 1

Then we maintain all the possible fields values manually and “Publish”:

Fiori App Custom Fields and Logic: Code list 2

With the publication, the Universal Journal becomes aware of the new field. Wait till the publication procedure is complete.

Wait until the publishing process has completed


and then head over to the classic KEA0 transaction to add the new field you the operating concern in question:

Add new characteristic to Operating Concern

You have finished customising CO-PA when you save and activate. Please make sure to keep all of your transporters together while you move everything. In order to use the apps “Configure Software Packages” and “Register Extensions for Transport,” you may also need assistance with how to transport changes from the “Custom Fields and Logic” App.

The use of the new custom field in the business context of “Market Segments” in “UIs and Reports” is currently lacking. To do this, select the “UIs and Reports” tab in the “Custom Fields and Logic” app and tick the boxes next to the following entries:

  • Actual Plan for Journal Entry Item (I_ACTUALPLANJOURNALENTRYITEM)
  • Allocation Run Journal Entry (C_ALLOCRUNJOURNALENTRYITEM)
  • Allocation Run Result Item (C_ALLOCATIONRUNRESULTITEM)
  • Allocation Run Result Item Grouped (C_ALLOCATIONRUNRESULT)
  • G/L Account Balance – Cube (I_GLACCOUNTLINEITEMCUBE)
  • G/L Line Item with Semantic Tag Including FA (I_GLACCOUNTLINEITEMSEMTAG)
  • GL Account Line Item of Profitability – Cube (I_PROFITABILITYCUBE)
  • Import Financial Plan Data (FINS_ACDOC_PLAN_IMPORT_SRV)
  • Journal Entry Analyzer (C_GLLINEITEMSQ0001)
  • Journal Entry Item (I_JOURNALENTRYITEM)
  • Market Segment Plan Actual (C_MARKETSEGMENTPLANACTQ2501)
  • Market Segment Plan Actual (C_MARKETSEGMENTQ2501)
  • Product and Service Margins (C_MARGANLYSPRODANDSRVCQ)
  • Product and Service Margins – Cube (I_MARGANLYSPRODANDSRVCCUBE)
  • Profit Loss Actuals (C_PROFITANDLOSSQ2901)
  • Run Allocations (FCO_RUN_ALLOCATION_SRV)

which is simply an opinion on my part. Only if you wish to use the new feature in the new Universal Allocations App do you need to make the “allocation”-related settings.

Activate and transport.

Once more, you might have observed that entering the potential values for material type again in the app is superfluous because they are already recorded in the appropriate data type in the APAP Dictionary. If you can use a few basic developer abilities and have access to ADT (ABAP Development Tools) in Eclipse, I’ll describe how this technique can be further improved in the second section.

What you might take with you for your project work:

  1. Think twice before you start to create new CO-PA characteristics in KEA5.
  2. Get familiar with the new Fiori App “Custom fields and logic” in the business context “Market segments”.
  3. Get familiar on how to transport “Custom extensibility” changes.