SAP CASE TYPE OF RTTI ABEXA



Get Example source ABAP code based on a different SAP table
  



Case Distinction CASE TYPE OF for RTTI
This example demonstrates the case distinction CASE TYPE OF for type description classes.

ABAP_SOURCE_CODE
DEMO CL_DEMO_CASE_TYPE_OF_RTTI

ABAP_DESCRIPTION
Actual parameters of different types are passed to the generically typed parameter param of the method main, and an RTTI type description object is created, to which the general object reference variable typedescr points. The case distinction CASE TYPE OF is used to determine a more specific suitable RTTI type description class. An inline declaration after the addition INTO of the statement WHEN TYPE is used to create an object reference variable of this static type and assign the reference to the type description object. Special attributes of the type description objects are accessed in the associated statement blocks.