Skip to Content
Technical Articles

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

Purpose of this blog

This blog is about how to add a field in standard Fiori apps and other objects by using “Custom Fields” menu in Key User Extensibility Tools “Custom Fields and Logic”. It also intends to explain how internal objects are enhanced internally when adding a field with Custom Fields and Logic, e.g. how a field is added to a table. The tool is not only for new fields but it can add the fields already in the source table to objects like standard Fiori apps.

Custom Fields and Logic has 3 functions, Custom Fields, Data Source Extension and Custom Logic, but this blog focuses only on Custom Fields.

Highlight of this blog:

  • Introduction of Extensibility Registry to find the target object.
  • Explain how a field is added in the relevant objects (table, CDS view, etc..) internally.

Note: this blog is mainly for S/4HANA Any-Premise and S/4HANA Cloud Extended, formerly called STE, but I believe it should also help using the tool in S/4HANA Cloud Essentials, formerly called MTE.

it is also possible to add fields already in the table to apps using CFL. See the blog in detail.

 

Topics:

 

Why is the tool “Custom Fields” very important?

This tool is so important for S/4HANA implementation as it is typical requirement to add fields to standard apps and objects, and this tool help reducing the efforts to add fields drastically by automate the tasks needed to add fields.

In ECC, for adding a field in a screen, firstly it has to be added in the source table using append structure with the transaction SE11, and secondary, they also have to be added in the Dynpro screen with the transaction SE51, and finally, the ABAP logics have to be added to send/receive the values of the added fields between screen and the tables using User/Customer Exit (Transaction SMOD/CMOD) or BADI (Transaction SE18/19).

However, thanks to “Custom Fields”, those tasks are automated! It takes only about several minutes to add fields to the apps and objects. In other words, when fields have to be added in S/4HANA implementation, it is expected to review if this tool could be used. It is also the case even when the screen is SAPGUI Dynpro. It is against best practice to ignore this tool and add the fields manually as it had done in ECC. Therefore, more than technical or Fiori experts, functional experts are expected to understand this tool. Don’t worry, it is not difficult. You can enjoy reducing the efforts with this magic!

In addition, this tool should contribute to making more standard Fiori apps available by adding the important custom fields in the standard Fiori apps. One of the main reasons why a standard Fiori apps cannot be used by business users is important custom Fields for them are missed in the standard Fiori apps. Thanks to Custom Fields, it could be overcome!

Background Info: S/4HANA Extensibility and Key User Extensibility tools

Key User Extensibility tools are the tools to create or enhance the objects without custom coding, and Custom Fields and Logic (CFL) is one of the main tools in Key User Extensibility Tools. Custom Field is a menu in this tool.

In S/4HANA context, S/4HANA Extensibility means creation and enhancement of the apps and objects (note: it does not mean only enhancement). It consists of In-App Extensibility and Side-by-Side Extensibility. In-App Extensibility means creation of the object IN S/4HANA and Side-by-Side Extensibility means development or enhancement OUTSIDE OF S/4HANA, mainly with SAP Cloud Platform. In-App Extensibility consists of Key User Extensibility and Classic Extensibility. Classic Extensibility means traditional custom development like custom program and Function Module. In S/4HANA, the way to create custom object with tools are provided in addition to classical ways, which is called Key User Extensibility tools. In S/4HANA Cloud (SaaS), Classic Extensibility is not available and Key User Extensibility is the only way for In-App Extensibility.

Please note that Key User tools are not only the tools for extensibility, but there are some other tools  in S/4HANA like “Manage Date Function”, I personally want to call it Key User tools. There are some other “In-App tools”. See the blog regarding “In-App tools” for analytics. In addition, conceptually, enhancement of S/4HANA using other SAP or third party tools can be included in Side-by-Side Extensibility, e.g. create analytical apps with SAP BusinessObjects or Microsoft Power BI.

Technical overview

Custom Fields in CFL

Custom Fields and Logic has 3 menus (Functions),

Custom Field: Create custom fields to the table and add it to applications and objects, or add fields already been in the source table to applications and objects.

Data Source Extension: Add fields to a data source from CDS View already associated to the source.

