10

How to add F4 in Standard Fiori Apps for extended ... - SAP Community

 7 months ago
source link: https://community.sap.com/t5/technology-blogs-by-members/how-to-add-f4-in-standard-fiori-apps-for-extended-sap-standard-fields/ba-p/13575859
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Naina_Shetty

Explorer

‎12-11-2023 11:52 AM

Introduction: In this blog I will describe how I was able to add F4 to a standard SAP field that was extended to a Standard FIORI App. To understand the blog you would need to have some basic knowledge of CDS views , extension to CDS views , ODATA service , In-App extensibility (Custom Fields and Logic App ).

Business Need : We are currently migrating our systems to S/4 and as LIS reports are not strategic from a S/4 point of view , decided to replace LIS report MC46 with the standard FIORI app :Slow or Non-Moving Materials FIORI App. During evaluation of the app  , one enhancement opportunity that was identified was the addition of MRP controller as a filter on the app since MC46 has MRP controller as a selection parameter. And the MRP controller field was used by the business for filtration. MRP controller was a standard field so I checked if we could use Data Source Extension option of the Custom Fields and Logic App for adding this field ,Extensibility Documentation for the app , confirmed that Data Source Extension could be used .

If you want to know how Data Source Extension works look at the blog https://blogs.sap.com/2020/04/01/adding-field-in-standard-fiori-apps-of-s-4hana-with-data-source-ext...

The issue with F4: In Customs and Fields Logic App , Data Source Extension Tab when the MRP Controller field was added , the Value Help check box was ticked , which automatically added another field Plant as well.

DataExtension-1.png

Value Help checked on adding the field in Custom Fields and Logic App

Now though the MRP Controller field was added to the filter , showed  the F4 symbol but on clicking on the F4 no values were shown.

MRP_Controller_filter-1.png

MRP Controller in filters

No_Values_F4-1.png
We can see values on F4 on other  standard Filters ( e.g. Storage Location )
Values_on_other_fields.png
Analysis of the problem: In order to understand how to fix this problem first let us see what happens when we use Data Source Extension of Custom Fields and Logic App. Data Source extension in the background actually extends the Consumption CDS view(C_SlowOrNonMovingMatlQry) used by the app with the new fields( A custom extend view is automatically generated that is not editable manually ) . Since the Value Help was checked, Annotation :@Consumption.valueHelpDefinition was added and entity I_MRPController is added ( we have no option of choosing the entity, the Data Source Extension determines the entity for value help ) . So the values for F4 should come from the interface CDS view I_MRPController . Yet we do not see any values on F4
ExtensionViewByDSE.png
( Additional information : We have seen the way Data Source Extensions is able to add a standard field to the app is by extending the Consumption view with new fields ( provided the Consumption views has associations to the entities) . If we create a custom extend view to the consumption view without using Data Source Extensions of Custom fields and logic App we should still be able to add the standard field to the app ).
First step for analysis was to see if the backend (t-code /IWFND/ERROR_LOG) was showing any error. There was an error on the backend as seen in the screenshot below.
BackendError.png
Checked further to see if SAP has any notes for this issue. Found the note (https://me.sap.com/notes/2841893/E) confirms that F4 help functionality is not available for Data Source Extensions and would need to be added manually but does not give a possible solution. Next checked the metadata of the service  to see what was missing . Standard filters which were showing values for F4(e.g. Storage Location) had the section in the metadata(screenshot below) which was missing for MRP Controller field
StorageLocationMetaData.png
 Debugging F4 of any other working standard filters ( e.g. Storage Location)  showed that the F4 triggered method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITYSET of CL_MMIM_SLOWORNONMOVIN_DPC class and the entity set = I_MatlDocStorageLocationVH ( storage location)
Debug_F4_Storage_Location.png
The Odata project for the App is MMIM_SLOWORNONMOVINGMATERIAL . When we look at this project in SEGW we will find that I_MRPCONTROLLER is not one of its entities
Odata_Project.png
So  the Consumption view was extended with the new field and for Value help the right annotation used and CDS View I_MRPCONTROLLER provided as the value help but it is not added as an entity to the service and thus not in the metadata for the service and hence on clicking F4 , no action takes place  and hence F4 does not work . If we could add the entity I_MRPCONTROLLER to the service we can get the F4 to work . But how do we add the entity to the standard service ?
Steps for Resolution : The  blog by Andre Fischer ( https://blogs.sap.com/2021/12/08/how-to-redefine-rds-based-odata-services/ ) helped greatly in understanding how to add the entity to the standard service .
1. We will need to follow all the steps in the blog to redefine the service ,to add the CDS view I_MRPCONTROLLERVH( why not I_MRPCONTROLLER ? Explained later)  to the redefined service  , adjust  MPC_EXT ,DPC_EXT classes, add I_MRPCONTROLLERVH specific _get_entity , _get_entityset methods, add annotations.
2. Now why did we use I_MRPCONTROLLERVH instead of I_MRPCONTROLLER when the Data Source Extension had added I_MRPCONTROLLER as the entity for the value help definition  ? When trying to redefine the service and adding I_MRPCONTROLLER was causing issues as I_MRPCONTROLLER had associations to  several CDS views that were already used in the original service and those CDS views were getting added again to the service and causing issues . I_MRPCONTROLLERVH is an interface view with datacategory #VALUE_HELP and has just the required fields and would be more appropriate for the value help . But the he extended view created by Data Source Extension is not editable as it allows edit only through the Custom Fields and Logic App and we do not have a choice there to chose the value definition entity . So what could be done ?
We deleted the Data Source Extension and instead created a custom extend view for the consumption view as in the screenshot below and changed the valueHelpDefinition to I_MRPControllerVH ( In this particular case this was needed but if the Data Source extension has an appropriate entity for value help you may not need to do this )
ExtendViewZ-1.png
After redefining the service and creating extend view manually , lets take a look at how the metadata looks now
MRP_Metadata.png
And now the F4 help works as expected in the Slow or Non Moving App
MRP_F4.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK