‎2008 Apr 08 1:23 PM
Hello,
I have to tables t1 and t2. In the first table I have a field f1 which has the name of t2 as value.
How has to be the Select Statement
I tried
DATA: l_table TYPE CHAR5 .
Select v1 into l_table from t1
Select v2 into xx from (l_table).
But I get there allways an error and I could not find an starting point in seach for this problem.
Thank for any help
Regards
Henning
Edited by: Alvaro Tejada Galindo on Apr 10, 2008 5:15 PM
‎2008 Apr 08 1:28 PM
Hi,
the problem may be with select use select single.
or else give the error description.
DATA: l_table TYPE CHAR5 .
data:var(10).
Select SINGLE f1 into l_table from t1.
Select SINGLE f into var from (l_table)."here ensure that field F is there in table T2.
rgds,
bharat.
‎2008 Apr 08 1:25 PM
Do like this
Select v1 into l_table from t1.
endselect.
Select v2 into xx from (l_table).
endselect.
‎2008 Apr 08 1:28 PM
Hi,
the problem may be with select use select single.
or else give the error description.
DATA: l_table TYPE CHAR5 .
data:var(10).
Select SINGLE f1 into l_table from t1.
Select SINGLE f into var from (l_table)."here ensure that field F is there in table T2.
rgds,
bharat.
‎2008 Apr 08 1:39 PM
what is the exact error message?
is your table name really only 5 characters long (CHAR5)?
‎2008 Apr 08 2:02 PM
Hello,
and thanks for the answer.
I have localized that it has something to do with the concatenate, so I post the original code (the tables have more than 5Char sorry for that).
If I set DATA: l_table Type CHAR20
If I am setting the value for the l_table it works fine so in my opinion it has something to do with the concatenate but the result of the concatenate is also fine i checked it wit se11 the result is exactly the tablename.
The error is:
Laufzeitfehler DBIF_RSQL_INVALID_RSQL
Ausnahme CX_SY_OPEN_SQL_DB
DATA: l_period TYPE char40.
DATA: l_table TYPE CHAR20.
break-point.
Select ODSNAME from rstsods into l_table
where
USEROBJ = '6DB_K5'.
ENDSELECT.
concatenate l_table '000' into l_table." I need this because the value of the table has not the 0
SELECT k850_periode
FROM (l_table)
INTO l_period.
ENDSELECT.
‎2008 Apr 10 2:26 PM
Hi Henning,
the "short" dump should give you more information somewhere about the actual problem: does the table you are accessing dynamically not exist, or does the column k850_periode not exist in that table, or could it be that k850_periode and l_period are defined differently?
Greetings
Thomas
‎2008 Apr 17 8:12 PM
Hello,
I found my mistake the table name was not right. What a stupid mistake
But thanks again to all it was very helpfull
Henning