I'm currently working on performance improvements in a program which relies heavily on SELECT ... ENDSELECTs to get data from Z-tables based on - apart from the main key field(s) - valid from (key) and to (non-key) fields. These SELECTs are (obviously!) bad as they happen within a loop for thousands of entries and I'd like to improve this by switching to first getting the data into internal tables and then reading those as needed. I however cannot just get the entries which for example fit sy-datum as the relevant date can also come from table content like the invoice date in VBRK-FKDAT. So, I don't know beforehand which of potentially multiple entries for the main key fields is of interest once the date comes into play.
For the SELECTs this is of course easily possible by WHERE-options like these:
SELECT * FROM ztable INTO ls_ident WHERE zz_kunnr_zr = p_kunnr AND datab <= v_fkdat AND datbi >= v_fkdat. ... ENDSELECT.
I'm wondering if there's now an option to do something comparable for an internal table short of looping through it with a WHERE-clause? I looked through the "new" syntax available since NW 740 SP08 (e.g. here) but didn't really find anything which could do the trick. Have I missed it or isn't there one (or at least not an easy/elegant one)?
Thanks much and Cheers
Bärbel