Get Example source ABAP code based on a different SAP table
Determining Elementary Data Types This example demonstrates how the properties of elementary data types can be determined at runtime.
ABAP_SOURCE_CODE DEMO CL_DEMO_DESCRIBE_FIELD
ABAP_DESCRIPTION This example implements a type check that only allows assignments if the source and target fields have the same type. Using the two input fields type1> and type2>, the names of elementary data types are entered. Next, an attempt is made to create anonymous data objects of the types specified dynamically using the CREATE DATA> statement. If this does not work, an error message is displayed. The statement DESCRIBE FIELD> determines the type of the data objects created dynamically. Only if both data objects have the same type dereferenced is dref2->*> assigned to dereferenced dref1->*>. The example does not work if complex data types such as SCARR> and SPFLI> are entered in the input fields. In this case DESCRIBE FIELD>, determines the same types (u>), which can cause runtime errors if the structures are not convertible to each other. The RTTS> methods can be used to check complex data types and object types at runtime.