Skip to Content
avatar image
Former Member

Value help on hidden fields in Fiori Elements

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 04 at 09:04 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 04 at 09:23 AM

    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

    Add comment
    10|10000 characters needed characters exceeded