on 04-02-2014 5:52 AM
Hi Group,
Can any body suggest how to raise exception in ABAP proxy with custom message and I want to fail message in SXMB_MONI .
-Rajiv
Hello Rajiv,
you define an exception type and raise this exception in the server proxy with the respective exception message. Find example coding here:
Reporting and Handling Errors - Enabling Application-to-Application Processes - SAP Library
Regards,
Jörg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jorg,
Thank you for you message, according to that link I need to define fault message type/Data type in ESR then only I can raise, without defining fault message type is there any way I can raise exception.
My simple condition is based on sy-subrc <>0 I need to raise exception and send message in to Error
Hello Rajiv,
you can raise an exception, but it will result in a red flag and (probably) won't display your fault message. Better do it as specified in the help page. Define the exception type and in your code make the sy-subrc check and raise the exception. This will result in a clean application fault and you'll see an error message. Better monitoring, clearer status and almost no additional effort.
Regards,
Jörg
Hi Rajiv
In addition to the code provided by Jorg's link above, you can also use the RAISE static method in class CL_PROXY_FAULT. This is useful if you already have error messages in the common BAPI return table.
cl_proxy_fault=>raise( exception_class_name = 'ZCL_YOUR_EXCEPTION_CLASS'
bapireturn_tab = t_bapiret2 ).
Do note that as mentioned by Jorg, you still need to define the fault message, which then causes your error to appear as an "Application Error" in the monitor. ZCL_YOUR_EXCEPTION_CLASS is subclass of CX_AI_APPLICATION_FAULT, and would be automatically generated from the fault message when you generate your proxy.
Rgds
Eng Swee
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.