SQL statement on filter table / ABAP -



SQL statement on filter table / ABAP -

i'm working on abap program. have filter table zfield , zvalue pairs (e.g. "country"+"de", "date"+"q1.2014"). need query table , find cids of pairs correspond filter criteria. illustrate example:

table zfilter (cid, fid, zfield, zvalue):

1, 1, "country", "de" 1, 2, "country", "se" 1, 3, "date", "q1.2014"

my filter criteria front-end:

country=de, date=q1.2014

i want find cids filter criteria match in case country match @ de , date match @ q1.2014 , expected homecoming value cid=1.

i've tried next query:

select distinct cid zfilter table lt_comfilt ( zfield = 'country' , zvalue = 'de' ) , ( zfield = 'date' , zvalue = 'q1.2014' )

however, obviously, gives me no result because of , between statements. i'm guessing i'll have create sort of subquery i'm struggling in abap exceeds open sql expertise.

is there improve way go task or have input how accomplish (perhaps syntactical right illustration of subquerying in open sql)? hope it's clear want accomplish.

thanks in advance!

if understand problem properly, exactly motivation existence of for entries idiom in abap open sql:

data: ls_filter type zfilter, lt_filter type table of zfilter, lt_result type table of zfilter. * fill filter table ls_filter-zfield = `country`. ls_filter-zvalue = `de`. append ls_filter lt_filter. ls_filter-zfield = `date`. ls_filter-zvalue = `q1.2014`. append ls_filter lt_filter. * result: important: don't execute if lt_filter initial! if lt_filter not initial. select * zfilter table lt_result entries in lt_filter zfield = lt_filter-zfield , zvalue = lt_filter-zvalue. endif.

sql abap opensql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -