这是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.
阅读(8322) | 评论(8) | 转发(0) |