ABAP dynamic WHERE clause In LOOP AT statement
I need to do a loop on my internal table according to the where clause, but according to the mode of my program, the where clause field must be changed at runtime.
I know it is possible in a SELECT statement, but when I do it in a loop, I have an error.
This is my code:
CASE gv_cdvue.
WHEN 'L'.
lv_condi = 'dcmdr GE gv_daybf OR dcmdr LE gv_daybf '.
WHEN 'C'.
lv_condi = 'dcldr GE gv_daybf OR dcldr LE gv_daybf '.
WHEN 'E'.
WHEN OTHERS.
ENDCASE.
LOOP AT gt_plcad INTO ls_plcad WHERE (lv_condi).
....
ENDLOOP.
My mistake:
Statement concluding with "...(LV_CONDI)" ended unexpectedly.
+3
source to share