‎2008 Aug 18 10:41 AM
Hi all,
Plz suggest me how to avoid the select statement in loop ?
any alternative is there?
loop at t_dfkkop.
clear dfkkko.
if not t_dfkkop-augbl is initial and
t_dfkkop-xragl is initial.
select single * from dfkkko
where opbel = t_dfkkop-augbl.
if sy-subrc = 0 and
dfkkko-blart = 'A3'.
delete t_dfkkop.
continue.
endif.
endif.
clear : w_augdt, w_stdat, w_process.
select max( augdt ) max( stdat )
into (w_augdt, w_stdat)
from dfkkrapt where opbel = t_dfkkop-opbel
and opupw = t_dfkkop-opupw
and opupk = t_dfkkop-opupk
and stdat ge w_clrfr
and stdat le w_clrto
group by opbel opupw opupk augdt stdat.
endselect.
‎2008 Aug 18 11:17 AM
outside the loop .
use for all entries for table dfkkko ....... in the loop use read statement .
like that you will populate the data.
‎2008 Aug 18 11:22 AM
Hi,
Where exactly the ENDLOOP is placed? Can you tell that?
- Narin.
‎2008 Aug 18 12:32 PM
After the endselect two performs are there ,in these performs also too many select statements are used ,but those taking less time.
after that ENDLOOP is there.
‎2008 Aug 20 7:04 PM
‎2008 Aug 29 8:17 AM
‎2008 Aug 18 11:29 AM
Hi
Create an internal Table it_dfkkko with ur required fields.
then
select single field
into table it_dfkkko
from dfkkko
where opbel = t_dfkkop-augbl.
loop at t_dfkkop.
if not t_dfkkop-augbl is initial and
t_dfkkop-xragl is initial.
read table it_dfkkko with key field = t_dfkkop-field.
if sy-subrc = 0 and
dfkkko-blart = 'A3'.
delete t_dfkkop.
continue.
endif.
endif.
clear : w_augdt, w_stdat, w_process.
select max( augdt ) max( stdat )
into (w_augdt, w_stdat)
from dfkkrapt where opbel = t_dfkkop-opbel
and opupw = t_dfkkop-opupw
and opupk = t_dfkkop-opupk
and stdat ge w_clrfr
and stdat le w_clrto
group by opbel opupw opupk augdt stdat.
endselect.
‎2008 Aug 18 12:13 PM
really your reply helps me a lot.
Thank you for your due response.
Regards,
sam.
‎2008 Aug 18 11:34 AM
Hi,
Please add
select single field
into table it_dfkkko
from dfkkko
for all entries in table t_dfkkop
where opbel = t_dfkkop-augbl.