Get Example source ABAP code based on a different SAP table
ID SET-NAMES • SET NAMES ABAP_STATEMENT_EML • MAPPING LIKE SET NAMES • MAPPING TYPE SET NAMES
SET NAMES>
ABAP_SYNTAX SET NAMES fields FROM FLAGS src ${ MAPPING ${ TYPE p_type $} $| ${ LIKE var $} $}.>
ABAP_VARIANTS: 1 ... MAPPING TYPE p_type.> 2 ... MAPPING LIKE var.>
What does it do? Used for the conversion of fields that have the technical type> x>> and field name lists in the context of RAP. The statement deals with BDEF derived types> that include the components %control>> and %element>>. The components of %control> and %element> have the technical type x>. The ABAP statement is targeted at applications that include, on the one hand, RAP BOs> that use BDEF derived types and, on the other hand, implementations of the RAP BO behavior> that use other data types. Mapping of field names is required if types are involved that have different field names than those in the underlying CDS entities> of the RAP BO. fields> represents a general expression>. A variable in the position of fields> must be a table containing one or more field names. It is of type ABP_FIELD_NAME_TAB>>, the line type is ABP_FIELD_NAME>>. src> represents a general expression >. A variable in the position of src> must be typed with a BDEF derived type that contains %control> or %element>. As a result of the ABAP statement, the field name list fields > contains those fields that have non-initial values in the %control> or %element> structure of src>. The ABAP statement SET FLAGS>> does the conversion the other way round. The following short dumps result from an operation that cannot be executed at runtime using the SET NAMES> statements:
TCHK_TYPE_LOAD>: Inappropriate type for field names.
BEHAVIOR_FLAGS_NAMES_ERROR>: Inappropriate type on the BDEF derived type side or a missing mapping, which is true for the variants of the statement.
ABAP_VARIANT_1 ... MAPPING TYPE p_type.>
What does it do? Used in case type mapping is required for a structured DDIC type>, for example, a legacy type. As a prerequisite, the BDEF contains a mapping specification for the mapped type. See more information in the RAP BDL topic mapping for>>.
ABAP_VARIANT_2 ... MAPPING LIKE var.>
What does it do? Used in case type mapping is required for a structured DDIC type>, for example, a legacy type. This variant is relevant if the type is not available and is a variable of the required type instead. As a prerequisite, the BDEF contains a mapping specification for the mapped type. See more information in the RAP BDL topic mapping for>>.
Latest notes: %element> contains the names of all associations of the RAP BO. However, type mapping cannot be defined for associations. Hence, if the ABAP statement is used with mapping> and a BDEF derived typed with %element>, information from %element> that relates to associations is lost. In this case, only the mapped component name is available in fields>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 The following source code section taken from CL_DEMO_RAP_EML_SET_NAMES>> shows the syntax of the SET NAMES > variants. ABEXA 01553 ABAP_EXAMPLE_END
ABAP_EXAMPLE_ABEXA The example ABAP_EML - Variants of SET NAMES>> demonstrates the three different variants with a simple managed RAP BO. ABAP_EXAMPLE_END