Custom Logic: Add logics to fill/display the value of the custom fields.

See SAP Help in detail.

Focus of this blog is on Custom Fields.

Business Context and the target objects

In Custom Fields in CFL, a field is added to “Business Context”. “Business Context” is a business object in S/4HANA like Material, Business Partner, Product or Billing Document, Journal Entry Item. After that, the fields in the Business Context is added to Fiori apps which uses this business context, e.g. a field is created in the Business Context PRODUCT can be added to Manage Product Master Data (F1602).

There are 2 ways to find the Business Context and the target objects: 1) Extensibility Registry and 2) Detail of each Business Context in Custom Field in CFL (Transaction SCFD_EUI). See the blog in detail.

1. Extensibility Registry

You can find which Business Contexts are in S/4HANA and which objects can be enhanced in Extensibility Registry (Transaction SCFD_REGISTRY). If you want to add a field to business object or apps in S/4HANA, it is expected to check if it is possible with CFL in Extensibility Registry before adding it manually. In other word, if the objects you want to add a field are not in Extensibility Registry, there are no other ways but to add it manually. In case something is not available here, a customer can request it via https://www.sap.com/about/customer-involvement/influence-adopt.html.

 

Business Context tab:

Click a entry (PRODUCT_PLANT) and the detail info is displayed.

Relevant for structural enhancement: The business context is relevant for field extensibility.

Relevant for logic enhancement: The business context is relevant for BADI registration

Persistence Include: This “ddic include” is a part of the database tables that are extended by the Custom Field. It must also be used in the structures that transport the field contents in the ABAP. The “persistence include” is extended by an append, when a new custom field is published.

Transient include: This include is part of the binding structure of an OData service. It contains additional fields (e.g. for descriptions and field control) that are not persisted.

Change indicator include: This include is extended when the application uses change flags to indicate that field content should be transferred (e.g. in a BAPI).

Field Suffix: To prevent name conflict, the custom fields get business context dependent name suffixes.

Quota definition: Here the application defines how many fields with how many bytes a customer may define in this business context.

 

Relationships between the Business Context and the source tables might be explained in some SAP Notes like SAP Note 2590603. This Note is about the relationship between MARC and PRODUCT_PLANT. Or, you could find it with the SELECT statement like below.

SELECT distinct tabname FROM dd02l
WHERE tabname IN ( SELECT DISTINCT tabname FROM dd03l WHERE precfield = ‘PLNT_INCL_EEW_PS’ )
AND tabclass = ‘TRANSP’
AND APPLCLASS <> ”

Please replace “PLNT_INCL_EEW_PS” with the persistent structure name of the Business Context which you want to add the field. You can run the SELECT statement with transaction DBACOCKPIT > Diagnostics > SQL Editor.

 

Extensible CDS View tab:

Detail of I_PRODUCTPLANT

 

Extensible OData Model tab:

MD_C_PRODUCT_MAINTAIN_MDL

Support of Custom Fields tab:

Impl. Type: The implementation type shows how the OData service is implemented ( RDS: Referenced Data Source, SADL: Mapped via SADL, ‘ ‘: Manual implementation ).

Basic Search support: Shows if the OData service supports basic search for custom fields.

Filtering supported: Shows if the OData service supports filtering for custom fields.

CDS View Name: Must be filled for SADL and RDS implemented OData services. If you extend the OData service then the CDS view is extended automatically.

 

Function Module (BAPI) tab:

The FM for the business context PRODUCT_PLANT is CMD_MIG_PROD_MAINTAIN.

Other than above, the following target objects can be checked in Extensibility Registry.

BADI tab: The listed BADIs are used in Custom Logic.

Data Transfer tab: Data transfers define the transport of the content of a custom field from a source business context to a target business context. The application has to call method

cl_cfd_data_transfer_factory=>get_data_transfer_runtime( )->transfer_data in addition to the registration. (the sample source is in Extensibility Registry)

Business Scenario tab: A business scenario is a collection of data transfers. Every involved business context must be connected to the other business contexts via a data transfer. No gaps are allowed.

SAP GUI Context

SOAP Service

IDoc

Association Target

 

