Does someone see what is wrong in my dynamic SQL statement is reuslts in a dump!
DUMP and CODE below!
Runtime error SAPSQL_WHERE_MISSING_VALUE
Except. CX_SY_DYNAMIC_OSQL_SYNTAX
Datum en tijd 19.02.2009 13:30:13
Korte tekst
A comparison value is missing in a condition specified dynamically.
Wat is er gebeurd?
Error in the ABAP Application Program
The current ABAP program "!PR_RVVEEN_USED_FIELDS" had to be terminated because
it has
come across a statement that unfortunately cannot be executed.
Foutenanalyse
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SYNTAX', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
The current ABAP program has tried to execute an Open SQL statement
in which a condition was (partially) specified dynamically. In the
part specified at runtime, the program expects to find a literal as
the comparison value.
===============================================
itable = 'pa0001'
CALL FUNCTION 'DD_NAMETAB_TO_DDFIELDS'
EXPORTING
tabname = iname
TABLES
ddfields = ddfields.
LOOP AT ddfields.
data: where_tab(30) occurs 1 with header line,
where_clause(30) type c.
concatenate ddfields-fieldname '<> " "' into where_clause SEPARATED BY space.
append where_clause to where_tab.
select pernr from (itable) into table lt_pernr where (where_tab).
if sy-subrc = 0.
write 'FIELD COTAINS A VALUE'.
endif.
ENDLOOP.