Skip to Content

Displaying 3D Graphs in ABAP

*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

*AUTHOR : Swarna.S.

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

  1. 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.

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Simon Rotherham

    A good example.  A simple bit of code to demonstrate the capabilities of a very useful function module that is often forgotten about. I must remember to use it more often!

    (0) 
  2. Former Member

    Thanks a lot for the example.

    This code shows the graph in a popup window.

    It is possible to display graphs within a normal dynpro  ? (not a web dynpro).

    (0) 
  3. Former Member

    Nice example, this was exactly what i was searching for, so thank you!!! 🙂

    While searching for programms hat use this function module, i found this demoprogramm which might be also useful for some:

    BCGRDEMO

    It demonstrates the use of the function module above and similiar other modules that are useful for the ouput of diagramms or graphics. The technic of the fm by the way seems pretty old.

    (0) 

Leave a Reply