Show TOC

Getting Text Using Foreign Key AssociationsLocate this document in the navigation structure

In addition to using the text association directly, you can also use the foreign key association CDS annotation to provide a text for a CDS Element. This is of particular importance when providing values help for CDS view elements. The value help results from foreign key associations as a kind of side-effect - without further action. As a consequence, the value help is available automatically in numerous applications through the propagation of corresponding annotations.

Steps
To retrieve texts by adding foreign key associations, proceed as follows::
  1. Create a data definition with a CDS view that serves as text provider

    As result of this step, the CDS view is specified as a text provider view using the @ObjectModel.dataCategory: #TEXT annotation. In the text view, the language key element and the text elements are also defined through appropriate CDS annotations.

  2. Create a text association from a CDS view to the text provider.

    The element that is annotated with @ObjectModel.text.association points to the text provider view, which is defined as the target of the association of the text consumer view.

  3. Define a foreign key association to the relevant field of the consumer view.

    In this step, you will define the foreign key association from the consumer view with the text consumer view (as defined in the previous step) using the @ObjectModel.foreignKey.association annotation for the relevant field.

More on this:

The steps above, including the CDS annotations to be used, are described in detail in the topic: Value Help Based on Foreign Key Relationship