How-to add custom characteristics in S/4HANA CO-PA (Margin Analysis) on-premise – properly (1/2)
I implemented recently as the responsible SAP CO consultant several S/4 HANA projects in various product versions. The latest being S/4 HANA 2021. I found that each subsequent release added important additional functionality towards completing the final vision for Margin Analysis, that is the new account-based CO-PA in the Universal Journal.
This blog post should be of interest to all CO consultants that implement the new Margin Analysis in an S/4 on-premise system. If you are well-experienced with (typically: costing-based) CO-PA in ERP 6.0 you will have understood quickly that the big new thing regarding Margin Analysis can be summarized in a short sentence: “There are no value fields any more!”.
Rather the value fields have been replaced by the accounts in the Universal Ledger which eliminates the shortcomings of the former costing-based CO-PA when trying to reconcile with the “Financial Accounting P&L” in the General Ledger. This is actually one of THE most important selling points of Finance in S/4HANA.
So you might be happy to find, that the actual work to configure CO-PA in S/4 as well as the resulting reporting requirements have been reduced considerably. Then you turn to characteristics and this is what this blog entry is about: How-to create custom characteristics in Margin Analysis “properly”.
This blog post is split in two parts, the first part showing a technique, that requires no developer skills. The second part will show a different technique, that might have additional advantages, bit at the price of need developer skills for the implementation.
CO-PA characteristics: Doing it “the ERP way”
After further inspection you may find, that on the CO-PA characteristics side not much seems to have changed, except, that now one can have 60 instead of 50 custom characteristics. And if you continue the way you always used to add custom characteristics, you will see, that everything works just as in costing-based CO-PA in ERP 6.0. You may create a new characteristic in transaction KEA5 and add it to the operating concern in question. You will not encounter any problems, except possibly for the following one:
You might run into the problem to successfully activate the operating concern after adding your custom characteristic. The reason is, that the CO-PA operating concern with its objects and data structures is “just fine”, but the Universal Ledger (table ACDOCA/P) has not been updated accordingly. Before you try to find the hint somewhere hidden in the application log, the solution is to run report FCO_ADD_COPA_FIELD_TO_ACDOCA for your operating concern in the background. You can recognize CO-PA characteristics, that were added to ACDOCA/P using KEA5 from the fact, that the technical field names in ACDOCA end on “_PA”.
All well? So problem solved? Well, it may look like it, as everything works as expected. Everything? Well, as soon as you try out CO-PA related Fiori apps of the S/4 Embedded Analytics like “Market Segments”, “Product Profitability” or “Incoming Sales Orders” you will notice, that your new custom characteristic is missing! Isn’t this a serious shortcoming, if CO-PA does not support the SAP-delivered Fiori Apps? So what is then the best way forward to give business access in the Fiori Launchpad to CO-PA figures including custom characteristics? Do you need to create your own custom CDS views and make them available for reporting using front end tools, like e.g. the app “Custom Analytical queries”? Is this how SAP designed Margin Analysis and Embedded Analytics you might ask? Well, that would be at least one option. If you study blog entries like this excellent and comprehensive 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“, you may find the way to enhance the SAP-delivered CDS views manually using extension views. But it is certainly tedious and you have to get familiar with CDS views, new development tools like Eclipse, etc., etc.. Is there another option? Yes, there is, please read on.
New ways in S/4 HANA
So why do I consider the procedure as described above to be suboptimall? Well, from a technical point of view and also from the point of view of the Accounting and Controlling processes, all still might be well. Accounting documents can be posted and characteristics can be successfully derived and you will find your custom characteristic successfully updated in the new field in table ACDOCA.
My answer: Because there is an easier way, if you follow the new route as introduced by the S/4 Cloud version. I suggest not to use KEA5 to add a new custom characteristic to CO-PA, but rather make use of the Fiori App “Custom Fields and Logic”. Nevertheless, this requires to have at least version S/4 HANA 2020. In that app one can add a new field to the Business Context “Market Segments”. In doing so, you have a way to let SAP do the update of the CDS views and involved ODATA services in an automated fashion. And especially, you can fully reuse the SAP-delivered CO-PA Fiori reporting apps. That is a big time saver and let’s business immediately recognize the benefit of the new S/4 reporting environment.
So in the App we add a field (+) and choose “Accounting: Market Segment” as a “Business Context”:
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
Only “Code list” gives us the option to provide to the end user a technical key and a name for the values of that field. So the best option here is “Code list”. “Text” would also be an option, but then user gets only the text and no keys. The disadvantage of the “Code list” approach is, that the code list values need to be maintained manually in the app, although in this case all existing values are already maintained via datatype “MTART” in the ABAP data dictionary.
The better approach would be to make use of the ABAP data dictionary, but the is not foreseen by SAP at this step. If you look for a solution, that integrates with existing ABAP data types, please look for the second part of this blog, although this will require some developer skills.
Nevertheless, as the material types are typically subject to very stable customizing, it is O.K. to proceed with this approach.
We confirm the “Code list” with length 4, fill in the first value and proceed with “Create and edit”:
Then we maintain all the possible fields values manually and “Publish”:
With the publication the new field is made known to the Universal Journal. Wait until the publishing process has ended
and then head over to the classic KEA0 transaction to add the new field you the operating concern in question:
Save and activate and you are done with configuring CO-PA. Please take care, that when you transport everything, that you keep your transports together. Maybe you will also need some support on how to transport changes from the “Custom Fields and Logic” App for you will need to use the apps “Register Extensions for Transport” and “Configure Software Packages”.
What is still missing is the usage of the new custom field in business context “Market Segments” in “UIs and Reports”. For this you need to mark in the “Custom Fields and Logic” app the tab “UIs and Reports” and check off the following entries:
which is just a suggestion from my side. The “allocation” related settings are only needed, if you want to make use of the new characteristic in the new Universal Allocations App.
The main result is now, that this new CO-PA characteristic is available in the different “Market Segments” apps, but also in apps like “Incoming Sales Orders” or “Product Profitability”.
Activate and transport.
Again, you may have noticed, that it is a redundant activity to key in the possible values for material type once again in the app, although they are already stored in respective data type the APAP Dictionary. In the second part I will explain, how this procedure can be further improved, if you can make use of some limited developer skills and have ADT (ABAP Development Tools) in Eclipse available.
What you might take with you for your project work:
- Think twice before you start to create new CO-PA characteristics in KEA5.
- Get familiar with the new Fiori App “Custom fields and logic” in the business context “Market segments”.
- Get familiar on how to transport “Custom extensibility” changes.
Please feel free to comment, I will gladly come back to you.