Skip to Content
Technical Articles
Author's profile photo Masaaki Arai

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

 

Assigned Tags

      18 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Karsten Schaser
      Karsten Schaser

      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

      Author's profile photo Thiyagarajan Balasubramani
      Thiyagarajan Balasubramani

      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

      Author's profile photo Salim Eloudghiri
      Salim Eloudghiri

      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.

       

      Author's profile photo Masaaki Arai
      Masaaki Arai
      Blog Post Author

      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

      Author's profile photo Timothy Santy
      Timothy Santy

      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

      Author's profile photo Masaaki Arai
      Masaaki Arai
      Blog Post Author

      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

      Author's profile photo Juan Carlos Consiglieri D'Angelo
      Juan Carlos Consiglieri D'Angelo

      Hi Masaaki,

      thanks for the posting. How can you enable a custom hierarchy for this new country dimension, that can be used in this report?

      Looking forward to hearing back from you

      Best

      JC

      Author's profile photo Masaaki Arai
      Masaaki Arai
      Blog Post Author

      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

      Author's profile photo Juan Carlos Consiglieri D'Angelo
      Juan Carlos Consiglieri D'Angelo

      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

      Author's profile photo Daouda Pouye
      Daouda Pouye

      Hello Masaaki,
      I made a CDS View extension for the Fiori application "Journal Entry Analyser".
      I have extended the following Views to add a field:
      - C_GLLINEITEMSQ0001
      - I_GLACCOUNTLINEITEMCUBE
      In Development system, everything is going well.
      The transport Request is well transported in Test/Qual system and the field is present in the tables in Test/Qual system but I don't see the new field that I added in the Fiori application.
      I have cleared the cache via the /n/iwfnd/cache_cleanup and /n/iwbep/cache_cleanup transactions.
      Is there any manipulation to do to make the fields appear in the Fiori application in Test/Qual system?
      Thanks for your help

      Author's profile photo Masaaki Arai
      Masaaki Arai
      Blog Post Author

      Hi,

      it has to be analyzed..

      is extend view created internally for the CDs views on QAS?

      thsnks, Masa

      Author's profile photo Daouda Pouye
      Daouda Pouye

      Thank you Masaaki for your feedback,
      The extended views are present in the DDIC of the QUAL system.
      The same objects created from the Development system exist on both sides.
      Thank you again for your time

      Author's profile photo Masaaki Arai
      Masaaki Arai
      Blog Post Author

      Hi,

      could you run the query in TVs RSRT?

      thanks, Masa

      Author's profile photo Taki Eddine OULD SAID
      Taki Eddine OULD SAID

      Hello,

      Thank you Masaaki for this step by step guide. I have successfully used it to enhance "Stock Multiple Materials, ID: F1595" report.

      However, now i'm trying to do the same for "Material documents overview, ID: F1077" report but i can't find the proper data source to do so. Is there any way to add other data source to use in CFL app or is it only possible for sources already existing in the list ?

      Author's profile photo Masaaki Arai
      Masaaki Arai
      Blog Post Author

      Hi,

      I found FINS_CODING_BLOCK for MMIM_MATDOC_OV_SRV, the datasource of F1077 in SCFD_REGISTRY. but not sure if it is available for Data Source Extensions. by opening this data source with tcd SEGW, the source is reference data source and CDS view is used underneath. so, by adding the field to the source CDS View, the field may be able to be added.

      regards, Masa

      Author's profile photo Deep Desai
      Deep Desai

      Hi Masaaki,

       

      I added Data Source Extension for Customer Line Items to fetch KNA1-Name1 and Name2.

      The same fields are coming in Manage Customer Line Items (FBL5N) for the client where i did the data source extension (Dev Client) .

      But the same is not reflected in Unit Testing Client in the same system.

      How do we move the same to different clients in the same system.

       

      Regards

      Deep Desai

      Author's profile photo Frank Li
      Frank Li

      In S/4 HANA public cloud, if want to add customer specific new field into the backend table used by SAP Standard transaction(CRUD) Fiori app, then expose those new customer field in the Fiori app object page, also able to input/edit. How to achieve this? Any example of blogs or materials? Thanks.

      Author's profile photo Vivek Sharma
      Vivek Sharma

      Hi Masaaki,

      Thanks for sharing this nice article. I have been struggling with one question. Does extending Standard Fiori apps using Custom Fields and Logic App or using Extension Points is strategically correct towards keeping the core clean which SAP is promoting with S/4 Hana?