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

Adding Custom database Field to standard Fiori apps in S/4HANA with Custom Fields and Logic

Purpose of this blog

This blog explains how to add fields which have already been in the source table of standard apps and objects by using Key User Extensibility Tools “Custom Fields and Logic” (CFL) in S/4HANA. It is possible with the transaction SCFD_EUI.

In S/4HANA implementation, it is typical requirement to add fields to standard Fiori apps and other objects, and it is especially the case for conversion customers that the fields have already been in the source table and they want to use them in standard Fiori apps. CFL can be used for adding fields to apps and object, and it is not only for new field, but also for the fields which have already been in the source table.

Note: this blog focuses on S/4HANA Any Premise (On premise) 1511~ customers.

For understanding Custom Fields and Logic, see the blog.

 

Topics

Overview

How to add the field already in the table to Business Context and Fiori app

Add to Business Context

Add to the data source and Fiori app

 

Overview

With the transaction SCFD_EUI, it is possible to add the fields already in the source table to the Business Contexts in “Custom Field” of CFL, so which can be added to the relevant data sources and other objects for the Business Context as the same way as the fields created with CFL.

In transaction SCFD_EUI, the manual steps would be guided to add the fields to the Business Context. The steps are different depending on the Business Context. For example, in the Business Context “Master Data: Product Plant” (Table: MARC), the field in the custom append structure has to be moved to persistent structure.

See the SAP help in detail.

 

How to add the field already in the table to Business Context and Fiori app

Add to Business Context

In the following case, a field ZZMATGRP01 has been added using Coding Block in ACDOCA. It can be added to Business Context “Accounting: Coding Block” (FINS_CODING_BLOCK).

Table ACDOCA (Transaction SE11)

Transaction SCFD_EUI

The field is found. The Field Status is “Preparation Required”. Select this entry and the overview of the steps is displayed in the bottom. Push “Prepare” to find the steps. In the following case, so many entries are there, but it does not mean manual operations are needed for all entries. As just the same steps are guided for the same Business Context, once you have completed the steps for one entry (entry for ACDOCA in the following case), the steps for many others are completed as well.

Message is displayed. Click the detail icon, and the guide is displayed.

It says as below.

Open the CDS View “NSDM_E_MSEG” (Proxy View for MSEG) (SAP Note 2865970), and you can find Extend View is created for this view (case c).

 

Extend View for NSDM_E_MSEG in which ZZMATGRP01 is added.

Delete this Extend View.

Go back to transaction SCFD_EUI in SAPGUI. After running Refresh, “Field status” of many entries are changed to “Can be Enabled”.

After clicking a entry (ACDOCA in the following screen), push “Enable”.

Pop-up screen appears. Details of the Custom Field are defined here.

In the following case, “Enable Field as New Custom Field” is selected, and “LIST” is selected as Semantic Type (options: EMAIL/LIST/PHONE/TEXT/URL for the CHAR field, but the available options for Semantic Type depend on the DDIC type). For semantic type “LIST”, value help view is needed to add the value help for the field. The source code is proposed by pushing “Generate” icon.

 

Source codes of the value help CDS View are proposed. The source for Code View and Text View are proposed.

 

Using the proposals, the following CDS Views are created with ADT.

Code View:

@AccessControl.authorizationCheck: #NOT_REQUIRED

@EndUserText.label: ‘ZI_MATGRPVH’

@AbapCatalog.sqlViewName: ‘ZIMATGRPVH’

@Search.searchable

@ObjectModel.compositionRoot: true

@ObjectModel.usageType.serviceQuality: #A

@ObjectModel.usageType.sizeCategory: #S

@ObjectModel.usageType.dataClass: #CUSTOMIZING

@Analytics.dataCategory: #DIMENSION

@ObjectModel.representativeKey: ‘Code’

 

define view ZI_MATGRPVH

as select from t023

association [0..*] to ZI_MATGRPVHT as _Text

on $projection.Code = _Text.Code

{

@ObjectModel.text.association: ‘_Text’

@Search.defaultSearchElement: true

key cast( matkl as zzmatgrp01 ) as Code,

@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]

_Text

}

 

 

Text View:

@AccessControl.authorizationCheck: #NOT_REQUIRED

@EndUserText.label: ‘<End User Label>’

@AbapCatalog.sqlViewName: ‘ZIMATGRPVHT’

