Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic WHERE clause IN LOOP AT statement

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.
like image 599
shmoolki Avatar asked Sep 16 '25 21:09

shmoolki


1 Answers

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.

like image 177
Anil Talla Avatar answered Sep 19 '25 19:09

Anil Talla