Hi Sakthi,
As jeffin told it will work fine in the case of PBO, but if you want to write that in PAI the set cursor statement should be followe be a message of type 'E', ie error message.
EG; SET CUSRSOR FIELD '<FIELD>'.
MESSAGE 'ERROR' TYPE 'E'.
Regards,
Ashish Kumar