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.
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)
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.
define view ZI_MATGRPVH
as select from t023
association [0..*] to ZI_MATGRPVHT as _Text
on $projection.Code = _Text.Code
key cast( matkl as zzmatgrp01 ) as Code,
@EndUserText.label: ‘<End User Label>’
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
key cast( matkl as zzmatgrp01 ) as Code,
//Use this for language-dependent descriptions:
key spras as Language,
//Use this for language-independent descriptions:
//key $session.system_language as Language,
wgbez as Description,
@ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
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!