cancel
Showing results for 
Search instead for 
Did you mean: 

Can't send message in CL_RSPLS_CR_EXIT_BASE, Derive

ClausEriksen
Explorer
0 Kudos

Hello All,

I use a Characteristic Relationship with derivation, type Exit. I have copied CL_RSPLS_CR_EXIT_BASE and use method DERIVE. I the case that the derivation fails, I would like to send an error message to the user, and abort the save. It this at all possible?

It appears to be possible to return a message in table E_T_MESG, but no matter which Message Type I return, I get a dump in the front-end with message: BRAIN, 240, Critical error during characteristic derivation. I have tried message types: E, W, and I.


This is how I prepare the message in the invalid case:

      l_s_mesg-msgid = 'ZBW'.
      l_s_mesg-msgty = 'I'.
      l_s_mesg-msgno = '000'.
      l_s_mesg-msgv1 = 'Error deriving time characteristics.'.


And then I use the example code to append the message to E_T_MESG and raise exception cx_rspls_failed:


IF o_use_buffer = rs_c_true.
     o_r_is_valid->* = l_is_valid.
     IF o_r_is_valid->* = rs_c_true.
       INSERT <l_s_buf> INTO TABLE <l_th_buf>.
       c_s_chas = <l_s_buf>.
     ELSE.
       IF e_t_mesg IS SUPPLIED.
         o_r_s_mesg->* = l_s_mesg.
         APPEND l_s_mesg TO e_t_mesg.
       ENDIF.
       INSERT <l_s_buf> INTO TABLE <l_th_buf>.
       RAISE EXCEPTION TYPE cx_rspls_failed
         EXPORTING
           msgid = l_s_mesg-msgid
           msgty = l_s_mesg-msgty
           msgno = l_s_mesg-msgno
           msgv1 = l_s_mesg-msgv1
           msgv2 = l_s_mesg-msgv2
           msgv3 = l_s_mesg-msgv3
           msgv4 = l_s_mesg-msgv4.
     ENDIF.
   ENDIF.


Thanks,

Claus

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Is the code working without message handling ? if yes, try to use MESSAGE as the SAP code

(class CL_RSPLS_CR_MASTER_DATA_NATTR)

MESSAGE ID 'RSPLS_CR' TYPE 'E' NUMBER '010'
               WITH l_s_mesg-msgv1 n_chanm
               INTO p_dummy.
       l_s_mesg = move_sy_to_mesg( ).
       APPEND l_s_mesg TO e_t_mesg.

hope it helps