Hello.
Fetch data using primary key/secondary index and do your processing in internal table.
SELECT ebeln ebelp loekzmatnr werks menge meins netpr elikzpstyp knttp bstyp revlv
INTO TABLE it_ekpo FROM ekpo
WHERE ebeln IN s_ebeln.
delete it_ekpo where elikz = 'X'
OR loekz = 'L'
OR knttp = 'F'
OR knttp = 'K'
OR bstyp <> 'F'
OR werks NOT IN s_plant.
Regards.