Skip to Content
Technical Articles

Adding Field in standard Fiori apps of S/4HANA with Data Source Extensions in Custom Fields and Logic

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”. 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 Fiori Design Studio. 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.
  • 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.

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.

 

Thanks!

 

9 Comments
You must be Logged on to comment or reply to a post.
  • Hi Masaaki,

    really nice blog about the key user feature Data Source Extension. From my point of view you should definitely point out that fields added using this feature are not added to any data base table AND only added as read-only fields.

    Best regards,

    Karsten

  • Masaaki Arai -san,

    I am required to add some additional fields in Stock Multiple Materials Report.

    Fiori App Details:

    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.

    I tried with Data Source Extension through Custom Field and Logic.

    Fields required are;

    1. MARA-SIZE1 (Key) - (In CFL DSE, this field is found) - OK
    2. MARA-SIZE1(Text) - Not present in the Exposed Data source. I_BATCH, I_PRODUCT, I_PRODUCT_PLANT
    3. MATDOC-FSH_COLLECTION - MATDOC cannot be associated in bottom most layer of CDS because of aggregation and group by are used. Also, not able to/not supported do association in top most layer.  - Not OK
    4. FSH_COLLECTIONS-RFM_SEASON_CATEGORY - Key fields of FSH_COLLECTIONS are linked with MATDOC in order get season category field.

    I see that the extended fields in the I_PRODUCT and F0_MMIM_MATSTOCKQUANVALBYDATE doesn't reflect in the Custom Field and Logic Data Source Extension Tab.

    How to bring values for the fields (2), (3) and (4).

    Thanks for the help in advance.

    Thiyagarajan

  • Good and clear explanations, thank you.

    I tried to do same logic for the app "Technical Object Damages" used in maintenance domain, corresponding CDS VIEW is : C_DAMAGEANALYSISQUERY

    https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps('F3075')/S18OP

    My problem is that i can't find required view in the Data source selection, is there a restriction of CDS VIEWS to be extended? Or another step should be done to show up required CDS VIEW in the list ?

    Thanks in advance.

     

    • Hi Salim,

      As the CDS View is not in SCFD_REGISTRY, it is not possible to extend with CFL. So the next way is to use Extend View.

      https://blogs.sap.com/2018/08/22/sample-custom-cds-view-using-predefined-virtual-data-model-and-extend-view-in-s4hana/

      Thanks, Masa

  • Hi,

    thanks for the very informative blog.

    Question: I'm trying to do the same for the app "Cost Centers - Plan/Actual". If I check the query used it gives me /ERP/SFIN_M01_Q2001. I cannot find any entry for this query in CDSSQLVIEW?

    What I have tried so far is to create a data source extension for "Cost Center - Plan/Actual". Here I could see that the Interface view used is I_JOURNALENTRYITEMCUBE.

    So I also created a data source extension for "Journal Entry Item - Cube". However, the custom field is still not available in the Cost Centers - Plan/Actual Fiori app.

    Any help or guidance is much appreciated!

    PS: S/4HANA 2020 initial stack on premise system

    • Hi,

      /ERP* queries are the ones for BPC optimized for S4HANA in which BW objects are used. it is out of the scope of CFL.

      if you dont use BPC Optimzied, I think it is better to create tiles using the VDMs.

      See more about the VDMs in hte blog below.

      https://blogs.sap.com/2020/09/24/analytics-on-universal-journal-the-heart-of-sap-s-4hana/#BPCOptimized

      How to create multidimensional reporting app tiles.

      https://blogs.sap.com/2018/07/11/how-to-create-custom-fiori-multidimensional-reporting-application-in-s4hana-on-premise/

      Thanks, Masa

    • Hello JC,

      Custom hierarchy is not created with CFL.

      it is created with Manage Global Account Hierarchies

      https://blogs.sap.com/2018/10/19/global-accounting-hierarchies-in-s4hana-1809-how-to-leverage-existing-hierarchies/

      it is available in Fiori Design Studio or WD Grid.

      I have not checked if the contry hierarchy is the target of Manage Global Account Hierarchies. if it is not the target, the hierarchy has to be created manually with ADT.

      Thanks, Masa

      • Hi Masa,

        thanks for your answer. Yes I know about accounting global hierarchies. I have created “Country” as hierarchy “type” using the app Global hierarchy types and then created a Country hierarchy via App Global accounting hierarchies. However, you cannot select it for the country dimension during the execution of the custom Analytical Queries. We have tried via ADT as well, adding the association with the hierarchy view. Do you have any other recommendation? How to make available these additional hierarchies during analytical query reporting for other dimensions than G/L account, profit center, cost centers, etc?

        Best

        Juan