Skip to Content
0
Sep 24, 2019 at 04:00 PM

Dynamic ITAB with reduced column set

106 Views

Hello,

the problem i try to solve: i have an database table with e.g. 50 columns.
I want to create an internal table with a subset of these columns (n<50), due to performance reasons.
The data load is huge and i want to reduce the computing time (operations on ITab) and "RAM wastage" by selecting only the columns really needed.

So the number of columns depends on user interaction (n can be between 1 and 50).

First i tried using following methods which does not work properly with all tables (SELECT-problems causes Unicode-Exception by some tables):
cl_abap_typedescr=>describe_by_name( 'tablename' )
cl_alv_table_create=>create_dynamic_table


With second try i used only RTTI-Methods (which seems to be a really smart way to deal with the problem):

ref_rowtype ?= cl_abap_typedescr=>describe_by_name( 'tablename' )
ref_tabletype = cl_abap_tabledescr=>create( p_line_type = ref_rowtype )

This solution works fine, but i am not able to reduce the number of columns (components).

Has anybody an idea how i can fix the request "dynamic choosing of columns", please :) ?

Kind regards,
Michael Kilger