‎2006 Sep 26 4:16 PM
I wonder, if anybody can answer, why this code cann't be compiled:
SELECT DISTINCT (ls_dynqr-fields)
INTO TABLE lt_doclist
FROM (ls_dynqr-tablename) AS a
INNER JOIN /abat/mcrm_mycus AS b
ON akunnr = bkunnrx AND
b~bname = sy-uname
UP TO lv_pmax ROWS
WHERE (ls_where-where_tab).
Tablename, list of fields and where-clauses are specified at runtime. Without JOIN it works fine, but with it it can not be compiled because of incorrect FROM condition, I meen unexpected 'JOIN' after 'FROM'.
‎2006 Sep 26 4:25 PM
‎2006 Sep 26 4:25 PM
‎2006 Sep 26 4:26 PM
Joins are not possible in dynamic SELECT statements as it cannot validate the same during you compilation.
‎2006 Nov 29 4:21 AM
HI Aleksandr,
I am trying to use Table in from clause dynamically. But unable.
Can you please let me know what ls_dynqr-tablename is declared as?
Thanks
Shashi
‎2006 Nov 29 4:38 AM
Hi,
The problem is in JOIN ON, you have given b~bname = sy-uname, this should have been given in the WHERE clause not in the JOIN ON remove it from JOIN ON and put it in Where clause.
Regards,
Sesh