Extending CDS Queries with CO-PA (WW) Fields
Business Background: Extensibility for CO-PA (WW) Fields
The operating concern can be extended with custom characteristics created in KEA5. These fields are also generated in journal entries in the ACDOCA table.
However, for some analytical applications which are based on CDS queries, CO-PA (WW) fields can’t be added to the CDS-based cubes and queries via S/4HANA key user extensibility nor via classic coding block extensibility (see Note 2453614).
Therefore, you need to manually add CO-PA (WW) fields to such queries. This applies to the queries included in Note 2535903 and to other queries based on I_GLAccountLineItemCube, I_GLAccountLineItemSemTag, I_JournalEntryItemCube and I_ActualPlanJrnlEntryItemCube.
The query and the underlying CDS views need to be extended with the custom field so that the field is available in the respective Fiori analytical app.
How to Extend Underlying Views with CO-PA (WW) Fields
In order for the custom field to be displayed in the Fiori analytical app, the underlying views need to be extended. In the following example (extension for Journal Entry Analyzer) the following views need to be extended:
The underlying views can be identified by looking at the consumption view in ABAP Development Tools for Eclipse.
- Create a package in transaction SE21.
- Open ABAP Development Tools for Eclipse and add the package to your favorites. In the following, names that can be freely defined are marked in green and views/fields that need to be assigned are marked in red.
- Choose File > Create > ABAP Repository Object > Core Data Services > Data Definition and create an extension for E_JournalEntryItem (the extension view of the virtual data model).
• Use the Extend View template.
• Add the name of the append view and the view to be extended.
• Insert the WW fields you want to add to the report (in this case the WW field WWCLR). Use the Persistence alias as in E_JournalEntryItem to address the field of the underlying table ACDOCA.
- Create an extension for I_GLAccountLineItemCube (the CDS view for the analytics cube).
• Use the Extend View template.
• Add the name of the append view and the view to be extended.
• Insert the WW fields that you want to add to the cube. Use the _Extension alias that is used for E_JournalEntryItem in I_GLAccountLineItemCube to address these fields. - Create an extension for C_GLLineItemsQ0001 (the CDS view for the analytics query).
• Use the Extend View template.
• Add the name of the append view and the view to be extended.
• Insert the WW fields that you want to add to the query. Use the I_GLAccountLineItemCube alias that is used for the cube in C_GLLineItemsQ0001 to address these fields.
Note: Don’t create such extensions for “private” CDS views. Only E_JournalEntryItem, released public views that have an association to E_JournalEntryItem (such as I_GLAccountLineItemCube), and views on top of these views (such as C_GLLineItemsQ0001) may be extended. The view stack below I_GLAccountLineItemCube, for example, might be changed in an incompatible way by SAP in a future release, which could damage the extension and lead to activation errors in the upgrade.
Result: CO-PA field in Fiori analytical app
The CO-PA (WW) field WWCLR (Colors) is shown in the Fiori analytical app Journal Entry Analyzer as an available field:
The CO-PA (WW) field can be included in the report as an additional characteristic:
Thanks Stephen Offenbacker for this very nice blog!
I did the same while extending CDS Queries for our customer (product s4hana 1610) last year.
My question is how do we extend Actual vs Plan CDS consumption views (like since the union between ACDOCA and ACDOCP is done on a higher level between some private views?
I noticed that for s4hana 1709 the Actual Plan cube I_ActualPlanJrnlEntryItemCube has extensions for both ACDOCA and ACDOCP but in s4hana 1610 there is no such cds view (cube) . The only view that is available is the I_ActualPlanJournalEntryItem.
1709
1610
I understand that is not recommended to extend private views but unfortunately for Actual VS Plan query ( C_ProfitAndLossPlanActQ2903 ) in s4hana 1610 I couldn't find an alternative way.
Kind regards,
Loucas Stylianou
Hello,
Thank you for the response and the blog, but i have a question if you can help me,
I want to add atributes to the dimensions added, do you have an idea about that?
Thank you and best regards,
Sana.
Hello
Hi Mayumi,
You need to extend also the cube and the query.
In the cube since you have characteristics from both Plan and Actual you need to combine this info that you have already added to E_FinancialPlanningEntryItem and E_JournalEntryItem. There is a field which marks each line (record of the view) as plan or actual. I recommend to use the CASE WHEN and the field which recognizes the line type (Actual/ Plan ) and then add the correct field either from E_FinancialPlanningEntryItem or E_JournalEntryItem.
So in simple words lets say you added a custom field on coding block which should appear on ACDOCA and ACDOCP and this field is lets say ZCUSTOM_FIELD1.
You extend both E_FinancialPlanningEntryItem and E_JournalEntryItem to include ZCUSTOM_FIELD1 and then you extend the cube whereas the two above extensions are used.
You add a CASE statement similar to the one below:
case ActualPlanIndicator
when 'A' then E_JournalEntryItem.ZCUSTOM_FIELD1
when 'P' then E_FinancialPlanningEntryItem.ZCUSTOM_FIELD1
end case
Then you need to extend the query to add the new field ZCUSTOM_FIELD1.
Kind regards,
Loucas Stylianou
Kind regards,
Loucas Stylianou
Loucas,
Thanks a LOT for your help!
Kind regards
Mayumi Blak
Hi Loucas!
I tried to write the code like this for the Cube, but I'm getting an error on Eclipse:
@AbapCatalog.sqlViewAppendName: 'ZIFIACTPLNJEIC'
@EndUserText.label: 'ZI_ActualPlanJrnlEntryItemCube'
extend view I_ActualPlanJrnlEntryItemCube with ZI_ActualPlanJrnlEntryItemCube
{case ActualPlanCode ==> error: "An alias name must be assigned for the expression (CASE ...)"
when 'A' then _Extension_acdoca.Ze_ww001_pa
when 'P' then _Extension_acdocp.Ze_ww001_pa
end
}
I don't know what I'm doing wrong, if you could help...
kind regards
Mayumi
I found the answer,
the "end as" was missing. Now I can see values on both plan and Actual for this COPA field.
{ case ActualPlanCode
when 'A' then _Extension_acdoca.ze_ww001_pa
when 'P' then _Extension_acdocp.ze_ww001_pa
else 'unspecified'
end as ze_ww001_pa
kind regards
Mayumi
}
Hi,
I performed the same steps as mentioned above for Market segment - Actual (C_MarketSegmentQ2501). i'm able to see customized fields in query browser but in App report, fields are not visible. looking for guidance here.
Fields are visible in Query browser
This is screen shot id from Merket segment - actual, Here customizing fields are not visible.
Hi Anuradha,
Were you able to get a solution for the above issue? I am facing the same issue, could you please guide me here?
Regards,
Nurshid
Hello Stephan,
Thank you for the blog, it was very helpful, i have a question if you can help me.
I have applied the recommended instruction to add new dimension to the standard CDS C_ProfitCenterQ2701 and it works perfectly. Now i want to add attributes under a dimension but it's not visible when i click on teh dimension i want to get a list of attributes like hierarchy.
Can you please help me if you have an idea?
Thanks and best regards,
Sana.