Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Masaaki
Advisor
Advisor

Purpose of this blog


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.

 

Table of Contents




Summary



  • 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).

      • The data of the Custom Fields in Profit Center and Cost Center can be uploaded from file using Manage Flexible Hierarchies.





  • 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.

SELECT A.CDS_VIEW_NAME , A.UNDERLYING_VIEW_NAME, B.TARGET_CDS_VIEW

FROM CFD_W_CDS A left outer join "CFD_W_DE_CDS_AS+" B on A.CDS_VIEW_NAME = B.CDS_VIEW_NAME

where A.SUPPORTED_FEATURES in ('B','D')

  • Please replace "+" to "S".


 

 

For OData Services, Go to Extensible OData Model tab and select a OData Service to display detail info.


How to add the field with Data Source Extension


In the following case, the field Country in Company master view is added in Fiori app Journal Entry Analyzer (F0956A). Company master view I_CompanyCode has already been assigned.

Check the Query name and Infoprovider name in the app.



The Query name: 2CCFIGLLITMQ0001

InfoProvider Name: 2CIFIGLLITMCUBE

Naming rule: 2C<SQL View name of the CDS View>



The CDS View name for the SQL View can be checked in the view CDSSQLVIEW.

The Query name: C_GLLINEITEMSQ0001 (2CCFIGLLITMQ0001)

InfoProvider Name: I_GLACCOUNTLINEITEMCUBE (2CIFIGLLITMCUBE)





 

 

 

You can check the source query name in Fiori apps library as well.



Now we understand the target views to add fields are I_GLACCOUNTLINEITEMCUBE and C_GLLINEITEMSQ0001.

 

Add the field in Interface View.

 

Start Custom Fields and Logic.



 

Go to Data Source Extensions tab.



Select the data source.



 

Enter Description and Extension ID

 

In the left screen, the views from which the fields can be added is displayed. Check the fields to be added.

It is possible to change the technical name in the right side. Save and Activate it.



 

Create Data source Extension for Consumption view.



Enter the Extension ID name.



Select the field which was added in the underlying Interface View in the previous step. Save and publish it.



 

Now it is published.



 

Check the result.

Launch Journal Entry Analyzer.



 

The Field is added.



 

Movie



Thanks!

 
19 Comments