The relationship of the tabs between Extensibility Registry and “Custom Field” tool is Not 1:1.

BADI is not in “Custom Fields” (but in “Custom Logic”), and Association Target is the selection list of the association to business object when selecting “association to business object”.

2. Detail of each Business Context in Custom Field of CFL

The target objects for a Business Context can be checked in each tab of “Custom Fields”.

Target objects for Business Context ”Sales: Sales Document”:

UIs and Reports tab:

In UIs and Reports tab, Data Source includes

  • CDS View (starting with C_ or I_ ) ,
  • OData created with transaction SEGW (ending with _SRV in normal),
  • Description of the OData, which is the Entity Types included in the OData, not the description of the OData itself.
  • SAPGUI screen

Email Templates:

Email Templates are only implicitly listed in the Extensibility Registry. Only the CDS Views on which the Templates are based on, can be found.

Form Templates:

Form are only implicitly listed in the Extensibility Registry. Only they CDS Views on which the Templates are based on, can be found

Business Scenarios:

OData API:

SOAP API:

BAPI:

Preparation for Custom Fields and Logic

For using Key User tools including CFL, it is necessary to activate Key User Extensibility. See the SAP Note 2283716 and 2807979 (for on-Premise).

Next, create the role in which the Fiori Catalog “SAP_BASIS_BC_EXT” is included in the menu with the transaction PFCG (in S/4HANA on-Premise). In this catalog, some Key User tools like Custom Fields and Logic are included.

Make the statuses of all authorization objects green in the authorization profile generated in Authorizations tab, and assign the role to your user.

 

After Logging in Fiori launchpad, you can find the catalog “Extensibility” is added. In the menu “App Finder”, add CFL in “Extensibility” catalog to “My Home”.

 

Now you can launch this tool from Fiori launchpad “My home” group.

Add a field to Business Context and apps

Add a field to a Business Context

Steps to add a field to a Business Context

Launching CFL in Fiori launchpad.

Select a Business Context and enter the info for the field to be added.

Push “Create” icon in top-right.

In the following case, enter as below and push “Create and Edit” in bottom-right.

Business Context: Master Data: Sales Document Item

Label: Cust Fld 90

Identifier: ZZ1_C90

Tooltip: Cust Fld 90

Type: Association with Business Object *

Business Object: CUST90 *

  • When selecting “Association to Business Object”, List for Value help can be associated to the created field. In the case above, CUST90 has already been created supposed to be associated to this field beforehand using Custom Business Object. Other than the Custom Business Objects, Views in “Association Target” tab of Extensibility Registry are prepared by default.
  • The following types are provided.

When selection Code list, Code list can be created, and internally the CDS View for the value help is generated and associated to the field.

General Information tab

BAPIs tab (the BAPI is enabled when the field is added).

  • In the screen above, the column Data Source is added with the personalization button (top-right).

 

Push “Publish” in the bottom-right of the screen.

Status is changed to “Publishing”.

Several minutes later, it is changed to “Published”.

Internally, the field is added to the source table(s) with persistent structure

(if the table of the selected business context is Compatibility View, e, the field is added to relevant CDS Views used as the Compatibility View with Extend View, e.g. business context product plant and Compatibility View MARC).

 

Fields to be added to the table:

The fields can be added in the table of the initial screen of CFL with Personalization button (top-right).

Associated Business Objects, Origin (whether created with CFL or already in the table), Created By, Created On, Changed On and Original Language are added below.

 

Custom Fields and Logic can be launched from Runtime Adaptation of the corresponding UI. This way the correct Business Context and Target Object are already pre-selected.

 

How is a field added technically

In the table VBAK, the field is added via the persistent structure of this business context SDSALESDOCITEM_INCL_EEW_PS.

Function Module: The field ZZ1_C90 is added in the following Function Modules

BAPI_CUSTOMERCONTRACT_CHANGE

BAPI_CUSTOMERINQUIRY_CHANGE

BAPI_SALESORDER_CHANGE

BAPI_CUSTOMERQUOTATION_CHANGE

BAPI_CONTRACT_CREATEFROMDATA

BAPI_INQUIRY_CREATEFROMDATA2

