cancel
Showing results for 
Search instead for 
Did you mean: 

Value help on hidden fields in Fiori Elements

Former Member
0 Kudos

Hi Experts.

I am currently dealing with the following problem:

I have a view which provides a Value help on a table which has a UUID as primary key.

And we have a transactional View which consumes the value help. This view has a reference field which is a UUID too.

Because no one will see a UUID on the screen, I would like to hide the UUID on the consuming view AND in the value help. And here is my problem!

I can't find a way to hide the UUID and display the Text with the value help attached.
Text is in the table which is an association to the consuming table and must be read only -> read only field can't have a value help. And even if it would be possible, how can I tell the value help to push the key NOT in the text field?

Does anyone have an idea how I can get rid of the UUID Field on the screen by Fiori Elements annotation?

Thanks a lot in advance

Accepted Solutions (0)

Answers (5)

Answers (5)

vinod_snair
Participant
0 Kudos

Hello Community,

Fiori elements with UI5 version 1.84, Input fields with value help can now be configured to show texts and ID together in the Edit and Display modes of an object page. For more information, see Displaying Text and ID for Value Help Input Fields. In case there is any open questions you can also follow or ask in the newest thread on this topic here.

Regards,

Vinod

0 Kudos

Hi Experts,

I took advantage of both solutions:

  • I annotate the field in your CDS view with UI.TextArrangement: #TEXT_ONLY and that fixed the view mode problem
  • for the edit mode I solved with setTextInEditModeSource("NavigationProperty") on the field (for that I attached and handler for attachPageDataLoaded event with extensionAPI on the onInit method of my extension controller for ObjectPage.

Now my problem is with the smart filter on the list report: I cannot find a way to hide the UUID and show something more human readable. Any ideas?

Thanks in advance

Alessandro

gabriel_candrian
Explorer
0 Kudos

Hello Bettina

Meanwhile we have used the SmartForm Extension Point to add custom SmartFields with the textInEditMode property set. Alternatively one can also set this property in the onInit method of the ObjectPage Controller by using a Controller Extension and accessing the element by it's id.

Unfortunately this feature has some flaws when the key property is of type Edm.Guid: The field tries to retrieve a text for initial GUIDs and then produces an error message as there are no texts to be found for initial GUIDs. In addition, when initializing the field by removing the text value the key property is cleared in the bound context but the field displays the text value again when it loses the focus - making the user assume that the value has not been cleared.

I issued a call at SAP but their answer was more or less the same as in the other call. SAP says that this feature is experimental and not intended for productive use. I don't know if they really care about that obvious problem. Meanwhile the release 1.70 of SAPUI5 is available (Cloud Version) and still nothing has changed up to now...

If this is not a suitable solution for you, you could also use the SmartForm Extension to place the text value with an icon or button to open a value help dialog so that the user can select the item and then set the key/text values in the corresponding properties of the bound context. Of course this means quite more work to be done.

Hope this helps.

Regards
Gabriel

breinelt
Explorer
0 Kudos

Thank you very much.

We will see what's the best way for us. We are using GUIDs so it won't be that easy.

I can't understand why this should be an experimental feature, well... It's often not that easy with SAP.

Regards

Bettina

gabriel_candrian
Explorer
0 Kudos

About your other question "And even if it would be possible, how can I tell the value help to push the key NOT in the text field?":

Use the additionalBinding of the @Consumption.valueHelpDefinition annotation in your CDS view.

Or if you are using the class generated by the SADL Generation Toolkit of your service to enrich the metadata (e.g. to bind a value help to a function import parameter), you could use the annotation "com.sap.vocabularies.Common.v1.ValueListParameterOut" in your value help binding to bind the key field of the value help to the corresponding property. Something like:


    DATA:
      lo_ann_target TYPE REF TO /iwbep/if_mgw_vocan_ann_target,
      lo_annotation TYPE REF TO /iwbep/if_mgw_vocan_annotation,
      lo_record     TYPE REF TO /iwbep/if_mgw_vocan_record,
      lo_collection TYPE REF TO /iwbep/if_mgw_vocan_collection.

    lo_ann_target = vocab_anno_model->create_annotations_target( iv_target = "<Your target>" ).
    lo_annotation = lo_ann_target->create_annotation( iv_term = 'com.sap.vocabularies.Common.v1.ValueList' ).
    lo_record = lo_annotation->create_record( ).

    lo_record->create_property( 'CollectionPath' )->create_simple_value( )->set_string( CONV #( i_valuelist_entityset ) ).
    lo_collection = lo_record->create_property( 'Parameters' )->create_collection( )      ##NO_TEXT.

    lo_record = lo_collection->create_record( 'com.sap.vocabularies.Common.v1.ValueListParameterOut' ).
    lo_record->create_property( 'LocalDataProperty' )->create_simple_value( )->set_property_path( "<Name of localdataproperty>" ).
    lo_record->create_property( 'ValueListProperty' )->create_simple_value( )->set_string( "<Name of valuelistproperty>" ).

Regards
Gabriel

gabriel_candrian
Explorer
0 Kudos

Hello

We have the same problem. As the BOPF object model wants single UUIDs as a primary key, it is just a matter of time until the developer runs into this dilemma when the application is a bit more complex than the sales order app SAP usually uses for examples... 🙂

As of release 1.54 of SAPUI5 the SmartField control has a new attribute TextInEditModeSource: SAPUI5 SDK - smartfield.TextInEditModeSource
But unfortunately Fiori Elements does not use this new attribute of the SmartField (by now).

I have issued a call several month ago relating to that problem. Here is an excerpt of the reply i got from SAP:
Please be aware that the feature is still marked as experimental. The reason for that is as follows:
With the current implementation it is cumbersome or even impossible to use the feature in scenarios like Fiori Elements.
To improve the situation we want to introduce some kind of automatic mode, where the feature is enabled as soon as the metadata provide all necessary information.
During the implementation there might be changes to the existing API needed, therefore still the "experimental" flag is set.
As always I unfortunately cannot make any statement about when the enhancement will be available for our customers.

So at the moment i think you have this options:

  1. Use the newest SAPUI5 release from the Cloud (1.56.8) and the extension point for forms on the object page (i didn't get this extension to work in my app though until today) to add a custom SmartField to the form with the feature mentioned above or replace the whole section by using the extension point for sections on the object page.
  2. Annotate the field in your CDS view with UI.TextArrangement: #TEXT_ONLY and wait until SAP implements this in Fiori Elements (if your project is patient enough). This way you will at least have the text in display mode. In edit mode the guid will still show.
  3. Denormalize your data model in your CDS views with an alternative/semantic key that is unique and human readable and expose this with a value help to the user. Add a determination for that node to fill the corresponding UUID. (not a solution that a developer really favors - but what do you want, if you are handcuffed by the framework...)

At the moment we are favoring number two as our project is rather long term and are hoping that SAP will come up with this feature soon... 🙂
I would be very interested in your approach to solve this problem.

Regards
Gabriel

breinelt
Explorer
0 Kudos

Hello Gabriel,

we are also using number 2 as a current solition. Are you managed to get an other solution meanwhile?

Thank you very much.
Regards

Bettina