Hi Siong,
Can you mention what lv_psloc contains?
Also you can write it as below:
SELECT LGORT
FROM T001L
INTO TABLE IT_LGORT
WHERE WERKS = P_WERKS.
IF SY-SUBRC EQ 0.
SORT IT_LGORT BY LGORT.
DELETE IT_LGORT WHERE LGORT NP '*LV_PSLOC*'.
ENDIF.
I think in ranges only EQ and BT works but not anything other than this. Also WERKS can contain many LGORT of pattern '*lv_psloc*' right? Why do you want to get it into a variable?
Hope this helps.