• ALV界面tips


    1.

    FORM disp_alv .
     DATA l_repid LIKE sy-repid VALUE sy-repid.
     DATA: l_grid_settings TYPE lvc_s_glay  .

      PERFORM frm_set_fieldcats.
      gw_layout-zebra      'X'.
      gw_layout-sel_mode   'X'.


    *  gw_layout-cwidth_opt = 'X'.
    *  gw_layout-box_fname = 'SEL'.
    *
    *
    *  lw_event-name = 'CALLER_EXIT'.
    *  lw_event-form = 'SET_LIST' ##CALLED .
    *  append lw_event to lt_event.


      l_grid_settings-edt_cll_cb 'X'  .

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'  ##FM_SUBRC_OK
        EXPORTING
          i_callback_program       = l_repid
          i_callback_pf_status_set 'ALV_PF_STATUS'     "这个ALV_PF_STATUS 对应的是form的名字,设置alv状态的
          ##CALLED
          i_callback_user_command  'ALV_USER_COMMAND'  "这个ALV_USER_command 对应的也是form的名字
           i_grid_settings          = l_grid_settings
          is_layout_lvc   = gw_layout
          it_fieldcat_lvc = gt_field
          i_save          'X'
          "i_default       = 'X'
        TABLES
          t_outtab        = gt_alv

          EXCEPTIONS

          program_error            1
          OTHERS                   2.


          IF sy-subrc <> .

            ENDIF.




    ENDFORM.

    2. 界面编辑文本没法自动更新时,

      a. 可以点击enter,ALV function 会自动刷新

      b. 在 i_callback_user_command 的方法里加入以下语句

       

      DATA: l_grid TYPE REF TO cl_gui_alv_grid.

      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = l_grid.


      CALL METHOD l_grid->check_changed_data.

     这样会将界面编辑后的字段自动更新掉

  • 相关阅读:
    SVN安装
    MS SQL Server 查询元数据
    MS SQL Server 时间函数
    Codeforces 666E Forensic Examination (后缀自动机 + 线段树合并)
    2020牛客暑期多校训练营(第八场) H Hard String Problem
    2020牛客暑期多校训练营(第四场) B Count New String
    2020牛客暑期多校训练营(第四场) A Ancient Distance
    2020杭电多校第三场 1007 Tokitsukaze and Rescue
    codeforces 1037H
    2020牛客暑期多校训练营(第三场) H Sort the Strings Revision
  • 原文地址:https://www.cnblogs.com/QIANQIANHAPPY/p/11058254.html
Copyright © 2020-2023  润新知