I'm executing the following query, but it has serious performance issues. Can someone tell me what could be wrong?
select max( ekko~ebeln ) as ebeln
ekpo~matnr
into table t_ekpo_max
from ekko inner join ekpo
on ekkoebeln eq ekpoebeln
where ekpo~matnr in s_matnr
and ekko~bedat le s_budat-high
and ekpo~werks in s_werks_full
and ekko~bukrs eq p_bukrs
and ekko~bsart eq 'NB'
and ekko~loekz eq ' '
and ekpo~loekz eq ' '
group by ekpo~matnr.
TIA