Do Runtime Type Services (RTTS) use database to get data descriptions?


Do methods like describe_by_data, get_ddic_field_list, get_components (of cl_abap_typedescr and similar), retrieve data from database or does it get generated on application server?

I looked at those classes and all of the some methods (that populate cache, presumably) appear to pull data in non-standard ways (METHOD ... BY KERNEL MODULE ...) and others pull data from cache. I am wondering how it gets pulled if it is not cached.

Google didn't give me any concrete info on this topic either.

Some context, in case details become relevant

I've been looking into implementing dynamic select clauses generation for some generic classes (to replace asterisk for column-based processing in S/4HANA and hopefully reduce the strain on DB).

Since most of those classes retrieve data into dictionary type structures, I figured I could use type descriptions of Runtime Type Services (RTTS), to get the field lists and dynamically generate the select clause based on target structure.

In most cases I can work around performance loss (if there is any) by implementing static variables (and only processing it once per session), but I've ran into similar cases where static variables were not an option (processing is made on unknown types) and I had to abandon the idea because I wasn't sure how it would impact the peak performance if those methods were called, let's say 30 times per session.

Edit (just a piece of code, to avoid further confusion that leads to condescending comments with no substance):

lo_struct ?= cl_abap_structdescr=>describe_by_data( header ).
ct_components = lo_struct->get_components( ).
"Loop through ct_components appending names to lv_select_clause

lv_select_clause = get_header_fields( is_target_structure = header ).
select single (lv_select_clause)
  from rbkp
  where gjahr = @iv_gjahr
    and belnr = @iv_belnr
  into corresponding fields of @header.


  • I can't be sure for the latest ABAP versions, but that ABAP Dictionary stuff (AKA "DDIC" for Data Dictionary) originates from the database tables DDNTT and DDNTF (also called "nametab", and its elements are called the "database runtime objects") which are filled during activation of DDIC objects (tables and so on, those tables are DD02L, DD03L, as said by @icbytes, and so on).

    When they are queried, they are also transferred and persisted in every application server memory. This memory is called the nametab buffer. The newest data are replacing the oldest data when the buffer is full.

    No idea about the performance, but no doubt that it can be neglicted compared to the SELECT you do right after.

    One more thing, about RTTS, always use the GET_* methods rather than the CREATE_* ones because they are faster (they behave slightly differently, but generally only experienced developers may need to use the latter ones).

    If you want, you can add another layer of memory, but I guess it's not worth doing it (more developer time spent + more memory consumed versus no big performance improvement).