Bismillah.
Hello Friends,
Eventually, when we ran the SAP program, whether it was a custom program or a standard program, we just bumped into a short dump . In ABAP, we can handle this short dump with some code. Here we go!
Example
If we execute a program like this
DATA:
lv_val_1 TYPE i,
lv_val_2 TYPE i,
lv_result TYPE i.
lv_val_1 = 10.
lv_val_2 = 0.
lv_result = lv_val_1 / lv_val_2.
Then we must bump into short dump like below

We can see the short dump occurred raised by exception CX_SY_ZERODIVIDE
We can catch the exception in the program like below so the program will not throw the short dump.
DATA:
lv_val_1 TYPE i,
lv_val_2 TYPE i,
lv_result TYPE i.
lv_val_1 = 10.
lv_val_2 = 0.
TRY.
lv_result = lv_val_1 / lv_val_2.
CATCH cx_sy_zerodivide.
ENDTRY.
Next, try to get the messages
DATA:
lv_val_1 TYPE i,
lv_val_2 TYPE i,
lv_result TYPE i.
lv_val_1 = 10.
lv_val_2 = 0.
TRY.
lv_result = lv_val_1 / lv_val_2.
CATCH cx_sy_zerodivide INTO DATA(lx_zerodiv).
WRITE:/ lx_zerodiv->get_text( ). " retrieve short text
WRITE:/ lx_zerodiv->get_longtext( ). " retrieve long text
ENDTRY.
This method can be applied to other exceptions too.
That’s all.
Thank you for reading this post. If there is any feedback just put it in the comment.
I hope you can do better. See you in another post 🙂