• 20170228 METHOD handle_data_changed-


    CALL METHOD er_data_changed->add_protocol_entry

     
     
    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 
  • 相关阅读:
    HTML中所用的标签(二)
    HTML中所用的标签(一)
    学习笔记之04表格嵌套练习1
    学习笔记之03百度搜索页面
    学习笔记之02简单的基础
    学习笔记之01程序员起航篇
    Part 53 to 55 Talking about Reflection in C#
    Part 48 to 51 Talking about Access Modifiers in C#
    Part 59 to 60 Difference between Convert ToString and ToString,String and StringBuilder
    Part 57 to 58 Why should you override ToString and Equal Method
  • 原文地址:https://www.cnblogs.com/rainysblog/p/6477714.html
Copyright © 2020-2023  润新知