Triple A

It's all about ABAP.


Sunday, February 20, 2011

Graph in 3 minutes

Sample Graph:

Function module: GRAPH_MATRIX_3D

This FM calls a 3D SAP business graphic.
It's easy to use, just make sure you spend some time on the FM documentations.

Steps:
1. Create a structure type for your data and an internal table based on it.
TYPES:
BEGIN OF t_data,
company TYPE c LENGTH 15,
q1 TYPE i,
q2 TYPE i,
q3 TYPE i,
q4 TYPE i,
END OF t_data.

2. Create an internal table based on the structure type below:
TYPES :
BEGIN OF t_opt,
options TYPE c LENGTH 30,
END OF t_opt.

3. Populate both tables.
Sample for data table:
w_data-company = 'Company X'.
w_data-q1 = 55.
w_data-q2 = 68.
w_data-q3 = 24.
w_data-q4 = 77.

Sample for option table:
w_opt-options = 'P2TYPE = VB'.
* For more details, please refer to FM documentation.

4. Call FM.
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 growth'
TABLES
data = i_data
opts = i_opt
EXCEPTIONS
OTHERS = 1.




No comments:

Post a Comment