在SAP ERP 系统中,对于用户来说,一般都是用ABAP来开发自己报表或事务,用WRITE输出报表或用ALV来显示报表。可否将报表中的相关数据用类似如下图形来显示呢?
以下为示例代码:
REPORT ZPR_GRAPHS.
DATA: BEGIN OF ITAB_MAIN OCCURS 0,
DATANAME(15),
QUANTITY1 TYPE I,
QUANTITY2 TYPE I,
QUANTITY3 TYPE I,
QUANTITY4 TYPE I,
END OF ITAB_MAIN,
BEGIN OF ITAB_OPTIONS OCCURS 0,
OPTION(20),
END OF ITAB_OPTIONS.
ITAB_MAIN-DATANAME = '气体'."Gas'.
ITAB_MAIN-QUANTITY1 = 52.
ITAB_MAIN-QUANTITY2 = 66.
ITAB_MAIN-QUANTITY3 = 0.
ITAB_MAIN-QUANTITY4 = 93.
APPEND ITAB_MAIN.
ITAB_MAIN-DATANAME = '电子'."Electricity'.
ITAB_MAIN-QUANTITY1 = 18.
ITAB_MAIN-QUANTITY2 = 22.
ITAB_MAIN-QUANTITY3 = 19.
ITAB_MAIN-QUANTITY4 = 92.
APPEND ITAB_MAIN.
ITAB_MAIN-DATANAME = '燃油'."Fuel'.
ITAB_MAIN-QUANTITY1 = 50.
ITAB_MAIN-QUANTITY2 = 65.
ITAB_MAIN-QUANTITY3 = 59.
ITAB_MAIN-QUANTITY4 = 99.
APPEND ITAB_MAIN.
CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
COL1 = '2001'
COL2 = '2002'
COL3 = '2003'
COL4 = '2004'
TITL = '价格显示.'
TABLES
DATA = ITAB_MAIN
OPTS = ITAB_OPTIONS
EXCEPTIONS
OTHERS = 1.
程序执行后就显示上图结果。