Ansicht
Dokumentation

ABAPDERIVED_TYPES_SECONDARY_KEYS - DERIVED TYPES SECONDARY KEYS

ABAPDERIVED_TYPES_SECONDARY_KEYS - DERIVED TYPES SECONDARY KEYS

General Data in Customer Master   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

Secondary Table Keys for BDEF Derived Types

Internal tables that are typed with BDEF derived types, i. e. using TYPE TABLE FOR ..., are generally 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 keys are available:

  • 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 component %cid or %cid_ref. Depending on the BDEF derived type, the components can also include %key and %pid.
  • draft: Only available in the context of draft scenarios. The table key draft includes the component %is_draft. 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.

Example

The following source code demonstrates the secondary keys of an internal table type with TYPE TABLE FOR CREATE and table expressions.

The program DEMO_RAP_DISPLAY_DER_TYPE_KEYS allows multiple BDEF derived types (TYPE TABLE FOR ...) and their keys to be explored.

The program makes use of three different RAP scenarios:

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 numbering Root entity: DEMO_MANAGED_ROOT_TEST \lbr \lbr Child entity: DEMO_MANAGED_CHILD_TEST DEMO_MANAGED_ROOT_TEST BP_DEMO_MANAGED_ROOT_TEST
Late numbering Root 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
Draft Root 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

  • Since variables cannot be declared with many of the BDEF derived types outside of the implementation class (for example, in a program), the global class contains variables that are typed with the 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.





ABAP Short Reference   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 7247 Date: 20240328 Time: 110005     sap01-206 ( 39 ms )