Dynamic WHERE clause IN LOOP AT statement
11,972
You're getting error because of incompatibility of your SAP. Dynamic where condition in the loop is add 7.0 EhP2 version. You should higher than 7.0 Ehp2 then only you can write dynamic where condition.
I Hope this answer will helpful to you.
Author by
shmoolki
Updated on June 16, 2022Comments
-
shmoolki almost 2 years
I have to do a loop on my internal table according to a where condition but according to the mode of my program the field of a where condition has to be modified at runtime.
I know that in a SELECT statement it is possible but when I do that 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 error is :
Statement concluding with "...(LV_CONDI)" ended unexpectedly.