Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GRAPH_2D FM

Former Member
0 Likes
1,082

Hi,

can any body explain me what is this FM do and how to use it ..

points will be rewarded for good answers

4 REPLIES 4
Read only

Former Member
0 Likes
766

Hi,

The function module GRAPH_2D calls up a 2D SAP Business graphic.

As opposed to the function module GRAPH_MATRIX_2D, GRAPH_2D is very easy

to handle.

To display an internal table with a text and value column in the form of

a diagram with vertical bars, you should use this function module.

GRAPH_MATRIX_2D is required, in particular, to represent various lines

and columns from a very large matrix.

GRAPH_MATRIX_2D is also required for special types of displays.

The only parameter that needs to be transferred is the DATA table.

Table DATA consists of two columns. The first column is a C field with

an arbitrary length. The second column is a value field that can be of

the type P or F.

All other transfer parameters are optional.

Regards,

Renjith Michael.

Read only

kai_gutenkunst
Product and Topic Expert
Product and Topic Expert
0 Likes
766

Hi,

if you are intested in a chart that does not come up in its own window, have a look at the modern alternative: the chart engine.

Check out reports graphics_gui_ce_demo or graphics_igs_ce_test and see the SAP Chart Designer (SDN - Downloads - Tools for WebAS).

Regards, Kai

Read only

0 Likes
766

Renjith,

You are incorrect.

The function module GRAPH_MATRIX_2D also requires the tables, OPTS and TCOL.

However, it is not required that these tables have data in them. It is only required that you pass them into the function module.

Use this webpage as a reference: [GRAPH_MATRIX_2D|http://www.consolut.com/en/s/sap-ides-access/d/s/doc/F-GRAPH_MATRIX_2D|GRAPH_MATRIX_2D]

To give you an example of it's use:

  TYPES:  BEGIN OF data_row,
            label(10) TYPE c,
            value(15) TYPE p DECIMALS 4,
          END OF data_row.

  DATA: i_data TYPE TABLE OF data_row,
        i_opts TYPE TABLE OF string,
        i_tcol TYPE TABLE OF string.

  FIELD-SYMBOLS:
    <i_data> LIKE LINE OF i_data.

    DO 5 TIMES.
      APPEND INITIAL LINE TO i_data ASSIGNING <i_data>.
      <i_data>-label = 'label'.
      <i_data>-value = 100.
    ENDDO.

      CALL FUNCTION 'GRAPH_MATRIX_2D'
*       EXPORTING
*         AUTO_CMD_1        = ' '
*         AUTO_CMD_2        = ' '
*         INBUF             = ' '
*         INFORM            = ' '
*         MAIL_ALLOW        = ' '
*         NCOL              = ' '
*         NROW              = ' '
*         PWDID             = ' '
*         SET_FOCUS         = 'x'
*         SO_CONTENTS       = ' '
*         SO_RECEIVER       = ' '
*         SO_SEND           = ' '
*         SO_TITLE          = ' '
*         STAT              = ' '
*         SUPER             = ' '
*         TIMER             = ' '
*         TITL              = ' '
*         VALT              = ' '
*         WDID              = ' '
*         WINID             = ' '
*         WINPOS            = ' '
*         WINSZX            = '50'
*         WINSZY            = '50'
*         X_OPT             = ' '
*         NOTIFY            = ' '
*       IMPORTING
*         B_KEY             =
*         B_TYP             =
*         CUA_ID            =
*         MOD_COL           =
*         MOD_ROW           =
*         MOD_VAL           =
*         M_TYP             =
*         RBUFF             =
*         RWNID             =
        TABLES
          DATA              = i_data
          OPTS              = i_opts
          TCOL              = i_tcol
*       EXCEPTIONS
*         COL_INVALID       = 1
*         OPT_INVALID       = 2
*         OTHERS            = 3
         .
       IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.

Read only

0 Likes
766

Hi,

This FM is used to display the data in 2D format. Instead you can try the below mentioned class and FM . It is used for creating graphical charts (bar, pie charts, lines graphs) in ABAP as GRAPH_2D FM.

There are two main methods for creating charts in ABAP

1) Using the class CL_GFW

2) Using the function module GFW_PRES_SHOW

There are also other classes and function modules derived from these ones.

Use transaction GRAL to explore all possibilities provided by this class and this FM.

Function Module GFW_PRES_SHOW

The function module has IMPORTING, EXPORTING and TABLES parameters and EXCEPTIONS.

IMPORTING: -

CONTAINER or PARENT: - Container object in which the graphic is to be placed (PARENT must have the data type u201CTYPE REF TO CL_GUI_CONTAINERu201D).

TOP: - Alignment/upper edge of the parent object

LEFT: - Alignment/left hand edge of the parent object

HEIGHT: -Height of the control

WIDTH: - Width of the control

PRESENTATION_TYPE: - Diagram type = type in which all data series are represented (lines, points, vertical bar, pie ...)

The presentation type is determined by the constants in type group GFW (please refer to the documentation for the parameter PRESENTATION_TYPE).

If the PRESENTATION_TYPE is GFW_PRESTYPE_PIE_CHART make sure that the texts in the table parameters ROW_LABELS/COLUMN_LABELS are 20 characters or less, otherwise the sections of the pie are displayed white.

HEADER: - Header (plot area)

ORIENTATION : -Specifies how the data tables are interpreted

X_AXIS_TITLE: - Title/label for the X-axis

Y_AXIS_TITLE : -Title/label for the Y-axis

FORMAT: - Format of requested export

EXPORTING

RETVAL: - First error occurred

CONTENT_TYPE: - Type of requested export

CONTENT_LENGTH: - Length of requested export

TABLES

VALUES: - Line texts and (up to 32) values per line

COLUMN_TEXTS: - Column texts (up to 32)

ROW_LABELS: - Headings for unique line texts

COLUMN_LABELS: - Headings for the unique column texts

CONTENT: - Exported picture of graphic

Please reward if u find this useful...