This blog is about how to add fields in standard Fiori apps and other objects by using “Data Source Extension” menu in Key User Extensibility Tools “Custom Fields and Logic”. The attribute of the associated views can be added to the data source for transaction data. It also intends to explain how objects are enhanced internally when adding a field with Data Source Extension, or how the fields are added in the source CDS View.
Custom Fields and Logic has 3 functions, Custom Fields, Data Source Extension and Custom Logic, but this blog focuses only on Data Source Extension.
The target is standard CDS View and many of them are VDM, template created with CDS View. Consumption View (C_*), Interface View(I_*) and API view(A_*) are the targets. Consumption View is used as the source of Standard Fiori app. For adding the fields in standard Fiori, firstly it is necessary to understand what objects (CDS View, OData) are used in the app.
Some target CDS Views are the query of the Webdynpro Grid Data Grid. In the case, firstly it is needed to add the field to the source Interface View if the Interface View does not have the field.
In Design Studio app, the CDS View name is not displayed but BW Query name (2C<SQL VIEW name>) is displayed.
Some other target CDS Views are used in the OData for Fiori Elements apps. The OData is created with the transaction SEGW. In this case, firstly the source of the Fiori app has to be checked. e.g. C_DEADSTOCKMATERIALQRY is the source of Dead Stock Analysis according to the SAP help. SAP Note would provide the info in some other cases.
Some data sources are OData in which CDS View is used, e.g. OData Service MMIM_MULTIPLE_MATERIAL_SRV0001 in which the CDS View F0_MMIM_MATSTOCKQUANVALBYDATE is used. This OData is used in Fiori app F1595 Stock - Multiple Materials.
Custom Fields added to the associated view with Key User Tool "Custom Fields" can be added to the standard VDM used in standard app,
e.g. Custom Field "Product Category" is added to the Business Context Profit Center, Then this fields can be added to G/L Account Line Items Cube (G/L Account Line Items Cube) and Journal Entry Analyzer (C_GLLINEITEMSQ0001).
Internally, Extend View is generated to add fields. There should be no difference from adding fields with Extend View manually, which would be more flexible than using this Data Source Extensions but would be affected by the upgrade in the future. See the blog in detail about Extend View for VDM.
With Extend View, the fields in the source of the view and the ones in the associated views can be added without changing the view name like append structure in ABAP Dictionary.
Not all the fields in the source view or associated views can be added but the fields only of the source view set to be available can be used in Data Source Extensions (explained later) because of the stability reason after upgrade. In addition, it does not allow to traverse all available associations, but only associations that will not change the result cardinality.
This function is for adding the fields in the source CDS View and associated CDS View to standard VDM, e.g. Country in associated View I_CompanyCode in I_GLAccountLineItem. The added field is associated with the text view, so it is possible to display text in the app.
The target of the Data Source Extensions can be checked in Extension Registry (Transaction SCFD_REGISTRY).
Difference from Custom Fields in Custom Field and Logic is the attribute of the underlying view of associated view in the source view can be added with Data Source Extension. The field is not added in the source table.
How to add the field to Fiori app (frontend object) depends on the app type. For adding Fiori Design Studio apps using CDS View directly, additional step is not needed.
The field added to the master view with Custom Fields is available in the Data Source Extensions, e.g. A field XYZ is added to I_CostCenter, then the XYZ can be added to G/L Account Balance – Cube ” (I_GLAcctBalanceCube) in the Data Source Extensions.
Target of Data Source Extensions
The target of the Data Source Extensions can be checked in Extension Registry (Transaction SCFD_REGISTRY). For CDS View, Go to Extensible CDS View tab and select a CDS View to display detail info. Then go to Support of Data Source Extensions tab. The CDS View in “Underlying View Name” and “Available Associations of Current View” are available in Data Source Extension.
It is possible to search the target views, and underlying views and associated view with the following SELECT.