In this blog, we will see , how this can be achieved. So, Lets begin…
There are multiple ways to achieve this and we can select the best option based on the scenario. Let’s see what are these options…
Let’s see how we can create code list and how it appears on the app.
For this case, I am going to add custom field “Category” to the Customer Master Basic data
- Open CFL fiori app click on “+” to create a new custom field. Fill the details as shown and below and here we are going to select field type as Code List.
- As we select the code list, we will see the section to create the code list values ( the values which will appear in the field help). Maintain the values as needed and click on “create and edit”
- GoTo the “UI & Reports” tab and click on “Enable Usage” for Business Partner API.
- Click on Save and then Publish.
- Add the field to the Customer master basic data screen.
- On edit, we will see the F4 help available for the field and the values we maintained in code list are available for selection.
Association to Custom Business Object
We can create the F4 help by associating the custom filed with Business Object created using “Custom Business Objects ” fiori app. Let’s see how..
- Create a custom CBO( or use existing one) which will serve as the F4 help for the custom our custom field. Here I created Custom BO “BP_Category_BO” with fields Category and Description as in the code list scenario.
- To maintain the values in CBO in On-Premise, we need to create a custom maintenance app and maintain the values as shown below.
- Next, create another custom field “Category_BO_F4” and this time associate it with BO “BP_CATEGORY_BO”.
- Now, add the field “Category_BO_F4” to the Customer master app.
- On edit, F4 help will be available from the associated BO
F4 Help from standard table field
Let’s say the requirement is to show the f4 as values from standard table and not as fixed list or values from custom BO. We will see how this can be achieved…
For this scenario , let’s say we want to add a custom filed for business partner type ( its just for demo and not a real business requirement) and F4 values should be displayed from standard table TB004 (BP Types)
To achieve this, we will not start with creation of custom field in CFL but old classic ways… yes, you heard it right the classic way of table append.. then what about In-App extensibility??… Very valid question… and that will be well taken care.
Let’s see the steps:
Extend Required Standard table BUT000 with custom field .
To add field to BUT000 we will append structure with custom field to extensibility INCLUDE “INCL_EEW_BUT000” .
- Create Custom append structure ZTESTF4
- Add custom field “ZBP_TYPE_F4_DEMO” with custom data element “ZBPTYP” of type char4 (similar to standard BP type field in TB004)
- Field will reflect in BUT000
Enable Custom field for Custom fields and logic
This is where we are are going to address the In-App extensibility part. SAP has provided transaction “SCFD_EUI” to enable the already existing custom fields for Custom Fields and Logic and use them for Fiori apps extension through In-App.
GoTo TCODE “SCFD_EUI” and enter tablename as “BUT000” , field as “ZBP*” and execute
- Next screen shows if the custom field can be enabled for CFL or Not or it need some pre-work before enablement. As we have added field directly under extensibility INCLUDE only , it shows filed “Can Be Enabled”
- As you see there are multiple rows for the field depending on which all tables it is linked. Enabling one will enable all automatically. Select one row and click on Enable.
- Fill in the details in the next screen and field type should be Code List as we want F4 help for our field.
- Click Generate icon in-front of Value help view field.
- This will generate sample templates for the CDS views which can be used to create CDS views for search help for custom field “ZBP_TYPE_F4_DEMO”. There will be two views which will need to created in defined format, code view and the text view.
- Code view will have the value field and will be associated to the text view
- Text view will have the text description for the values in code view.
- GoTo Eclipse and create Code and Text views using these template code as shown below. Here Table TB004 and TB004T are used to get values of BP Types and BP Type text.
- Pass above created view “ZBPTYPHELP” in the Value help view field and proceed.
- We can see all the field rows shows Enabled and field ID is also generated.
- Next, open the “Custom Fields and Logic” App and we can see our custom filed is available there.
- Enable the Filed for usage in Business Partner API and Publish it again.
- Add the field to the Customer master app and in Edit mode we should see the F4 help.
- F4 Help will show the values from table TB004 and the Text from TB004T
- Select the value and save and the selected value is updated.
With this we have come to an end. We saw the different ways to add F4 help to the custom fields created using Custom Fields and Logic.