EDIT 7/3/2022: Ever since PAW 62 this is only working for ADMIN users, apparently it was a bug before.

We can use this feature to display a custom error message directly in the PAW window using the ItemReject TI function, it will reject a source record and place it in the error log with a custom error message. The syntax is something like this:
Code: Select all
If (ErrorCondition=True);
ItemReject ('Error Msg');
EndIf;

Observations:
If you use ItemReject in the Prolog section, it will skip the rest of code under it and go straight to the epilog tab.
A good approach to this if you have code in your epilog tab is to use something like this:
Code: Select all
#PROLOG
If (ErrorCondition=True);
vError=1;
ProcessBreak;
EndIf;
#EPILOG
If (vError=1);
ItemReject ('Error Msg');
EndIf;
Code: Select all
#PROLOG
If (ErrorCondition=True);
vError=1;
ItemReject ('Error Msg');
EndIf;
#METADATA and #DATA
If (vError=1);
ProcessQuit;
EndIf;
Thanks!