Hi guys,
My program has a nested loop which is leading to a huge amount of time being taken for execution.
My code is like
loop at da_record.
DO a times.
if x <= r.
ztable-Account = da_record-Account.
ztable-Entity = da_record-Entity.
ztable-Category = da_record-Category.
concatenate x yr into str1.
ztable-period = str1.
if q <= r.
case q.
when '0001'.
if q = 1.
ztable-value = da_record-value.
endif.
when '0002'.
if q = 2.
ztable-value = da_record-CP1_value.
endif.
.q = 3... arnd
.
.
endcase.
q = q + 1.
x = q .
endif.
modify ztable.
endif.
enddo.
x = g.
q = g.
endloop.
loop stmnt executes 10,0000 times and the do stmnt around 12 times which means 12,000000 inserts in database which is taking huge time.
How do I avoid Nesting of loops.
Thanks
Ankit