Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Question on table operation

bala_krishna007
Participant
0 Kudos

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

1 REPLY 1

DoanManhQuynh
Active Contributor
0 Kudos

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 :).