如何在ALV里限制显示出部分字段目录 20
比如有个数据库有10个字段(列)将数据都显示在一个ALV中如何限制只显示出前5个字段(列)又可以在更改格式里添加或移除已显示列DATAwa_bkpfTYPETABLEOF...
比如有个数据库有10个字段(列)
将数据都显示在一个ALV中
如何限制只显示出前5个字段(列)
又可以在更改格式里添加或移除已显示列
DATA wa_bkpf TYPE TABLE OF bkpf.
SELECT * FROM bkpf INTO TABLE wa_bkpf WHERE BUKRS = 'A100'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'BKPF'
TABLES
t_outtab = wa_bkpf. 展开
将数据都显示在一个ALV中
如何限制只显示出前5个字段(列)
又可以在更改格式里添加或移除已显示列
DATA wa_bkpf TYPE TABLE OF bkpf.
SELECT * FROM bkpf INTO TABLE wa_bkpf WHERE BUKRS = 'A100'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'BKPF'
TABLES
t_outtab = wa_bkpf. 展开
1个回答
展开全部
这是SAP的一个Bug,FM方式ALV Grid和Class ALV Grid都会出现,但是ALV List好像没有这个BUG。
在以下几个条件满足的时候就会出现这个问题:
1.字段对应的域Convers. routine = ALPHA,也就是有前导零的字段,比如供应商号、商品号、客户号等。
2.做ALV Fieldcat的时候,没有指定参考表和参考字段。
3.列的表头文本(seltext_s等)比实际显示的数据短。
所以解决问题的时候从2、3两点下手即可。
REPORT z_barry_field_loss .
TYPE-POOLS: slis.
DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.
DATA: sla TYPE slis_layout_alv ,
i_repid LIKE sy-repid ,
ls_fieldcat TYPE slis_fieldcat_alv.
DATA: BEGIN OF itab OCCURS 0,
lifnr LIKE lfa1-lifnr ,
kunnr LIKE kna1-kunnr ,
matnr LIKE mara-matnr ,
bukrs LIKE bsik-bukrs ,
END OF itab.
START-OF-SELECTION.
itab-lifnr = '0000100047'.
itab-kunnr = '0000001006'.
itab-bukrs = 'ZB01'.
itab-matnr = '000000000001100198'.
APPEND itab.
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-seltext_s = 'LI'.
ls_fieldcat-ref_fieldname = 'LIFNR'. "|注释
ls_fieldcat-ref_tabname = 'LFA1'. "|
ls_fieldcat-ddictxt = 'S'.
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-seltext_s = 'KU'.
ls_fieldcat-ref_fieldname = 'KUNNR'. "|注释
ls_fieldcat-ref_tabname = 'KNA1'. "|
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'BUKRS'.
ls_fieldcat-seltext_s = 'BU'.
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_s = 'MAT'.
ls_fieldcat-ref_fieldname = 'MATNR'. "|注释
ls_fieldcat-ref_tabname = 'MAKT'. "|
APPEND ls_fieldcat TO gd_fieldcat .
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = gd_fieldcat[]
i_save = 'A'
is_layout = sla
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
在以下几个条件满足的时候就会出现这个问题:
1.字段对应的域Convers. routine = ALPHA,也就是有前导零的字段,比如供应商号、商品号、客户号等。
2.做ALV Fieldcat的时候,没有指定参考表和参考字段。
3.列的表头文本(seltext_s等)比实际显示的数据短。
所以解决问题的时候从2、3两点下手即可。
REPORT z_barry_field_loss .
TYPE-POOLS: slis.
DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.
DATA: sla TYPE slis_layout_alv ,
i_repid LIKE sy-repid ,
ls_fieldcat TYPE slis_fieldcat_alv.
DATA: BEGIN OF itab OCCURS 0,
lifnr LIKE lfa1-lifnr ,
kunnr LIKE kna1-kunnr ,
matnr LIKE mara-matnr ,
bukrs LIKE bsik-bukrs ,
END OF itab.
START-OF-SELECTION.
itab-lifnr = '0000100047'.
itab-kunnr = '0000001006'.
itab-bukrs = 'ZB01'.
itab-matnr = '000000000001100198'.
APPEND itab.
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-seltext_s = 'LI'.
ls_fieldcat-ref_fieldname = 'LIFNR'. "|注释
ls_fieldcat-ref_tabname = 'LFA1'. "|
ls_fieldcat-ddictxt = 'S'.
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-seltext_s = 'KU'.
ls_fieldcat-ref_fieldname = 'KUNNR'. "|注释
ls_fieldcat-ref_tabname = 'KNA1'. "|
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'BUKRS'.
ls_fieldcat-seltext_s = 'BU'.
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_s = 'MAT'.
ls_fieldcat-ref_fieldname = 'MATNR'. "|注释
ls_fieldcat-ref_tabname = 'MAKT'. "|
APPEND ls_fieldcat TO gd_fieldcat .
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = gd_fieldcat[]
i_save = 'A'
is_layout = sla
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
大雅新科技有限公司
2024-11-19 广告
2024-11-19 广告
这方面更多更全面的信息其实可以找下大雅新。深圳市大雅新科技有限公司从事KVM延长器,DVI延长器,USB延长器,键盘鼠标延长器,双绞线视频传输器,VGA视频双绞线传输器,VGA延长器,VGA视频延长器,DVI KVM 切换器等,优质供应商,...
点击进入详情页
本回答由大雅新科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询