What does it do? Defines an alternative key for a RAP business object> that can be used as a secondary table key> when the RAP BO is accessed from ABAP. The secondary table key is created as a non-unique sorted key> in the BDEF derived types> for the BDEF in question, usually in types containing %data> >. Syntax rules:
The alternative key consists of one or more fields Field1>, Field2>, ... Each field can be used no more than once.
The name KeyName> can be used to address the secondary table key. It must comply with the naming conventions >. The name specified cannot be one of the predefined names primary_key > or loop_key>. For further details, see topic TITLE >.
There can be a maximum of ten secondary table keys in a RAP behavior definition>. In general, each internal table can have up to 15 secondary table keys. There are multiple predefined secondary table keys for BDEF derived types> and therefore, the limit for user-defined secondary table keys is 10. The primary key of a RAP BO is derived from the key definition in the CDS data model.
ABAP_AVAILABILITY
Managed RAP BOs>
Unmanaged RAP BOs>. ABAP_AVAILABILITY_END
ABAP_RESTRICTION Secondary tables keys are not available in BDEFs of any other BDEF implementation type>, nor in BDEF extensions>. ABAP_RESTR_END
ABAP_FURTHER_INFO
All possible options to access an internal table from ABAP using a secondary table key are described in topic itab> - Secondary Table Key>.
Internal tables that are typed with BDEF derived types have predefined secondary table keys. All predefined secondary table keys of BDEF derived types are described in topic Secondary Table Keys for BDEF Derived Types>.
The general rules for defining secondary table keys in ABAP are described in topic TYPES, secondary_key >>.
ABAP_EXAMPLE_VX5 The following example shows a managed BDEF that defines an alternative key SecondIndex>. BDEF DEMO_RAP_R_M_DEFINE_KEY The following code snippet accesses an internal table typed with the BDEF derived type of the managed BDEF DEMO_RAP_R_M_DEFINE_KEY> using the secondary table key SecondKey>. ABEXA 01739 ABAP_EXAMPLE_END