Thursday, June 4, 2026

RAP 4: Value Help

  •  In this post will create value help for the RAP Application
  • Step 1: Create Value help CDS View, Provide Value help CDS Name, Description and if possible provide Reference table.        
  • Step 2: Select value help CDS View template
       

  • Step 3:  Add annotation in CDS view:
       
    • CDS Value Help code:
    • @AbapCatalog.viewEnhancementCategory: [#NONE]

      @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'Air Line Value Help'

      @Metadata.ignorePropagatedAnnotations: true

      @ObjectModel.dataCategory: #VALUE_HELP

      @Search.searchable: true

      define view entity ZI_AIRLINE_VALUE_HELP

      as select from /dmo/airport

      {

      @Search.defaultSearchElement: true

      key airport_id as AirportId,

      @Search.defaultSearchElement: true

      name as AirlineName

      }

  • Step 4: Call this value help CDS view using annotation. Goto your Flight Detail Metadata Extension file and add this below annotation
       
    • Flight Detail Metadata Extension Code:
    • @Metadata.layer: #CORE

      @UI.headerInfo: { typeName: 'Flight Detail',

      typeNamePlural: 'Flight Detail'}

      @Search.searchable: true

      annotate entity ZC_CONNECTION_R with

      {

      @UI.facet: [{ id: 'FlightConnection',

      purpose: #STANDARD,

      position: 10,

      label: 'Flight Connection',

      type: #IDENTIFICATION_REFERENCE },

      { id: 'FlightInfo',

      purpose: #STANDARD,

      position: 20,

      label: 'Flight Information',

      type: #LINEITEM_REFERENCE,

      targetElement: '_Flight' } ]


      @UI.selectionField: [{position: 10 }]

      @UI.lineItem: [{ position: 10, label: 'Flight ID' }]

      @UI.identification: [{ position: 10 }]

      @Search.defaultSearchElement: true

      CarrierId;

      @Search.defaultSearchElement: true

      @UI.selectionField: [{position: 20 }]

      @UI.lineItem: [{ position: 20, label: 'Airline ID' }]

      @UI.identification: [{ position: 20 }]

      ConnectionId;


      @UI.selectionField: [{position: 30 }]

      @UI.lineItem: [{ position: 30, label: 'Departure From' }]

      @UI.identification: [{ position: 30 }]

      @Search.defaultSearchElement: true

      @Consumption.valueHelpDefinition: [{ entity: { name: 'ZI_AIRLINE_VALUE_HELP',

      element: 'AirportId' } }]

      AirportFromId;


      @UI.selectionField: [{position: 40 }]

      @UI.lineItem: [{ position: 40, label: 'Destination To' }]

      @UI.identification: [{ position: 40 }]

      @Search.defaultSearchElement: true

      @Consumption.valueHelpDefinition: [{ entity: { name: 'ZI_AIRLINE_VALUE_HELP',

      element: 'AirportId' } }]

      AirportToId;


      @UI.lineItem: [{ position: 50, label: 'Departure Time' }]

      @UI.identification: [{ position: 50 }]

      DepartureTime;


      @UI.lineItem: [{ position: 60, label: 'Arrival Time' }]

      @UI.identification: [{ position: 60 }]

      ArrivalTime;


      @UI.lineItem: [{ position: 70, label: 'Distance' }]

      @UI.identification: [{ position: 70 }]

      Distance;


      @UI.hidden: true

      DistanceUnit;

      }

    • @Search.searchable: true - This annotation will anable global search.
      • When we add this annotation we have to mandatory add @Search.defaultSearchElement: true- Annotation
    • @Consumption.valueHelpDefinition - This annotation get the value from the value help CDS value which we have created in Step 3.

Applied Value Help on Text field 
  • In Projection View we have added Text column name as show in below:
        
       
  • Add @Search.fuzzinessThreshold: 0.8 Annotation, This annotation is mostly applied to filter the text value. 0.8 value indicate that 80% text will match, if you set 0 value then 100% text should be the same which applied in filter 
        

  • Projection View Extension Code:
  • @Metadata.layer: #CORE

    @UI.headerInfo: { typeName: 'Flight Detail',

    typeNamePlural: 'Flight Detail'}

    @Search.searchable: true

    annotate entity ZC_CONNECTION_R with

    {

    @UI.facet: [{ id: 'FlightConnection',

    purpose: #STANDARD,

    position: 10,

    label: 'Flight Connection',

    type: #IDENTIFICATION_REFERENCE },

    { id: 'FlightInfo',

    purpose: #STANDARD,

    position: 20,

    label: 'Flight Information',

    type: #LINEITEM_REFERENCE,

    targetElement: '_Flight' } ]

    @UI.selectionField: [{position: 10 }]

    @UI.lineItem: [{ position: 10, label: 'Airline ID' }]

    @UI.identification: [{ position: 10 }]

    @UI.textArrangement: #TEXT_FIRST

    @Search.defaultSearchElement: true

    @Consumption.valueHelpDefinition: [{ entity: { name: 'ZI_AIRLINE_VH',

    element: 'CarrierId' } }]

    CarrierId;

    @Search.defaultSearchElement: true

    @UI.selectionField: [{position: 20 }]

    @UI.lineItem: [{ position: 20, label: 'Flight ID' }]

    @UI.identification: [{ position: 20 }]

    ConnectionId;


    @UI.selectionField: [{position: 30 }]

    @UI.lineItem: [{ position: 30, label: 'Departure From' }]

    @UI.identification: [{ position: 30 }]

    @Search.defaultSearchElement: true

    @Consumption.valueHelpDefinition: [{ entity: { name: 'ZI_AIRLINE_VALUE_HELP',

    element: 'AirportId' } }]

    AirportFromId;


    @UI.selectionField: [{position: 40 }]

    @UI.lineItem: [{ position: 40, label: 'Destination To' }]

    @UI.identification: [{ position: 40 }]

    @Search.defaultSearchElement: true

    @Consumption.valueHelpDefinition: [{ entity: { name: 'ZI_AIRLINE_VALUE_HELP',

    element: 'AirportId' } }]

    AirportToId;


    @UI.lineItem: [{ position: 50, label: 'Departure Time' }]

    @UI.identification: [{ position: 50 }]

    DepartureTime;


    @UI.lineItem: [{ position: 60, label: 'Arrival Time' }]

    @UI.identification: [{ position: 60 }]

    ArrivalTime;


    @UI.lineItem: [{ position: 70, label: 'Distance' }]

    @UI.identification: [{ position: 70 }]

    Distance;


    @UI.hidden: true

    DistanceUnit;

    @Search.defaultSearchElement: true

    @Search.fuzzinessThreshold: 0.8

    @UI.hidden: true

    AirlineName;

    }

No comments:

Post a Comment

RAP8: Early numbering

In this post will show you how to use early numbering . Step 1: Add early numbering key word in interface behavior definition and activate b...