‎2014 Jul 01 5:49 AM
Hi All,
I have a 3 level deep structure from which I have to select data. I need to use select statement outside the loop, but not able do that. i'm able to do select within the loop (using field-symbols) only.
please help me in this regard.
Regards,
SriLalitha.
‎2014 Jul 01 7:20 AM
Use SELECT outside the loop using FOR ALL ENTRIES, then use READ TABLE within the loop.
Example:
SELECT * FROM table1
INTO result_tab
FOR ALL ENTRIES IN ref_tab
WHERE column1 = ref_tab-col1.
LOOP AT ref_tab ASSIGNING <fs>.
READ TABLE result_tab WITH KEY column1 = <fs>-col1.
ENDLOOP.
‎2014 Jul 01 6:05 AM
Hi Sri Lalitha,
Please try like below code.
select <fields>
--------
from <tbname>
into <mainstructure>-<subsrtucture>
where <condition>.
Regards,
Venkat.
‎2014 Jul 01 6:09 AM
Hi,
I want to select from a deep structure to avoid its usage in a loop.
Thanks & Regards,
SriLalitha
‎2014 Jul 01 6:42 AM
Create separate internal table like internal structure, and then select the data.
data newtable like table of struture2
newtable = stucture1-structure2.
read newtable into workarea with key <condition>.
‎2014 Jul 01 7:20 AM
Use SELECT outside the loop using FOR ALL ENTRIES, then use READ TABLE within the loop.
Example:
SELECT * FROM table1
INTO result_tab
FOR ALL ENTRIES IN ref_tab
WHERE column1 = ref_tab-col1.
LOOP AT ref_tab ASSIGNING <fs>.
READ TABLE result_tab WITH KEY column1 = <fs>-col1.
ENDLOOP.