ZCX_SD_EXCEPTION классы

Куллану мисалы:

    if go_quitt->mv_vlgpla <> go_quitt->mv_vlpla.
 
      try.
          raise exception type zcx_sd_exception message e000(zsd) with 'Склад урыны' go_quitt->mv_vlgpla 'сканер аша керткәне белән туры килми!'.
        catch zcx_sd_exception into go_exception.
          go_quitt->show_exception( io_exception   = go_exception
                                    iv_next_screen = sy-dynnr
                                    iv_type = 'E'                 ).
      endtry.
form show_exception using io_exception type ref to zcx_sd_exception
                          iv_next_screen type sydynnr
                          iv_type type symsgty.
  if iv_type is initial.
    sy-msgty = 'E'.
  else.
    sy-msgty = iv_type.
  endif.
 
  sy-msgid = io_exception->get_msgid( ).
  sy-msgno = io_exception->get_msgno( ).
  sy-msgv1 = io_exception->get_msgv1( ).
  sy-msgv2 = io_exception->get_msgv2( ).
  sy-msgv3 = io_exception->get_msgv3( ).
  sy-msgv4 = io_exception->get_msgv4( ).
  Z_ITS_MDE->show_message( iv_next_screen  ).
endform.
class ZCX_SD_EXCEPTION definition
  public
  inheriting from CX_STATIC_CHECK
  create public .
 
public section.
 
  interfaces IF_T100_DYN_MSG .                                                      
  interfaces IF_T100_MESSAGE .
 
  methods CONSTRUCTOR
    importing
      !TEXTID like TEXTID optional
      !PREVIOUS like PREVIOUS optional
      !IT_OTHER_MSG type BAPIRET2_T optional .
  methods DISPLAY_MSG
    importing
      !IV_TYPE type SYST_MSGTY default 'E'
      !IV_LIKE type SYST_MSGTY default 'E' .
  methods DISPLAY_MSG_LIKE_I .                                                        
  methods GET_MSGTY
    returning                                                                         
      value(R_RET) type SYST_MSGTY .
  methods GET_MSGID
    returning                                                                         
      value(R_RET) type SYST_MSGID .
  methods GET_MSGNO
    returning                                                                         
      value(R_RET) type SYST_MSGNO .
  methods GET_MSGV1
    returning                                                                         
      value(R_RET) type SYST_MSGV .
  methods GET_MSGV2
    returning                                                                         
      value(R_RET) type SYST_MSGV .
  methods GET_MSGV3
    returning                                                                         
      value(R_RET) type SYST_MSGV .
  methods GET_MSGV4
    returning                                                                         
      value(R_RET) type SYST_MSGV .
  methods RERAISE
    raising
      ZCX_SD_EXCEPTION .
  methods GET_OTHER_MSGS
    returning
      value(R_RESULT) type BAPIRET2_T .
protected section.
  private section.
    data t_other_msg type bapiret2_t.
 
ENDCLASS.
 
 
CLASS ZCX_SD_EXCEPTION IMPLEMENTATION.
 
  method constructor ##ADT_SUPPRESS_GENERATION.
    call method super->constructor
      exporting
        textid   = textid
        previous = previous.
 
    t_other_msg = it_other_msg.
  endmethod.
 
 
  method display_msg.
    data(lv_like) = iv_like.
    if lv_like is initial.
      lv_like = get_msgty( ).
    endif.
 
    data(lv_msgty) = iv_type.
    if lv_msgty is initial.
      lv_msgty = get_msgty( ).
    endif.
 
    data(lv_msgid) = get_msgid( ).
    data(lv_msgno) = get_msgno( ).
    data(lv_msgv1) = get_msgv1( ).
    data(lv_msgv2) = get_msgv2( ).
    data(lv_msgv3) = get_msgv3( ).
    data(lv_msgv4) = get_msgv4( ).
 
    if not lv_msgid is initial and not lv_msgty is initial.
      message id lv_msgid
            type lv_msgty
           number lv_msgno
             with lv_msgv1 lv_msgv2 lv_msgv3 lv_msgv4
          display like lv_like.
    endif.
  endmethod.
 
 
  method display_msg_like_i.
    me->display_msg(
        iv_type = 'I'
        iv_like = get_msgty( )
    ).
  endmethod.
 
 
  method get_msgid.
    r_ret = cond #( when if_t100_message~t100key-msgid is not initial then if_t100_message~t100key-msgid else 'ZSD' ).
  endmethod.
 
 
  method get_msgno.
    r_ret = cond #( when if_t100_message~t100key-msgno is not initial or if_t100_message~t100key-msgid is not initial
                    then if_t100_message~t100key-msgno
                    else '556' ). "Хата җибәрү
  endmethod.
 
 
  method get_msgty.
    r_ret = cond #( when if_t100_dyn_msg~msgty is not initial then if_t100_dyn_msg~msgty else 'E' ).
  endmethod.
 
 
  method get_msgv1.
    r_ret = if_t100_dyn_msg~msgv1.
  endmethod.
 
 
  method get_msgv2.
    r_ret = if_t100_dyn_msg~msgv2.
  endmethod.
 
 
  method get_msgv3.
    r_ret = if_t100_dyn_msg~msgv3.
  endmethod.
 
 
  method get_msgv4.
    r_ret = if_t100_dyn_msg~msgv4.
  endmethod.
 
 
  method get_other_msgs.
    r_result = me->t_other_msg.
  endmethod.
 
 
  method reraise.
    data(lv_msgid) = me->get_msgid( ).
    data(lv_msgty) = me->get_msgty( ).
    data(lv_msgno) = me->get_msgno( ).
    data(lv_msgv1) = me->get_msgv1( ).
    data(lv_msgv2) = me->get_msgv2( ).
    data(lv_msgv3) = me->get_msgv3( ).
    data(lv_msgv4) = me->get_msgv4( ).
 
    raise exception type zcx_sd_exception
      message id lv_msgid
      type lv_msgty
      number lv_msgno
      with lv_msgv1 lv_msgv2 lv_msgv3 lv_msgv4.
  endmethod.
ENDCLASS.

Добавить комментарий



All fields are required. Your email address will not be published.

Вставить формулу как
Блок
Строка
Дополнительные настройки
Цвет формулы
Цвет текста
#333333
Используйте LaTeX для набора формулы
Предпросмотр
\({}\)
Формула не набрана
Вставить