Sc_exit() error

Hello, the macro sc_exit in a button of a form, called from a grid, does not return or does it wrong. Someone else happens?

sc_exit (ok);

is button code. when it is executed it shows as a menu inside the menu that I call the grid.
I did not test it in production as it does not work in development. Thank you