@Search.searchable

@ObjectModel.usageType.serviceQuality: #A

@ObjectModel.usageType.sizeCategory: #S

@ObjectModel.usageType.dataClass: #CUSTOMIZING

@ObjectModel.dataCategory: #TEXT

@ObjectModel.representativeKey: ‘Code’

 

define view ZI_MATGRPVHT

as select from t023t

association [0..*] to ZI_MATGRPVH as _Code

on $projection.Code = _Code.Code

association [0..1] to I_Language as _Language

on $projection.Language = _Language.Language

{

@Search.defaultSearchElement: true

key cast( matkl as zzmatgrp01 ) as Code,

@Semantics.language: true

@ObjectModel.foreignKey.association: ‘_Language’

//Use this for language-dependent descriptions:

key spras as Language,

//Use this for language-independent descriptions:

//key $session.system_language as Language,

@Search.defaultSearchElement: true

@Semantics.text: true

wgbez as Description,

@ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]

_Code,

_Language

}

 

Standard VDM for master data, e.g. I_CompanyCode cannot be used in general as the syntax check is strict, e.g. the alias of the field must be “Code” and associated text view must be named “_Text”. (We SAP hope to improve this in the future.)

 

Set the created Code View as Value Help View, push “Create Field”.

 

The field is added to the Business Context.

 

The field statuses for the entries of Business Context Accounting Coding Block are changed to “Enabled”.

 

Add to the data source and Fiori app

Launch CFL in FLP.

 

In Custom Fields tab in CFL, the custom field “ZZ1_MATGRP01 has been created for Business Context “Accounting: Coding Block”, and Origin of this custom field is “ABAP Development”, as is created with transaction SCFD_EUI.

In the following case, the field is added to C_GLLINEITEMSQ0001. When enabling the field for this source, it is also enabled to I_GLACCOUNTLINEITEMCUBE automatically as is the source of C_GLLINEITEMSQ0001.

 

After save and publish, the field is added to those CDS Views.

Extend View for I_GLACCOUNTLINEITEMCUBE. The value help view ZI_MATGRPVH is associated.

Extend View for C_GLLINEITEMSQ0001.

As C_GLLINEITEMSQ0001 is analytic query, only the field has to be added.

C_GLLINEITEMSQ0001(2CCFIGLLITMQ0001) is the source of Journal Entry Analyzer (F0956A). Launch the app in FLP.

The custom field is added in the app. As the app type is Fiori Design Studio, the field is added automatically in the app.

 

I believe you can enjoy more and more standard Fiori apps by adding the fields already been in the table in the way explained in this blog!

 

