Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8807

Re: Help for RTTS

$
0
0

Hi Marina,

 

at some point in time you have to know something about the data that you actually want to store through RTTC objects.

 

For the element's names you can go with generic names like COLUMN1 ... COLUMNn although this somewhat contradicts the concept behind RTTC because if the data is that unspecific you could probably store everything in a STANDARD TABLE OF string or something similar.

 

If you want to have more general types you can simply achieve this by using the following snippet:

 

DATA:

     gv_field_type     TYPE char40,

...

gs_component-type ?= cl_abap_elemdescr=>describe_by_data( gv_field_type ).

 

In that instance the type is derived via RTTI (runtime type identification) from the pre-existing type you provided.


If you rather want it to be maximum generic (like you're getting a formal description of the structure that you want to build up - comparable to an XML schema) you can use this style:

 

gs_component-type ?= cl_abap_elemdescr=>get_c( 40 ).

 

This example creates a C(40) type - check out the other static methods the class cl_abap_elemdescr provides to see what's in there (get_i(), get_p(), get_string() etc.).


Regards,

   Chris


Viewing all articles
Browse latest Browse all 8807

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>