Secondary Table Keys for BDEF Derived Types Internal tables> that are typed with BDEF derived types>, i. e. using TYPE TABLE FOR ...>>, are standard tables> with an empty primary table key>. However, most of these internal tables have predefined secondary table keys>. In this case, the secondary table keys are always sorted keys>. Currently, the following secondary table keys are available: Secondary Table Key>Details> entity> The table key entity> always includes the component %key>> and is available in all BDEF derived types that have %key> as a component. cid> The table key cid> includes the components %cid>> or %cid_ref>>. Depending on the BDEF derived type, the components can also include %key>> and %pid>>. draft> The table key draft> includes the component %is_draft>> and is only available in draft> scenarios. Depending on the BDEF derived type, the components can also include %pid>> and %key>>. pid>Only available in the context of late numbering> scenarios. The table key pid> includes the component %pid>>. Depending on the BDEF derived type, the components can also include %tmp>> and %key>>.
ABAP_EXAMPLE_VX5 The following source code demonstrates the secondary keys of an internal table type with TYPE TABLE FOR CREATE> and table expressions>. ABEXA 01646 ABAP_EXAMPLE_END
ABAP_EXAMPLE_VX5 You can execute the class CL_DEMO_RAP_DSPLY_DER_TYPE_KS>> to explore multiple BDEF derived types (TYPE TABLE FOR ...>>) and their keys. The class makes use of three different RAP scenarios:
RAP external numbering> (non-draft and non-late numbering)
Late numbering> (non-draft)
Draft> The example is based on dummy BDEFs> and behavior pools (ABP)> that just serve the purpose of including many specifications to display a variety of BDEF derived types: Scenario>Data model>BDEF>ABP> RAP external numberingRoot entity: DEMO_MANAGED_ROOT_TEST>> lbr lbr Child entity: DEMO_MANAGED_CHILD_TEST>> DEMO_MANAGED_ROOT_TEST>> BP_DEMO_MANAGED_ROOT_TEST>> Late numberingRoot entity: DEMO_MANAGED_ROOT_TEST_LN>> lbr lbr Child entity: DEMO_MANAGED_CHILD_TEST_LN>> DEMO_MANAGED_ROOT_TEST_LN>> BP_DEMO_MANAGED_ROOT_TEST_LN>> DraftRoot entity: DEMO_MANAGED_ROOT_TEST_DT>> lbr lbr Child entity: DEMO_MANAGED_CHILD_TEST_DT>> DEMO_MANAGED_ROOT_TEST_DT>> BP_DEMO_MANAGED_ROOT_TEST_DT>> ABAP_EXAMPLE_END
Latest notes:
Since variables cannot be declared with many of the BDEF derived types outside of the implementation class, the global class contains variables that are typed with various BDEF derived types. The methods get_keys>, get_keys_ln>, and get_keys_dt> in the respective classes are responsible for providing the key tables.
The availability of secondary keys varies depending on the specification in the BDEF, for example, draft> is only available for draft scenarios. pid> is only available for late numbering scenarios.
E> in the KEY_KIND> field means empty key. U> means user-defined key. NON_V5_HINTS ABAP_HINT_END