Assigned tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo navya shetty
      navya shetty

      Hi Masaaki Arai

      I have a requirement to add SAP standard field BUT000-BPEXT in  business context(BP_CUSTVEND1)  so that it can be enabled in “Business partner master data” fiori app as this field does not shown up in this standard business context.

      Based on your blog,when i search for this field using SCFD_EUI to add it to business context , it does not show me this field.Please let me know if  this means I cannot enable this field for use with “Custom Fields and Logic” app?

      Looking forward to your response.

       

      https://answers.sap.com/questions/13037329/sap-standard-field-not-visible-in-scfd-eui-tcode-f.html

       

      Regards,
      Navya

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

      Hi,

      I have shared the request to developers.

      if you use the field for read only app, you should be able to add the field with 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 Jawher KETATA
      Jawher KETATA

      Hello,

       

      I need to add the new field in UI Fiori based on an existing field in table KNVV.

      When running the t-code SCFD_EUI I cannot find the field to be used as a custom field.

       

      Looking forward to your response.

       

      Best Regards,

      Author's profile photo Patrick Van Nierop
      Patrick Van Nierop

      Thanks for the interesting blog. Just a question, after adding fields to the coding block, one needs the extension on NSDM_E_MSEG containing those fields, or you get dumps when selecting from MSEG (or even opening MSEG in SE16n).

      So after deleting the extension and creating the new view(s), are you able to use MSEG (in both SQL statements & SE16n)?

      Author's profile photo shweta nargachhe
      shweta nargachhe

      Hi Patrick ,

      You may need to implement sap note 2686694. It solved error while we implemented extension.

       

      Regards,

      Shweta

      Author's profile photo Daouda Pouye
      Daouda Pouye

      Hi Masaaki,

      I am working on the Manage Product Master Data (Version 1809) in Draft-based. I have created some new fields by extending the standard CDS view.

      But the values of news fields are not saved in backend when creating a new Product.

      By debugging the "COPY_DRAFT_TO_ACTIVE_ENTITY", the values of the added fields are in in the structure but not saving in the Backend.

      Can you please suggest me how I can do it?

      Thank you in advance

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚

      Thanks for sharing this.

      Already add this to Favorites 😀

      Author's profile photo Suman Pandit
      Suman Pandit

      Hi Masaaki,

      This is a Nice blog and thanks for sharing the steps in detail.

      We are doing a Upgrade from 1809 to 2020 and we found an issue with the custom fields enabled though the Custom field and logic app. Same custom field in different persistent structure creating DDIC activation issue.

      I have shared the details in following link -

      https://answers.sap.com/questions/13406733/same-custom-field-used-in-different-persistent-str.html

       

      It will be very helpful if you provide some suggestion.

       

      Thanks

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

      Hi Suman,

      Sorry, I think it is better to ask SAP supprt via Incident for such a case.

      regards, Masa

      Author's profile photo Suman Pandit
      Suman Pandit

      Thank you.

      Author's profile photo Chacon Patricia
      Chacon Patricia

      Hi @Masaaki Arai  : when adding a date type field it gives an error, it doesn't let it activate, any suggestions?

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

      Hi Chacon,

      sorry, pls create cusotmer incident.

      regards, Masa

      Author's profile photo Amulya Rangaraju
      Amulya Rangaraju

      hi Masaaki

      thankyou for the detailed blog

      I see that the custom fields created this way are stored in package ZAR10 (same package as where the DB fields are created) so can you please tell if the package ZAR10 has been registered for extensibility using the Configure Software Packages app.

      If not what steps were done before enabling the usage and pusblishing

      Author's profile photo Andre Gassi
      Andre Gassi

      Hi, Arai.

      Your post gave me a direction, but in the environment (SAP S/4HANA 2020 on premise) where I'm working this not worked.

      The transaction SCFD_EUI show me a lot of messages complaining that was missing Language or Code annotations. So I've dicided to join the two views in one and it worked.

       

      Exemple Code:

      @AccessControl.authorizationCheck: #NOT_REQUIRED
      @EndUserText.label: '<CDS View Lable>'
      @AbapCatalog.sqlViewName: '<CDS View DDIC Name>'
      @Search.searchable
      @ObjectModel.compositionRoot: true
      @ObjectModel.usageType.serviceQuality: #A
      @ObjectModel.usageType.sizeCategory: #S
      @ObjectModel.resultSet.sizeCategory: #XS
      @ObjectModel.usageType.dataClass: #CUSTOMIZING
      @Analytics.dataCategory: #DIMENSION
      @ObjectModel.dataCategory: #TEXT
      @ObjectModel.representativeKey: 'Code'

      define view <CDS View Name>
      as select from <Code Table>
      inner join <Text Table>
      on <Code Table>.<Code Field> = <Text Table>.<Code Field>
      association [0..*] to <CDS View Name> as _Code
      on $projection.Code = _Code.Code
      association [0..1] to I_Language as _Language
      on $projection.<Text Table Langage Field> = _Language.Language
      association [0..1] to <CDS View Name> as _Text
      on $projection.Code = _Text.Code
      {
      @ObjectModel.text.association: '_Text'
      @Search.DefaultSearchElement: true
      key cast( <Code Table>.<Code Field> as <Code Alias> ) as Code,
      @Semantics.language: true
      @ObjectModel.foreignKey.association: '_Language'
      key <Text Table Langage Field> as Language,
      @Search.DefaultSearchElement: true
      @Semantics.text: true
      <Text Table Text Field> as Description,
      @ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
      _Code,
      _Language,
      _Text
      }

      Author's profile photo Lee Xiao
      Lee Xiao

      Hi Masaaki Arai

       

      I have added the field with OXK3 into table ACDOCA, but when I try to enable the field with SCFD_EUI, it shows Cannot Be Enhanced as below, do you have an hints?

       

      Regards,

      Lee

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

      Hi Lee,

      Sorry, but in my internal system, the field in CI_COBL are added to CFL.

      Regards, Masa