ALV 可编辑修改内表值 可修改列定义F4搜索帮助

data i_grid_settings type lvc_s_glay.
i_grid_settings-edt_cll_cb = 'X'. "更改数据后更新表数据

call function 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
   i_grid_settings                   = i_grid_settings
*   IS_LAYOUT                         =
*   IT_FIELDCAT                       =
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
  tables
    t_outtab                          =
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
          .
if sy-subrc <> 0.
* Implement suitable error handling here
endif.

form user_command using ucomm  like sy-ucomm   selfield type slis_selfield.

  selfield-refresh = 'X'. "刷新
  selfield-col_stable = 'X'.
  selfield-row_stable = 'X'.
  if ucomm = 'ZEXCE'.      
    perform frm_update.   "可以写更新代码
  endif.
endform.                    "user_command

 

因为自己在写新数据时,但是根据上面定义好了,在这个列中要加入F4搜索帮助,但是在写入值后内表该字段的值在后台始终是空的,需要定义表字段slis_fieldcat_alv中定义

ref_tabname和ref_fieldname两字段值,但其取值应该取其检查表

  gs_fieldcat-ref_tabname = 'T001L'.  "而不是mard
  gs_fieldcat-ref_fieldname = 'LGORT'.

 

posted @ 2021-04-13 10:15  肆意点  阅读(443)  评论(0编辑  收藏  举报