ABAP:如何去掉ALV数字字段小数点后面的0

只要在ALV输出的参考结构里面把字段的属性DECIMALS_OUT 设置为0即可。

FORM FRM_CATLG_SET USING P_FIELD P_TEXT P_KEY.
  DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
  LS_FIELDCAT-FIELDNAME = P_FIELD.
  LS_FIELDCAT-SELTEXT_L = P_TEXT.
  LS_FIELDCAT-KEY = P_KEY.
  LS_FIELDCAT-NO_ZERO = 'X'.
  
    IF P_FIELD = 'LINE_SUM'.
    LS_FIELDCAT-DECIMALS_OUT = '0'.         "去掉小数点后边0
  ENDIF.
  APPEND LS_FIELDCAT TO GD_FIELDCAT .
  CLEAR LS_FIELDCAT .
ENDFORM

 

你可能感兴趣的:(abap)