How to use the text getter - SchwarzIT/sap-usi-exception GitHub Wiki

The text getter /USI/CL_EXCEPTION_TEXT_GETTER is compatible with CX_ROOT and can extract the text of every exception - no matter, if it is a T100-based or an OTR-based exception.

Just create an instance of the class and use the instance methods to get the texts in the desired format.

FUNCTION do_something.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_USER_NAME) TYPE  XUBNAME
*"  EXPORTING
*"     VALUE(E_RETURN)  TYPE BAPIRETTAB
*"----------------------------------------------------------------------
  TRY.
      DATA(user) = zcl_user=>get( i_user_name ).
      " [...]
 
    CATCH zcx_root INTO DATA(exception).
      e_return = NEW /usi/cl_exception_text_getter( exception )->get_texts_as_bapiret2( ).
 
  ENDTRY.
ENDFUNCTION.

The get_texts*-methods will return an internal table containing the text of the passed exception and its previous exceptions.

The get_text*-methods will return the text of the passed exception. Previous exceptions will be ignored. The result type will be the line type of the corresponding get_texts*-method.