Application Development and Automation 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: 
Read only

code optimization !!

Former Member
0 Likes
385

hi,

how to optimize the follwoing peice of code to count the no. of checkboxes clicked. ??

LOOP AT i_final INTO wa_final WHERE v_box = 'X'.

v_counter = v_counter + 1.

ENDLOOP.

i know if table contains 10000 records it will chekc the whole table..

how to optimize it ?? and store the value os checboxes clicked in V_COUNTER ??

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
365

Hi,

Create another temporary internal table i_final_temp.

Then do the following:


refresh i_final_temp.
append lines of i_final to i_final_temp.
delete i_final_temp where v_box ne 'X'.
describe table i_final_temp lines v_counter.

This avoids any looping and hence improves performance.

Cheers,

Aditya

3 REPLIES 3
Read only

Former Member
0 Likes
365

Hi,

U declare a local internal table with same structure of that inetrnal table and pass the values to that internal table. then delete the records which dont have the checkbox on.

u will be left with records with check box on..

then use DESCRIBE TABLE ITAB LINES N.

N will the no.of records in the internal table with check box on.

PS: pleae reward points if found Useful

Read only

Former Member
0 Likes
366

Hi,

Create another temporary internal table i_final_temp.

Then do the following:


refresh i_final_temp.
append lines of i_final to i_final_temp.
delete i_final_temp where v_box ne 'X'.
describe table i_final_temp lines v_counter.

This avoids any looping and hence improves performance.

Cheers,

Aditya

Read only

Former Member
0 Likes
365

resolved..