ABAP/4 Example Code: How to generate graph 2D by ABAP/4

We can generate graph 2D by applying function module ’GRAPH_2D’.

Example

DATA: BEGIN OF itab OCCURS 0,
        text(20) TYPE C,
        value    TYPE i,
      END OF itab.



START-OF-SELECTION.
  itab-text = ’COL1’.
  itab-value = 50.
  APPEND itab.
  itab-text = ’COL2’.
  itab-value = 100.
  APPEND itab.
  itab-text = ’COL3’.
  itab-value = 70.
  APPEND itab.
  itab-text = ’COL4’.
  itab-value = 10.
  APPEND itab.

CALL FUNCTION ’GRAPH_2D’
    EXPORTING
*     AUTO_CMD_1               = ’ ’
*     AUTO_CMD_2               = ’ ’
*     TYPE                     = ’ ’
*     DISPLAY_TYPE             = ’ ’
*     INBUF                    = ’ ’
*     INFORM                   = ’ ’
*     MAIL_ALLOW               = ’ ’
*     PWDID                    = ’ ’
*     SET_FOCUS                = ’x’
*     SMFONT                   = ’ ’
*     SO_CONTENTS              = ’ ’
*     SO_RECEIVER              = ’ ’
*     SO_SEND                  = ’ ’
*     SO_TITLE                 = ’ ’
*     STAT                     = ’ ’
*     SUPER                    = ’ ’
*     TIMER                    = ’ ’
      TITL                     = ’Testing Graph 2D’
*     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                     = itab
    EXCEPTIONS
      GUI_REFUSE_GRAPHIC       = 1
      OTHERS                   = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
The output is
img53 

Post new comment