Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Exception :"CAST-ERROR" while calling custom BADI

Former Member
0 Kudos
167

hi experts...we are using SAP ECC 6.0 version

I have created BADI Def and Implementation using se18 and se19 with some interface methods..

Problem:

I'm writing a report to call that using class CL_EXITHANDLER but it shows an Exception..

" Exception condition "CAST-ERROR" raised."

Report example:


 DATA: CL_EXIT  TYPE REF TO CL_EXITHANDLER,
      IF_USER_INSTANCE TYPE REF TO ZIF_EX_USER_MAILID1.
 
CALL METHOD cl_exithandler=>get_instance
  EXPORTING
   EXIT_NAME                       = 'ZBADI_USERMAIL_DEF'
*    NULL_INSTANCE_ACCEPTED        = SEEX_FALSE
*  IMPORTING
*    ACT_IMP_EXISTING              =
  CHANGING
    instance                       = IF_USER_INSTANCE
*  EXCEPTIONS
*    NO_REFERENCE                  = 1
*    NO_INTERFACE_REFERENCE        = 2
*    NO_EXIT_INTERFACE             = 3
*    CLASS_NOT_IMPLEMENT_INTERFACE = 4
*    SINGLE_EXIT_MULTIPLY_ACTIVE   = 5
*    CAST_ERROR                    = 6
*    EXIT_NOT_EXISTING             = 7
*    DATA_INCONS_IN_EXIT_MANAGEM   = 8
*    others                        = 9
        .
IF sy-subrc  0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.


 

so i found that all EXITs are in the Table " SXS_ATTR"

but what i have created Classical BADI so it gets an Exception(while i'm debugging found this)

so kindly tel me whats problem of my custom BADI "ZBADI_USERMAIL_DEF" .

but in Implentation class its working fine..

2 REPLIES 2

Former Member
0 Kudos
58

Hi

Try to check the class generated for the BADI implementation, it should be based on the interface ZIF_EX_USER_MAILID1, generated for the BADI defination

Max

0 Kudos
58

Thanq Mr.MAX and Mr.Mahammad u have given alot co-operation keep it up...