Skip to Content
Sep 26, 2006 at 12:13 PM

Internal Table dynamic query



I have an internal table which needs to be queried with set of attributes which change dynamically. How can I do it?

Eg: Internal Table i_tab contains attributes a,b,c,d,e etc... Now I should extract a single line from the table based based on the values I supply for the attributes.

Say if I give a=23 b='' c='abc' d='' e=''. Then the query should be able to return be the line where all the initial field attributes (here in this case b,d, and e) should not be considered for the query.

It shoud be

read table i_tab with key a= 23 c='abc'.

The next time a query can be shooted with the foll values

a='' b='SAP' c='ERP' d='' e=''.

Then the query shd be

read table i_tab with key b= 'SAP' c='ERP'.

In short can I get the functionality of the "select statement dynamic search string"?

select * from tab where ( search string ) .

and search string would be generated dynamically based on the inputs?

I would be really thankful if you can provide me an immediate answer.

Thanks and Regards,