How to Handle Application Exception in ABAP Proxy

Posted on Feb 12, 2012 at 4.31 PM - Kuala Lumpur, Malaysia

Please follow the step below to trigger application specific exception in ABAP proxy.

1. Create one generic fault message type in your interface. By default SAP already provides fault data type.

2. Specify generic fault message type in the inbound operation

3. Exception class will be generated once the inbound proxy is generated

4. In the inbound proxy class, you can use the generated class exception to trigger any application specific exception

CATCH cx_ai_system_fault INTO lr_exception.

ls_standard_data-fault_text = lr_exception->if_message~get_text( ).

ls_detail_data-severity = 'Error'.

ls_detail_data-text = lr_exception->errortext.

ls_detail_data-id = lr_exception->code.

APPEND ls_detail_data TO ls_standard_data-fault_detail.

RAISE EXCEPTION TYPE zintcx_generic_fault_message

EXPORTING

standard = ls_standard_data.

5. You can monitor the application specific exception from SXI_MONITOR.

6. A more meaningful information is also provided when you click on the message status icon.

Life is beautiful! Let's make it meaningful and colorful!