CONVERSION_EXIT_ALPHA_INPUT
如果你是一个参照系统预定义类型来定义的字符型变量,就应调用DOMAIN里设置的内外部转换函数来补前导零,以物料号来举例:
DATA
W_MATNR_INT
TYPE
MARA-MATNR.
DATA
W_MATNR_OUT
TYPE
CHAR18.
MATNR的domain是MATNR,Convers.
Routine是MATN1,补前导零的话就要调用函数
CALL
FUNCTION
'CONVERSION_EXIT_MATN1_INPUT'
EXPORT
INPUT
=
W_MATNR_INT
IMPORT
OUTPUT
=
W_MATNR_OUTPUT.
这是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.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)