Content
- Introduction
- Prerequisites
- Implementation of custom characteristic
- Troubleshooting
Introduction
In S/4HANA OP2022 there are several ways to create customer specific characteristics for Margin Analysis. While using transaction KEA5 might seem like the most intuitive and classic way to create new characteristics it will make it very hard to use those with any Fiori applications.
The “new” Fiori enabled way to create characteristics would be by using the Fiori app F1481 “Custom Fields” with the “Market Segment” business context.
Using this method, CO-PA fields can be created as text, numerical text (which means just numbers) or with a predefined code list. This code list however, must be manually defined in the Fiori app as well and cannot reference any existing tables in the system.
To achieve that – using an existing standard or custom table – as value help for a custom CO-PA characteristic a third option is available. As CO consultant in one of my customer’s projects, I was faced with implementing that third way. Because it proved to be quite tricky at times, I want to share my findings in this blog.
For a more in-depth description of the first two methods, check out the blog “How-to add custom characteristics in S/4HANA CO-PA (Margin Analysis) on-premise – properly” by Steffen Mallwitz:
https://blogs.sap.com/2022/06/01/how-to-add-custom-characteristics-in-s-4hana-co-pa-margin-analysis-....
Disclaimer: I am not involved in the development of any functionalities regarding this topic and can therefore not guarantee the correctness of the information given nor provide insights into future developments. All my findings are based on S/4HANA OnPremise 2022 “Initial Shipment Stack” (OP2022 FPS0)
Prerequisites
Authorization
You’ll need access to the Fiori apps
- F1481 – Custom Fields
- F1589 – Register Extensions for Transport
- F1590 – Configure Software Packages
which are all included in the SAP_BASIS_BC_EXT business catalog.
Additionally, you’ll need to have developer privileges in the backend system and the required authorization to access the S/4HANA System via the ABAP Development Tools (Eclipse) IDE. (In case of connection issues later, check transaction SU53 for missing authorizations.)
Tools
To create custom CDS Views for your value help, you’ll need to access the system with the ABAP Development Tools IDE.
Basis Configuration
SAP Basis needs to setup the so-called adoption transport organizer in with transaction S_ATO_SETUP. If you’ve got authorization, you can also check if it is configured in that transaction:
For more information you can check out the blog “SAP Fiori for SAP S/4HANA – Adaptation Transport Organizer” by my colleague Peter Nechala:
https://blogs.sap.com/2020/04/24/sap-fiori-for-sap-s-4hana-adaptation-transport-organizer/
Implementation of custom characteristic
Append new field to ACDOCA Include
As a first step using transaction SE11 you’ll need to create your new custom field in the INCL_EEW_MARKET_SEGMENT_PS include view.
After opening the view, you can click “Append Structure…”. If no additional structure has been created yet, you’ll directly get the option to input the append name. Otherwise, you’ll see an overview of appends where you need to click the “create” icon.
The name of your append structure must comply with the prefix or namespace configured in the adoption transport organizer (S_ATO_SETUP). In this case “ZZ1_”
In the field “Component” define your fields name. The component type should match the type used for the corresponding field in your value table.
By clicking the key symbol, you can maintain the check table.
Here you’ll need to reference your existing table you want to use to validate the characteristic values.
After the foreign key was successfully applied, you can activate your append structure using the wand symbol. Note: This step can (and probably will
😉) take a few minutes.
Activate Fields for use in the Custom Fields app
If you’ve successfully saved and activated the append structure, you can now publish your field into the Custom Fields Fiori app. To do that, start transaction SCFD_EUI and select table ACDOCA and all fields complying to your previously created field.
You should now see a list of all fields that “Can Be Enabled” which hopefully includes yours. If it does, select it and click “Enable”
In the resulting pop-up window select “Generate Value Help”. This will generate the required CDS View code for the Value Help View. Important: Only the text will be generated for you to manually created the required views in ADT. This button does not directly create any development objects.
To actually create the required CDS views create two new Data Definitions in your previously selected package using ADT. Here you can paste the generated text from both the “Code View” and “Text View” tabs. Only adjust/replace the text printed in
bold. The Fiori display name of your field is determined by the data element of your key field.
As you might not be able to activate the CDS Views individually due to circular references, use the activate all button.
If you are not using a language differentiation for your Text View, you can not remove the language key! Instead uncomment the “key $session.system_language as Language” statement.
Once your CDS Views are activated, you can insert the Code View as Value Help View and continue activating your custom field. Make sure to select the same development package used earlier.
Note: There might be an error displaying the use of a wrong ABAP Language Version. Do
NOT change your packages language version! Language version Standard
must be used.
After entering a transport, activation of the field might take a few minutes.
Configure your field in the custom fields app
If activated successfully, transaction SCFD_EUI should now display the field with status “Enabled”
Additionally, it should now be visible in the Custom Fields Fiori application. By adding the “Origin” field via the settings, you can see, that your field origin is “ABAP Development”. Fields created directly in the app will display “Custom Fields” as origin.
From here on out, you can treat your characteristic like any other field created through the regular way and activate it for use in several Fiori applications. To read more on that, check out the blog “How-to add custom characteristics in S/4HANA CO-PA (Margin Analysis) on-premise – properly” by Steffen Mallwitz:
https://blogs.sap.com/2022/06/01/how-to-add-custom-characteristics-in-s-4hana-co-pa-margin-analysis-...
Add your field to the operating concern
As a last step to use your new characteristic properly, you’ll need to add it to your operating concern’s data structure. This can be done in the classical way with transaction KEA0.
Congratulations! After generating the operating concern’s new structure you’re all done and can use your custom CO-PA characteristic.
Troubleshooting
As I’ve encountered some issues along the way, I want to also share some troubleshooting hints.
Transaction SCFD_FIELDVIEWER
The most important tool when troubleshooting any issues with custom fields is the transaction SCFD_FIELDVIEWER:
Here all your custom fields are listed, and several options are available to recover failed activations, deep dive into error and change logs and run the “Repair Fields” assistant.
Custom characteristic and Universal Allocation
If you want to use your characteristic for allocations in the “Manage Allocation” app with context market segment, you might encounter the issue, that despite being able to select specific fields as receiver, no values are displayed when trying to assign the receiver basis. If this happens, check out SAP note 3105083
https://me.sap.com/notes/3105083. Your field might not have been generated in the T800D table. In this case you can create an entry into the maintenance view V_T800D via transaction SM30 which looks like the following screenshot only with an adjusted field name:
General issues with custom characteristics
For a similar overview of options and issues with custom CO-PA characteristics, check out SAP note 3005736
https://me.sap.com/notes/3005736.