I’d like to share some knowledge I recently stumbled upon while creating a transformation and having to debug it, since it did not work as expected.
Since I did not see any hints to this on the SCN or in the help, I think I’d share this:
When I use custom routines in transformation, I like to include proper exception handling and making monitor entries, since you can never be sure, what kind of data is being input by the users and you don’t want to waste too much time searching for the document that actually caused the error.
The help specifies the exceptions, that can be used like this:
Exception handling by means of exception classes is used to control what is written to the target:
- CX_RSROUT_SKIP_RECORD: If a raise exception typecx_rsrout_skip_recordis triggered in the routine, the system stops processing the current row and continues with the next data record.
- CX_RSROUT_SKIP_VAL: If an exceptiontype cx_rsrout_skip_valis triggered in the routine, the target field is deleted.
- CX_RSROUT_ABORT: If a raise exception type cx rsrout_abortis triggered in the routine, the system terminates the entire load process. The request is highlighted in the extraction monitor as having been Terminated. The system stops processing the current data package. This can be useful with serious errors.
What the help does not say is that there is one obstacle if you try to use it not with a key figure, but with a characteristic:
The thought behind seems to be that, if it is not a valid record (i.e. you raise the exception in a characteristic), the whole record is skipped.
So instead of a “clear”, that happens when you raise the exception with a key figure (example):
You get a raise exception type cx_rsrout_skip_record:
If you search for it, you can find it easily in the generated program though.
Hope it helps with the proper usage of the routines and the exceptions.