FORM ALV_OUTPUT.*ALV输出结果DATA: WA_FIELDCAT LIKE LINE OF L_FIELDCAT.SET PF-STATUS 'STANDARD'.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'PRCTR'.WA_FIELDCAT-SELTEXT_S = '利润中心编码'.WA_FIELDCAT-DDICTXT = 'M'.WA_FIELDCAT-JUST = 'L'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'KTEXT'.WA_FIELDCAT-SELTEXT_M = '利润中心名称'.WA_FIELDCAT-DDICTXT = 'M'.WA_FIELDCAT-JUST = 'L'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'SAKNR'.WA_FIELDCAT-SELTEXT_S = '科目编码'.WA_FIELDCAT-DDICTXT = 'S'.WA_FIELDCAT-JUST = 'L'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'TXT50'.WA_FIELDCAT-SELTEXT_L = '科目名称'.WA_FIELDCAT-DDICTXT = 'L'.WA_FIELDCAT-JUST = 'L'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'RPMAX'.WA_FIELDCAT-SELTEXT_S = '期间'.WA_FIELDCAT-DDICTXT = 'S'.WA_FIELDCAT-JUST = 'L'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'QC'.WA_FIELDCAT-SELTEXT_L = '期初余额'.WA_FIELDCAT-DDICTXT = 'L'.WA_FIELDCAT-JUST = 'R'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'JF'.WA_FIELDCAT-SELTEXT_L = '借方发生额'.WA_FIELDCAT-DDICTXT = 'L'.WA_FIELDCAT-JUST = 'R'.APPEND WA_FIELDCAT TO L_FIELDCAT.CLEAR WA_FIELDCAT.WA_FIELDCAT-FIELDNAME = 'DF'.WA_FIELDCAT-SELTEXT_L = '贷方发生额'.WA_FIELDCAT-DDICTXT = 'L'.WA_FIELDCAT-JUST = 'R'.APPEND WA_FIELDCAT TO L_FIELDCAT.
FIX_COLUMN是固定字段用的 如果用KEY ,颜色会变化,而且你排序的时候 会自动根据KEY排序的。 最好使用FIX_COLUMN 除非你的字段本身就是KEY
只要在ALV输出时加入下面code就可以了WA_FIELDCAT-key = 'X'.
在字段属性设置中(fielddat)将属性----key = 'x'.
只需要将fieldcay中的key标记为‘X’即可