Hi ,
first call your data in an internal table, then please use the work area value to be matched.
Change your code as shownbelow, please do required modifications yourself.
SELECT
locno from zmpts_minmax_rul into table it_zmpts_minmax_rul.
LOOP AT it_zmpts_minmax_rul INTO wa_zmpts_minmax_rul.
if wa_zmpts_minmax_rul-locno = 'Z001'.
MESSAGE 'default row cannot be deleted, please change the values if necessary ' TYPE'E'.
CLEAR zmpts_minmax_rul.
ENDIF.
ENDLOOP.