03-29-2008 6:20 AM
03-29-2008 3:26 PM
hi ,
*Simple report to create graph in ABAP
*using GRAPH_MATRIX_3D function module
*The graph shows the performance of 3 companies for the Four
*quarters of a single year
REPORT Z_3DGRAPH.
*structure declaration for performance measurement
TYPES: BEGIN OF ty_performance,
company(15) TYPE c,
q1 TYPE i,
q2 TYPE i,
q3 type i,
q4 type i,
END OF ty_performance.
*structure declaration for options table
types : BEGIN OF ty_opttable,
options(30) TYPE c,
END OF ty_opttable.
*Internal table and work area declarations
DATA: it_performance TYPE STANDARD TABLE OF ty_performance,
wa_performance TYPE ty_performance.
DATA : it_opttable type standard table of ty_opttable,
wa_opttable type ty_opttable.
*initialization event
INITIALIZATION.
*start of selection event
START-OF-SELECTION.
*clearing the work areas
CLEAR WA_PERFORMANCE.
CLEAR wa_opttable.
*appending values into the performance internal table
wa_performance-company = 'Company A'.
wa_performance-q1 = 78.
wa_performance-q2 = 68.
wa_performance-q3 = 79.
wa_performance-q4 = 80.
append wa_performance to it_performance.
wa_performance-company = 'Company B'.
wa_performance-q1 = 48.
wa_performance-q2 = 68.
wa_performance-q3 = 69.
wa_performance-q4 = 70.
append wa_performance to it_performance.
wa_performance-company = 'Company C'.
wa_performance-q1 = 78.
wa_performance-q2 = 48.
wa_performance-q3 = 79.
wa_performance-q4 = 85.
append wa_performance to it_performance.
*appending values into the options internal table
wa_opttable-options = 'P3TYPE = TO'.
APPEND wa_opttable TO it_opttable.
wa_opttable-options = 'P2TYPE = VB'.
APPEND wa_opttable TO it_opttable.
wa_opttable-options = 'TISIZE = 1'.
APPEND wa_opttable TO it_opttable.
*calling the graph function module
CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
col1 = 'Quarter 1'
col2 = 'Quarter 2'
col3 = 'Quarter 3'
col4 = 'Quarter 4'
dim1 = 'In Percentage%'
set_focus = 'X'
titl = 'Company Performances'
TABLES
data = it_performance
opts = it_opttable
EXCEPTIONS
others = 1.
03-29-2008 6:31 AM
REPORT ZSAN_GRAPH .
DATA: BEGIN OF ITAB_DATA OCCURS 0,
DATANAME(15),
QUANTITY1 TYPE I,
QUANTITY2 TYPE I,
QUANTITY3 TYPE I,
END OF ITAB_DATA,
BEGIN OF ITAB_OPTIONS OCCURS 0,
OPTION(20),
END OF ITAB_OPTIONS.
ITAB_DATA-DATANAME = 'Electricity'.
ITAB_DATA-QUANTITY1 = 55.
ITAB_DATA-QUANTITY2 = 62.
ITAB_DATA-QUANTITY3 = 59.
APPEND ITAB_DATA.
ITAB_DATA-DATANAME = 'Gas'.
ITAB_DATA-QUANTITY1 = 35.
ITAB_DATA-QUANTITY2 = 52.
ITAB_DATA-QUANTITY3 = 44.
APPEND ITAB_DATA.
ITAB_DATA-DATANAME = 'Water'.
ITAB_DATA-QUANTITY1 = 18.
ITAB_DATA-QUANTITY2 = 22.
ITAB_DATA-QUANTITY3 = 19.
APPEND ITAB_DATA.
CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
COL1 = 'Jan'
COL2 = 'Feb'
COL3 = 'Mar'
TITL = 'Utility Expenses in US$.'
TABLES
DATA = ITAB_DATA
OPTS = ITAB_OPTIONS
EXCEPTIONS
OTHERS = 1.
03-29-2008 3:26 PM
hi ,
*Simple report to create graph in ABAP
*using GRAPH_MATRIX_3D function module
*The graph shows the performance of 3 companies for the Four
*quarters of a single year
REPORT Z_3DGRAPH.
*structure declaration for performance measurement
TYPES: BEGIN OF ty_performance,
company(15) TYPE c,
q1 TYPE i,
q2 TYPE i,
q3 type i,
q4 type i,
END OF ty_performance.
*structure declaration for options table
types : BEGIN OF ty_opttable,
options(30) TYPE c,
END OF ty_opttable.
*Internal table and work area declarations
DATA: it_performance TYPE STANDARD TABLE OF ty_performance,
wa_performance TYPE ty_performance.
DATA : it_opttable type standard table of ty_opttable,
wa_opttable type ty_opttable.
*initialization event
INITIALIZATION.
*start of selection event
START-OF-SELECTION.
*clearing the work areas
CLEAR WA_PERFORMANCE.
CLEAR wa_opttable.
*appending values into the performance internal table
wa_performance-company = 'Company A'.
wa_performance-q1 = 78.
wa_performance-q2 = 68.
wa_performance-q3 = 79.
wa_performance-q4 = 80.
append wa_performance to it_performance.
wa_performance-company = 'Company B'.
wa_performance-q1 = 48.
wa_performance-q2 = 68.
wa_performance-q3 = 69.
wa_performance-q4 = 70.
append wa_performance to it_performance.
wa_performance-company = 'Company C'.
wa_performance-q1 = 78.
wa_performance-q2 = 48.
wa_performance-q3 = 79.
wa_performance-q4 = 85.
append wa_performance to it_performance.
*appending values into the options internal table
wa_opttable-options = 'P3TYPE = TO'.
APPEND wa_opttable TO it_opttable.
wa_opttable-options = 'P2TYPE = VB'.
APPEND wa_opttable TO it_opttable.
wa_opttable-options = 'TISIZE = 1'.
APPEND wa_opttable TO it_opttable.
*calling the graph function module
CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
col1 = 'Quarter 1'
col2 = 'Quarter 2'
col3 = 'Quarter 3'
col4 = 'Quarter 4'
dim1 = 'In Percentage%'
set_focus = 'X'
titl = 'Company Performances'
TABLES
data = it_performance
opts = it_opttable
EXCEPTIONS
others = 1.
03-30-2008 11:22 AM
Hi,
REPORT ZGRAPH .
DATA: BEGIN OF ITAB_DATA OCCURS 0,
DATANAME(15),
QUANTITY1 TYPE I,
QUANTITY2 TYPE I,
QUANTITY3 TYPE I,
END OF ITAB_DATA,
BEGIN OF ITAB_OPTIONS OCCURS 0,
OPTION(20),
END OF ITAB_OPTIONS.
ITAB_DATA-DATANAME = 'Electricity'.
ITAB_DATA-QUANTITY1 = 55.
ITAB_DATA-QUANTITY2 = 62.
ITAB_DATA-QUANTITY3 = 59.
APPEND ITAB_DATA.
ITAB_DATA-DATANAME = 'Gas'.
ITAB_DATA-QUANTITY1 = 35.
ITAB_DATA-QUANTITY2 = 52.
ITAB_DATA-QUANTITY3 = 44.
APPEND ITAB_DATA.
ITAB_DATA-DATANAME = 'Water'.
ITAB_DATA-QUANTITY1 = 18.
ITAB_DATA-QUANTITY2 = 22.
ITAB_DATA-QUANTITY3 = 19.
APPEND ITAB_DATA.
CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
COL1 = 'Jan'
COL2 = 'Feb'
COL3 = 'Mar'
TITL = 'Utility Expenses in US$.'
TABLES
DATA = ITAB_DATA
OPTS = ITAB_OPTIONS
EXCEPTIONS
OTHERS = 1.
Reward if helpful...
Sowjanya.
03-30-2008 11:45 AM
Hi,
have a look at the following blog:
/people/harry.dietz/blog/2006/01/04/internal-table--fill-and-read-show-a-chart
this can help as well (it´s in the wiki section of SDN):
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2beasy%2bgraph%2bto%2buse
Best regards.
03-30-2008 12:31 PM
Hi,
Just try this SAMPLE code,
REPORT ZABAP__GRAPH .
DATA: BEGIN OF ITAB_DATA OCCURS 0,
DATANAME(15),
QUANTITY1 TYPE I,
QUANTITY2 TYPE I,
QUANTITY3 TYPE I,
END OF ITAB_DATA,
BEGIN OF ITAB_OPTIONS OCCURS 0,
OPTION(20),
END OF ITAB_OPTIONS.
ITAB_DATA-DATANAME = 'Electricity'.
ITAB_DATA-QUANTITY1 = 55.
ITAB_DATA-QUANTITY2 = 62.
ITAB_DATA-QUANTITY3 = 59.
APPEND ITAB_DATA.
ITAB_DATA-DATANAME = 'Gas'.
ITAB_DATA-QUANTITY1 = 35.
ITAB_DATA-QUANTITY2 = 52.
ITAB_DATA-QUANTITY3 = 44.
APPEND ITAB_DATA.
ITAB_DATA-DATANAME = 'Water'.
ITAB_DATA-QUANTITY1 = 18.
ITAB_DATA-QUANTITY2 = 22.
ITAB_DATA-QUANTITY3 = 19.
APPEND ITAB_DATA.
CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
COL1 = 'Jan'
COL2 = 'Feb'
COL3 = 'Mar'
TITL = 'Utility Expenses in US$.'
TABLES
DATA = ITAB_DATA
OPTS = ITAB_OPTIONS
EXCEPTIONS
OTHERS = 1.