BAPI_SALESORDER_CREATEFROMDAT2

BAPI_QUOTATION_CREATEFROMDATA2

 

How is the field added to the BAPIs:

BAPI_SALESORDER_CHANGE

BAPE_SDSALESDOCITEM is BAPI Ext structure for EXTENSIONIN in the FM BAPI_SALESORDER_CHANGE. SDSALESDOCITEM_INCL_EEW_PS is the persistent structure for the business context SD_SALESDOCITEM (Sales Document). This structure has the field ZZ1_C90_SDI is added.

 

Extensibility Registry (Transaction SCFD_REGISTRY)

Open FM BAPI_SALESORDER_CHANGE and double click BAPI Ext structure BAPE_SDSALESDOCITEM.

Double click the structure SDSALESDOCITEM_INCL_EEW_PS.

The field ZZ1_C90_SDI is there.

See the SAP help to understand how to use EXTENSIONIN to enhance BAPI.

EXTENSIONIN in FM BAPI_SALESORDER_CHANGE.

Click Associated Type BAPIPAREX.

BAPIAREX

When you use the BAPIPAREX structure, the field values have to be converted to a special format via the methods of class CL_CFD_BAPI_MAPPING, e.g. the case for Condition Contract.

How to add the field to the FMs which are not in the Extensibility Registry

It depends on the FM how to add the field to the FMs which is not in the Extensibility Registry.

Examples:

  • Field added in MARA to BAPI_MATERIAL_SAVEDATA

Add the field to BAPI_TE_MARA and BAPI_TE_MARAX and use it in Extensionin of BAPI_MATERIAL_SAVEDATA. See wiki in detail.

 

  • Field added in PO tables (EKKO/EKPO, etc) to BAPI_PO_CREATE1.

It is possible to map the new fields in principle in the BAPI using the BAdI ME_BAPI_PO_CUST-> EXTENSIONIN.

MEPOHEADER and MEPOITEM are in the signature of that method so it is possible to map the fields.

See the wiki in reference.

Add a field to apps

Steps to add a field to the relevant objects

Firstly, the custom field has to be added to the data sources. After that, it can be added by manual operation, or added automatically. For using the custom field in KPI app in the views by default, new KPI app has to be created by coping original one. “Adapt UI” is used to add in Object Page. In Fiori Design Studio, the field is added automatically.

 

The fields can be added to the data sources in UIs and Reports tab.

In UIs and Reports tab under Custom Fields tab, set to display Data Source column from Personalization icon.

Data sources are displayed.

 

Push “Enable Usage” for the following 3 data sources in this case.

  • C_SALESCONTRACTITMFLFMTQ (Analytics – Sales Contract Fulfillment Rate)
  • SD_F2583_SLSITMPRPSL_SRV 0001 (Manage Sales Item Proposals)
  • C_SALESQUOTATIONITEMQRY (Sales Quotations – Flexible Analysis)

 

After Saving, push “Publish” in bottom bottom-right.

  • The data source starting with I_ or C_ are VDM (CDS View), and others (most of which end with _SRV XXXX) are OData created with Gateway Service Builder (Transaction SEGW).

 

