当前位置:编程学习 > 网站相关 >>

ALV 列宽固定自定义长度 和 自适应宽度

FORM alvdata.
  " GV_TITLE  = '领料单'.
  "gs_layout-colwidth_optimize  =  'X'.  如果这里不注释,这表示自适应宽度。如果注释后gs_fields-outputlen = 10.就不起作用了。gs_fields-outputlen = 10.表示为自定义列宽为10的长度。
  gs_layout-box_fieldname  =  'CHE'.      "确定选择列
  gs_layout-zebra  =  'X'.                 "各行显示不同的颜色
  REFRESH  gt_fields.
  CLEAR    gs_fields.
 
  gs_fields-fieldname  =  'SYEAR'.
  gs_fields-seltext_l  =  '年'.
  gs_fields-edit = 'X'.
  gs_fields-outputlen = 10.
  APPEND  gs_fields  TO  gt_fields.
  CLEAR  gs_fields.
 
  gs_fields-fieldname  =  'SMONTH'.
  gs_fields-seltext_l  =  '月'.
  gs_fields-edit = 'X'.
  gs_fields-outputlen = 10.
  APPEND  gs_fields  TO  gt_fields.
  CLEAR  gs_fields.
 
 
  gs_fields-fieldname  =  'TYPES'.
  gs_fields-seltext_l  =  '类型'.
  gs_fields-outputlen = 20.
  APPEND  gs_fields  TO  gt_fields.
  CLEAR  gs_fields.
 
  gs_fields-fieldname  =  'SWEEK'.
  gs_fields-seltext_l  =  '周'.
  gs_fields-edit = 'X'.
  gs_fields-outputlen = 10.
  APPEND  gs_fields  TO  gt_fields.
  CLEAR  gs_fields.
 
  gs_fields-fieldname  =  'NRMS'.
  gs_fields-seltext_l  =  '内容描述'.
  gs_fields-edit = 'X'.
  gs_fields-outputlen = 100.
  "GS_FIELDS-DECIMALS = 0.
  APPEND  gs_fields  TO  gt_fields.
  CLEAR  gs_fields.
 
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTINGwww.zzzyk.com
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'SET_PF'
      i_callback_user_command  = 'USER_COM'
      i_grid_title             = gv_title  " IT_EVENTS = I_EVENTS
      is_layout                = gs_layout
      it_fieldcat              = gt_fields
      i_save                   = 'X'
    TABLES
      t_outtab                 = gt_mm03[]
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
 
 
ENDFORM.                    "ALVDATA
补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,