09-02-2018 7:23 AM
Hi Experts,
I have a internal table with 28 columns explaining class characteristics so my internal table looks like this.
where f1 f2.. are class characteristics
f1 f2 f3 f4 .. f28
I need to filter the table entries based on ranges r1 r2 .. r28
that means if field f1 is not in ranges r1 and r1 is not initial delete that table entrty because field f1 is not in the range of r1 and r1 is filled .
the procedure I am using is
loop internal table tb_tab into wa
if wa-f1 is not initial and r1 is not initial
check wa-f1 in r1
endif
if wa-f2 is not initial and r2 is not initial.
check wa-f2 in r2.
endif
.
..
.. similarly for fileds 28 till r28
append wa to tb_temp
endloop.
finally delete table tb_tab and create an temp table tb_tab_temp and pass temp table contents to tb_tab.
please suggest if there is any other better way
thanks
balu
09-02-2018 8:52 AM
I think you should check whether range is initial or not then put it into select condition, you can use dynamic sql here.
or you can use assign field symbol like:
loop at itab into wa.
do 28 times.
assign component sy-indx of structure wa into field-symbols(<val>).
assign |range_name{ sy-indx }| to <rng>. " i dont have system here to check so basically you need to have 28 range
" with same name except last number.
check <val> in <rng>.
endo.
endloop.
i think above code not make the performance better but it shorter :).