The “Publishing” is started and will be finished several seconds later. (the status is changed to “Published”.

How is a field added technically

Check the internal objects in which the field is added.

CDS View C_SALESCONTRACTITMFLFMTQ / Sales Contract Fulfillment Rates (F1905).

CDS View C_SALESCONTRACTITMFLFMTQ is used in Sales Contract Fulfillment Rates(F1905).

Open the CDS Views (Data source). The field is added with the Extend View.

Like Append Structure, by using Extend View, the field in the source can be added to the standard VDM without changing the view name.

In the Extend View, the field ZZ1_C90_SDI is added to C_SALESCONTRACTITMFLFMTQ.

In I_SalesContractItemFlfmtCube, the source of C_SALESCONTRACTITMFLFMTQ, the field and the associated view is added with the Extend View.

ZZ1_C90_SDI is from E_SalesDocumentItemBasic , the source of which is VBAP, and which has been associated to I_SalesContractItemFlfmtCube. The source of I_SalesContractItemFlfmtCube is VBAP, so in a sense, VBAP is joined to VBAP. But performance would not get worse because of the join as when the data is accessed, thanks to HANA SQL optimization, SELECT is optimized internally to retrieve the same result without joining VBAP. See SAP Note 2000002 in detail.

 

Run the app “Sales Contract Fulfillment Rates” (F1905) in Fiori launchpad.

The application is launched. Push “Setting” icon (top-right).

The field created with CFL is selectable when trying to do with the value help.

 

To use the custom field in the View, new KPI has to be created by copying original KPI app with the tool “Manage KPIs and Reports”.

SD_F2583_SLSITMPRPSL_SRV 0001

With transaction SCFD_REGISTRY, you can find CDS View C_SALESITEMPROPOSALITEMTP is the source of the OData SD_F2583_SLSITMPRPSL_SRV as below.

The Extend View has been created to add the field and the associated view to CDS View C_SALESITEMPROPOSALITEMTP.

In ADT, Open C_SALESITEMPROPOSALITEMTP and jump to the Extend View.

In the Manage Sales Item Proposals (F2583), the field added with CFL is included. Launch this app from Fiori launchpad.

The application is launched, and the records are retrieved by pushing Go. Click one record and go detail.

The field added with CFL is included in the table of Materials.

CDS View C_SALESQUOTATIONITEMQRY / Sales Quotations – Flexible Analysis (F4093)

CDS View C_SALESQUOTATIONITEMQRY is the source of Sales Quotations – Flexible Analysis (F4093), which is Fiori Design Studio application. When a field is added to the source CDS View, it is also added to the application automatically when the app type is Fiori Design Studio.

When a field is added with CFL, Extend Views have been created to add the field to C_SALESQUOTATIONITEMQRY and the source Interface view of this consumption view. You can find them with ADT.

Extend View for C_SALESQUOTATIONITEMQRY

Extend View for I_SALESQUOTATIONITEMCUBE_2 (source of C_SALESQUOTATIONITEMQRY)

In Fiori launchpad, launch the app Sales Quotations – Flexible Analysis (F4093).

The field is added in the application.

Note: Text of the field is not added although the field type is “association with Business Object”, as the analytics category is not set to DIMESION in the associated CDS View. It is not the case when selecting “Code List” as field type. Then Analytics category of the generated CDS View is set to DIMENSION.

Others

  • For the field type Text, master view cannot be associated to the custom field. For adding the field with associated custom master CDS View based on custom table, the field and the custom master view have to be added with Extend View manually.
  • To derive the values to be written in the standard field from the value inputted in the custom field, technically Custom Logic could be used, but it depends on the BADI provided for Custom Logic. In case of SD, it is not possible to derive the value for standard field.
  • One typical requirement is to add a field with associated master view, and the custom table must be the source of the master view. For meeting the requirement, the field has to be added manually to the source table and the master view should be created using the custom table as the source. In the transaction SCFD_EUI, add this field as Custom Field and select LIST as semantic type and set the created custom master view as the value help view. See the blog in detail.

 

Hope you enjoy more and more standard Fiori apps by adding important fields with Custom Fields and Logic!

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

    This is really good block .It helped to clarify concept about In app extension and side by side extension.Thank you.

    If I am having ABAP on cloud scp along with S/4 hana system.Is it side by side extension and what is scenario we will be using this ? Will you please help to explain on this more?

    Regards,

    Shweta

     

     

  • A very nice blog post that provides a look “behind the scenes” which is in particular important for all users of the on-premise edition.

    Let me add 2 points

    1. you wrote: Business Context” is a business object in S/4HANA like Material, Business Partner, Product  …  . More precisely, a business context belongs to a business object node, for example sales order header or sales order item. Thus, in most business objects you find 2 business contexts, sometimes even more.
    2. You are describing nicely the activation steps for Key User Extensibility in the on-premise version. Readers may ask how this works in the Cloud edition. The good news is, in the Cloud edition, Key User Extensibility is already active by default (except for the starter edition, see SAP note 2283716), and you only have to assign the respective role to the users (see the documentation to find the exact role names).

    Regards, Thomas