Recently, I came across an interesting question. I am not sure if it has been posted here before, or how common knowledge it is, but needless to say, I found it very amusing and was, frankly, stumped by it.
The question is a purely hypothetical one, without any practical significance, so, just take it as a fun exercise.
The question goes like this:
Say, you are writing an ABAP report. The first line is always fixed.
The next line of this report, whether declaration or executable line, should throw an ABAP runtime error (dump). You are not allowed to do some data declarations first and then cause it to dump. For example, consider below report:
REPORT <zporgram> FIELD-SYMBOLS: <fs_temp> TYPE any. <fs_temp> = 'X'.
While the above may throw an ABAP runtime error, the second line of the program has already been used up to define the field symbol. So, this solution is not acceptable.
After much thought I was finally able to come up with a couple of solutions!
Here are a few of them.
REPORT <zprogram>. MESSAGE 'Dump' TYPE 'X'.
REPORT <zprogram>. RAISE EXCEPTION.
REPORT <zprogram>. DATA(lv_var) = 1 / 0.
Let me know in the comments if there are better answers!