‎2010 Jun 24 9:18 PM
I have to select data from table ZABC, which has following fields & data
FieldA Field B
A X
B Y
A Y
C Z
My selection parameter SEL_TAB is a table type with FieldA and FieldB.
I want to write a select statement which gets only records matching both FieldA & FieldB, for example if I pass 'A' & 'X', it should get only first record.
Since my selection parameter contains thousands of records, do I need to write a select statement within loop? or is there a better way to handle this.
Loop at SEL_TAB intl l_sel_tab.
select * from ZABC where fieldA = l_sel_tab-fieldA
and fieldB = l_sel_tab-feildB.
Endloop
Thanks,
JB
‎2010 Jun 24 9:30 PM
Have a look at the SELECT ... FOR ALL ENTRIES ... statement, this does what you are looking for.
Thomas
‎2010 Jun 24 9:30 PM
Have a look at the SELECT ... FOR ALL ENTRIES ... statement, this does what you are looking for.
Thomas
‎2010 Jun 24 10:05 PM
Thanks Thomas..I dont know how I forgot this option:-)
Anyway, have assigned you the points.
‎2010 Jun 24 9:52 PM
Since those are simple select-options, you no need to loop them,
select-options: s_fielda for table1-fielda,
s_fieldb for table1-fieldb.
select * from table1
into table <internal table>
where fielda in s_fielda
and fieldb in s_fieldb.
Thanks
Satyasuresh Donepudi