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'.