Hi, if any function gets red error when you call the module, it will kick it from the program, as follows:
To prevent this, in the exception section of the function module
Add ERROR_MESSAGE = 999,
When it gets an error, the value you gave subrc will return, the program will continue to run.
You can also read the error message from variables starting with sy-msg,
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4 INTO lv_error.