zoukankan      html  css  js  c++  java
  • 20170228 ALV method中用E消息,会退出到初始界面;STOP 会dump;

    再回车就处理界面了,

    所以,Handel_data_change 做数据检查时,如果需要报错要用到,

    CALL METHOD er_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = 'Z_BH1'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = '你输入的起始日期大于结束日期!'
                  i_msgv2     = ''
                  i_msgv3     = ''
                  i_fieldname = ls_modi-fieldname
                  i_row_id    = ls_modi-row_id.

    可参考

    *&监听修改
          HANDLE_DATA_CHANGED
            FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
                IMPORTING ER_DATA_CHANGED.
    
    *&方法实施:
    METHOD handle_data_changed.
    
        DATA: ls_modi TYPE lvc_s_modi.
        DATA: lv_valid TYPE c.
    
        DATA: lt_lvc_t_modi TYPE lvc_t_modi .
        DATA: ls_lvc_t_modi TYPE lvc_s_modi ,
              l_matnr       TYPE matnr,
              l_datum       TYPE datum,
              l_datab       TYPE datum,
              lv_flag(1).
    *    CLEAR:LV_FLAG,L_DMBTR,L_CTCOD.
        LOOP AT er_data_changed->mt_good_cells INTO ls_modi.
          IF ls_modi-fieldname = 'MATNR'.
    *****************获取CELL值
            CALL METHOD er_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_modi-row_id
                i_fieldname = ls_modi-fieldname
              IMPORTING
                e_value     = l_matnr.
            IF NOT l_matnr IS INITIAL.
              SELECT SINGLE matnr  INTO l_matnr FROM mara
                              WHERE matnr = l_matnr.
              IF sy-subrc = 0.
                SELECT SINGLE maktx INTO wa_out-maktx FROM makt
                                   WHERE matnr = l_matnr
                                     AND spras = sy-langu.
                MODIFY gt_out FROM wa_out INDEX ls_modi-row_id TRANSPORTING maktx.
                CLEAR: ls_lvc_t_modi,lt_lvc_t_modi[].
                ls_lvc_t_modi-row_id = ls_modi-row_id.  "自然数
                ls_lvc_t_modi-fieldname = 'MAKTX'.   "内部表字段的字段名称
                ls_lvc_t_modi-value = wa_out-maktx."  单元格内容
                ls_lvc_t_modi-tabix  = ls_modi-row_id."自然数
                APPEND ls_lvc_t_modi TO lt_lvc_t_modi.
                CLEAR ls_lvc_t_modi.
                CALL METHOD g_grid->set_delta_cells
                  EXPORTING
                    it_delta_cells = lt_lvc_t_modi[].
              ELSE.
                lv_flag = 'X'.
    *            CALL METHOD ER_DATA_CHANGED->ADD_PROTOCOL_ENTRY
    *              EXPORTING
    *                I_MSGID     = 'Z_BH1'
    *                I_MSGNO     = '000'
    *                I_MSGTY     = 'E'
    *                I_MSGV1     = '你输入的商品不存在!'
    *                I_MSGV2     = ''
    *                I_MSGV3     = ''
    *                I_FIELDNAME = LS_MODI-FIELDNAME
    *                I_ROW_ID    = LS_MODI-ROW_ID.
    
              ENDIF.
            ENDIF.
          ENDIF.
    
          IF ls_modi-fieldname = 'DATBI'.
            CALL METHOD er_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_modi-row_id
                i_fieldname = ls_modi-fieldname
              IMPORTING
                e_value     = l_datum.
    
            READ TABLE gt_out INTO wa_out INDEX ls_modi-row_id.
            l_datab  = wa_out-datab.
    
            IF l_datum < l_datab.
              lv_flag = 'X'.
              CALL METHOD er_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = 'Z_BH1'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = '你输入的起始日期大于结束日期!'
                  i_msgv2     = ''
                  i_msgv3     = ''
                  i_fieldname = ls_modi-fieldname
                  i_row_id    = ls_modi-row_id.
            ENDIF.
    
          ENDIF.
    
        ENDLOOP.
    
    ****************显示错误消息
    *    IF LV_FLAG = 'X'.
    *      CALL METHOD ER_DATA_CHANGED->DISPLAY_PROTOCOL.
    *    ENDIF.
    
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
  • 相关阅读:
    如何保证最少消费一次redis的list队列数据
    如果设置Redis客户端的超时时长?
    REdis一致性方案探讨
    Linux后台开发工具箱-葵花宝典
    REdis主从复制之repl_backlog
    C++之Lambda研究
    Redis-5.0.5集群配置
    REdis之maxmemory解读
    [转载]centos6.3安装启动使用PostgreSQL 9.2
    [转载]linux环境变量设置方法总结(PATH/LD_LIBRARY_PATH)
  • 原文地址:https://www.cnblogs.com/rainysblog/p/6478289.html
Copyright © 2011-2022 走看看