‎2009 Jul 10 12:16 PM
Hi,
i create exception class like it write in the sap help and when i want to send the exception with parameters to the ABOVE METHODS i don't susses i just get the message without the parameter ?
there is simple guideline how o transfer the exception with parameters?
br
Ricardo
‎2009 Jul 10 1:42 PM
Hello Ricardo
When you trigger the exception you need to feed the EXPORTING parameters with the values:
report DEMO_RAISE_EXCEPTIONS.
data OREF type ref to CX_ROOT.
data TEXT type STRING.
try.
try.
raise exception type CX_DEMO_CONSTRUCTOR
exporting MY_TEXT = SY-REPID. " <<<
catch CX_DEMO_CONSTRUCTOR into OREF.
TEXT = OREF->GET_TEXT( ).
write / TEXT.
raise exception OREF.
endtry.
catch CX_DEMO_CONSTRUCTOR into OREF.
TEXT = OREF->GET_TEXT( ).
write / TEXT.
endtry.
Regards
Uwe
‎2009 Jul 11 6:52 PM
HI Uwe,
Thanks,
This is my sample code:
This is the first method on the tree:
the method name is create .
....
INSERT (lt_table_name) FROM <ls_obj>.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE /cx_db_db_error
EXPORTING
textid = cx_db_error=>create_failed
table_name = lt_table_name.
ENDIF.this method call to the above method - create .
...
TRY.
CALL METHOD lo_obj_create->create
CHANGING
is_bound_object = ls_obj_user.
CATCH cx_db_error INTO lo_exc.
"Create user failed. Throw an exception.
RAISE EXCEPTION TYPE cx_db_error
EXPORTING
textid = cx_db_error=>create_user_error
previous = lo_exc.
result = lo_exc->get_text( ).
ENDTRY.here in result i just get the massage without the table name that i export in the first method ,what i miss here ?
Best Regards
Ricardo
‎2009 Jul 16 1:05 PM
(deleted - misread post)
Edited by: Pascal Schlecht on Jul 16, 2009 2:27 PM
‎2009 Jul 11 10:45 AM