2012 Dec 05 8:15 AM
Hi all.
I want to create an ST22 dump from an ABAP Exception Object.
Reason behind this is that I want to display a custom simplified error message to the user, but have sufficient details for the developer to do tracing.
Implementation Details:
Since our application is a portal application, I created a subclass for CL_WDR_MAIN_TASK, and reimplemented the method IF_HTTP_EXTENSION~HANDLE_REQUEST with the following code (snippet). The problem is that after catching the error, I still want to cause a dump in ST22 with the stack in the exception object.:
TRY.
super->if_http_extension~handle_request(
EXPORTING
server = server
).
CATCH cx_sy_message_in_plugin_mode INTO lr_exception.
"Whatever application error should be caught here
IF lr_exception->msgid = '14' AND
lr_exception->msgno = '060'. "User session (HTTP/SMTP/..) closed after timeout
"Populating Time Out error contents into lv_html_body
ELSE.
"Populating other error contents into lv_html_body
ENDIF.
server->response->set_header_field(
name = 'Content-Type'
value = 'text/html'
).
server->response->set_cdata( data = lv_html_body ).
"me->raise_to_st22( lr_exception ).
ENDTRY.
2012 Dec 06 7:56 AM
Hi all.
I want to create an ST22 dump from an ABAP Exception Object.
Reason behind this is that I want to display a custom simplified error message to the user, but have sufficient details for the developer to do tracing.
Implementation Details:
Since our application is a portal application, I created a subclass for CL_WDR_MAIN_TASK, and reimplemented the method IF_HTTP_EXTENSION~HANDLE_REQUEST with the following code (snippet). The problem is that after catching the error, I still want to cause a dump in ST22 with the stack in the exception object.:
TRY.
super->if_http_extension~handle_request(
EXPORTING
server = server
).
CATCH cx_sy_message_in_plugin_mode INTO lr_exception.
"Whatever application error should be caught here
IF lr_exception->msgid = '14' AND
lr_exception->msgno = '060'. "User session (HTTP/SMTP/..) closed after timeout
"Populating Time Out error contents into lv_html_body
ELSE.
"Populating other error contents into lv_html_body
ENDIF.
server->response->set_header_field(
name = 'Content-Type'
value = 'text/html'
).
server->response->set_cdata( data = lv_html_body ).
"me->raise_to_st22( lr_exception ).
ENDTRY.
2012 Dec 06 7:56 AM
2012 Dec 06 8:50 AM
Hi.
Thanks for the reply.
Yes, it will cause an ST22 log, however the stack trace in the log will point me to the source I triggered the MESSAGE statement, and not the stack information that I have within the exception object itself.
I am doing this as a workaround at the moment. Almost there
I have been looking into how SAP creates these dumps. But a where used on the tables seem to show that these tables are not updated at ABAP level.
2012 Dec 06 8:57 AM
Just a thought. Did you check what happens if you simply raise the exception within your CATCH block and do not catch it anywhere in the call stack. Would it not lead to a dump? If it does, you might have the call stack preserved in the exception object.
2012 Dec 06 8:37 AM
Hi,
I did not get the reason as of why you want to raise a dump. Anywas, if you really want a dump then you can try zero divide ( 1 / 0 ).
Regards,
Kartik
2012 Dec 06 9:08 AM
Hi,
What about using assert or log-point statements?
Using transaction SAAB, you can activate on request where you can specify user and server as parameters.
For assert, you can choose to log, to break, to create a shortdump or to be inactive.
For log-point, you can choose between log and inactive.
With both statements, you can use the FIELDS addition to include variables in the log or dump.
Have a look at the documentation.
Rgds,
Jeroen
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |