2013 Jan 17 9:54 AM
Hi,
i want to select from different tables without to do two select. I want to choose which table i do the select with a condition before.
I try something like this but it didn't work.
DATA lv_table TYPE char10.
IF .........
lv_table = 'sel_table1'.
else.
lv_table = 'sel_table2'.
ENDIF.
SELECT * FROM (lv_table) INTO TABLE wa_table
WHERE .......... IN ..........
I dont know if the brackets are the right way to do it.
any help are accepted.
Thanks
Dio
2013 Jan 17 10:02 AM
Hi Dio ,
TRY this , it will work
DATA lv_table TYPE char10.
DATA : X_HEADER LIKE VIMDESC.
IF .........
lv_table = 'sel_table1'.
else.
lv_table = 'sel_table2'.
ENDIF.
x_header-texttab = lv_table.
SELECT * FROM (x_header-texttab) INTO TABLE wa_table
WHERE .......... IN ..........
Regards ,
Yogendra Bhaskar
2013 Jan 17 10:02 AM
Hi Dio ,
TRY this , it will work
DATA lv_table TYPE char10.
DATA : X_HEADER LIKE VIMDESC.
IF .........
lv_table = 'sel_table1'.
else.
lv_table = 'sel_table2'.
ENDIF.
x_header-texttab = lv_table.
SELECT * FROM (x_header-texttab) INTO TABLE wa_table
WHERE .......... IN ..........
Regards ,
Yogendra Bhaskar
2013 Jan 17 10:14 AM
Hi Dio,
The bracket is the right way to do this. Try with:
DATA lv_table TYPE string.
Cheers!
2013 Jan 17 10:22 AM
If you want to select from two table in single select then you have to do Inner Join.
2013 Jan 17 10:38 AM
Thanks to every one but nothing of this works on me.
I dont think that i can avoid two select.
2013 Jan 17 11:11 AM