Skip to Content
2
May 25, 2010 at 08:14 AM

Method call and exceptions

8568 Views

Hi All,

In ABAP you can call a method in a short way. However how do I catch the exceptions if the exception is not an exception class.

For instance:

l_case = cl_scmg_case_api=>open_case( im_case_guid = me->caseguid im_enqueue = 'X' ).

The exceptions are "catchable" if you call the method in the "long" way.

 call method cl_scmg_case_api=>open_case
    exporting
      im_case_guid          = lv_guid
*      im_enqueue            = SPACE
*      im_mode               = IF_SRM_SP_ENQUEUE=>MODE_EXCLUSIVE
*      im_scope              = IF_SRM_SP_ENQUEUE=>SCOPE_DIALOG
*      im_update_task        = IF_SRM=>FALSE
*      im_check_authority    = SPACE
*      im_close_after_commit = SPACE
    receiving
      re_case               =
    exceptions
      failed                = 1
      enqueue_failed        = 2
      invalid_guid          = 3
      cx_srm_gsp_back       = 4
      no_authority          = 5
      illegal_case_type     = 6
      others                = 7
          .
  if sy-subrc <> 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

Regards,

Bert