‎2009 May 18 11:35 AM
hi
i am calling a outbound proxy class from a inbound proxy class. when i dragged the ourbound proxy the below code is inserted by system directly.
TRY.
CALL METHOD oref1->SEND_OUT
EXPORTING
OUTPUT = output
.
CATCH CX_AI_SYSTEM_FAULT .
ENDTRY.
i want to know the difference between writing just
CATCH CX_AI_SYSTEM_FAULT .
and
CATCH CX_AI_SYSTEM_FAULT . into objref. where objref refers to exception class CX_AI_SYSTEM_FAULT .
how does the system behave in either of the case if exception is raised.
thanks
‎2009 May 18 12:40 PM
When you catch into an object reference, you get an instance of the exception which has attributes that you can access. Look at the exception class in SE24, and you'll see it has: CX_AI_SYSTEM_FAULT CODECONTEXT CODE ERRORTEXT LANGUAGE as attributes.
If you don't catch into an object, then you've simply not got this information.
E.g.
DATA: lx TYPE REF TO CX_AI_SYSTEM_FAULT.
TRY.
CALL METHOD oref1->SEND_OUT
EXPORTING
OUTPUT = output
CATCH CX_AI_SYSTEM_FAULT INTO lx
WRITE: / lx->ERRORTEXT .
ENDTRY.
matt
‎2009 May 18 12:39 PM
In both cases, no short dump is generated, because the exception is caught. However, no info about the actual error can directly be retrieved like is done in the following example.
DATA: lv_message TYPE string,
lr_error TYPE REF TO cx_sy_zerodivide,
y TYPE i VALUE 10,
x TYPE i.
TRY.
x = y / 0.
CATCH cx_sy_zerodivide INTO lr_error.
lv_message = lr_error->get_text( ).
ENDTRY.
But this will only be of interest, when you want to determine the error. If the catch is part of another TRY ENDTRY block, the error is navigated upwards the chain.
Hope this was somehow helpful.
‎2009 May 18 12:40 PM
When you catch into an object reference, you get an instance of the exception which has attributes that you can access. Look at the exception class in SE24, and you'll see it has: CX_AI_SYSTEM_FAULT CODECONTEXT CODE ERRORTEXT LANGUAGE as attributes.
If you don't catch into an object, then you've simply not got this information.
E.g.
DATA: lx TYPE REF TO CX_AI_SYSTEM_FAULT.
TRY.
CALL METHOD oref1->SEND_OUT
EXPORTING
OUTPUT = output
CATCH CX_AI_SYSTEM_FAULT INTO lx
WRITE: / lx->ERRORTEXT .
ENDTRY.
matt
‎2009 May 18 12:48 PM
‎2009 May 19 8:32 AM
I've been doing some PI work, so I've used this particular exception class quite a bit!
matt