Skip to Content
0
Former Member
Dec 06, 2006 at 04:42 PM

Select from generic table

341 Views

Hello,

I have an internal table containing selection parameters determined at run-time.

eg. it_ipak_selections contains the entries.....

FIELDNAME SIGN OPT LOW

FISCVARNT I EQ K4

FISCPER I EQ 2006011

RBUKRS I EQ CH15

Using these entries I need to retrieve entries from database table rsseldone.

This (BW) table contains requests based on selection parameters.

Unfortunately the table structure is generic, field Fieldname can contain any selection parameter e.g. 'BUKRS'. and for one request there can be 'N' entries, depending on the number of selection parameters.

Here is the table structure with an example.

REQUEST FIELDNAME SIGN OPT LOW HIGH

REQU_123 BUKRS I EQ DE3

REQU_123 FISCPER I BT 2005001 2005003

REQU_987 BUKRS I EQ CH15

.......

For this reason a "Select.... for all entries" statement retrieves too much data.

SELECT rnr fieldname iobjnm sign opt low high

FROM rsseldone INTO CORRESPONDING FIELDS OF TABLE lt_rsseldone

FOR ALL ENTRIES IN it_ipak_selections

WHERE fieldname = it_ipak_selections-fieldname

AND iobjnm = it_ipak_selections-iobjnm

AND sign = it_ipak_selections-sign

AND opt = it_ipak_selections-opt

AND low = it_ipak_selections-low

AND high = it_ipak_selections-high.

Does anyone know an efficient way to select the data?

Thank you,

Rod