Motivation to write this blog:
With SAP S/4HANA, FICO consultants are facing a lot of challenges, especially when we talk about reports. As report painter is not a recommended option (as they do not read the universal journal tables), and with the constant improvements on Analytics solutions, Finance and Management Accounting consultants are being challenged to become more technical to achieve independency on implementing reports.
After a lot of research and help from some experts and Community contributors (
masaaki.arai, stephen.offenbacker, l.stylianou), I finally had success on extending an app exactly the way I needed. So, I decided to share this experience with whoever is facing with the same scenario.
Introduction:
In SAP S/4HANA with COPA account based, when new COPA characteristics are created and added to ACDOCA and ACDOCP table, they are not automatic added to Fiori reports/CDS views.
Unfortunately, COPA fields are not part of the scope of the app “Custom Fields and Logic”, which would turn our lives much easier. SAP note 2453614 details the different scenarios for extending fields, including COPA characteristics.
The example I will use is the App “Journal Entry Analyzer”, and 4 new COPA characteristics already configured in KEA5/KEA0 and added to ACDOCA and ACDOCP.
The steps bellow should be considered:
- Identify the Consumption view (DDL Source)
- Map the underlying views according to the Virtual Data Model
- Create Text views to be added to the extension (to display key and text on the app) – Eclipse
- Extend the mapped CDS views - Eclipse
- Identify the Consumption view
There are several ways to identify the DDL Source of an app, but in my case, I found it using table DDDDLSRT, filling the description of the app (language EN):
Journal Entry Analyzer DDL Source = C_GLLINEITEMSQ0001
- Map the underlying views according to the Virtual Data Model
Virtual Data Models are represented by the following levels:
The logic is that we need to map the CDS views until de Basic Interface views, and then identify which Extension View is available.
*There are great blogs explaining the concept of Virtual Data Models on SAP Community.
I used the app View Browser to identify the underlying views:
In this app, inform the Consumption view, and click on it, to get the details:
The tab “Cross Reference” displays de underyling view from the Composite view, that is I_GLAccountLineItemCube. At this moment, keep the Alias name which will be used in the extension:
When clicking on the Composite view name, its details are displayed. Go to “Cross Reference” tab and a list of basic views will be displayed. Scroll down until you find the extension view (in this case E_JournalentryItem). Keep the Name and Alias to use in the extension.
Click on the Extension view name to see its details and go to Cross Reference tab. You will see that E_JournalEntryItem is an Include view for the basic view I_JournalEntryItem, and its directly related to table ACDOCA. Keep the Alias Name to use in the extension.
The mapping will be like that:
- Create Text views to be added to the extension (to display key and text on the app) – Eclipse
Now we will jump from Fiori to Eclipse. The first thing is to create text views, that will be used in the CDS extensions to display on the app both KEY and TEXT values.
*Prerequisite: Eclipse installed, package created in se80 and added to “Favorites” as below:
Create new Data Definition:
Define View that will select the text from the text table of the COPA characteristic. In this example, the characteristic WW002 has the text table T25A0, as previously defined in KEA5. For each characteristic, create views the same way as below, but selecting from the respective text table (also defined in KEA5).
Ex:
Then you need to create a second view selecting the characteristic from the check table (in this example, table T2500), with an association to the text view, using the same “key” field. Also, do the same for the other characteristics.
After activating the text views, you are now able to start the extension:
4. Extend the CDS views – Eclipse
Click on the package > Core data Services > Data Definitions > New data definition
You will extend the mapped CDS views from the bottom to the top. So, start with the Extension view E_JournalEntryItem:
The
associations will bring the text for each characteristic. The fields will be extended with the prefix “ZE_”, and the ALIAS “Persistence” must be used according to selected from View Browser.
The annotation @ObjectModel.foreignKey.association: 'ZV_WW001_PA' must be added above each extension line, to get the field foreign key.
The associated views must be declared as bellow, before the “}”.
As you can see, I did not get the text from characteristic W004_pa, so I will only have the key from this field available on the report.
After activating the Extension of the basic view, the append structure is displayed on the DDL Source (se11):
Query Browser:
Next, define a new view to extend the Composite view I_GLAccountLineItemCube:
The same associations must be done to get the texts.
The Alias “_Extension” must be used to extend the fields in this composite view.
After activating, fields are added to Composite view (Query Browser):
Se11:
Finally, you need to extend the Consumption view. Create new data definition:
For the Consumption View, you need to just add the relevant annotations above the extension of each field. To get the text, the annotation @AnalyticsDetails.query.display: #TEXT must be added. For other annotations you can check SAP Documentation.
Result:
Finally, when you activate the Consumption view extension, the fields will be available on the report, with KEY and TEXT available for selection:
The Field that was not extended with text, will have only the key available for selection:
Same report in Analysis for office (this print is in Portuguese):
Fields available with key and text:
Conclusion:
The more knowledge a functional consultant gets from CDS views, the easier their lives will be in a SAP S/4HANA implementation.
On the next blog post I will show an extension of a Plan/Actual CDS view, which has some tricky differences.