Programming

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

We can generate graph 3D by applying function module ’GRAPH_3D’.

Example

DATA: BEGIN OF itab OCCURS 0,
        text(20) TYPE C,
        value1 TYPE i,
        value2 TYPE i,
        value3 TYPE i,
      END OF itab.
START-OF-SELECTION.
  itab-text = ’COL1’.
  itab-value1 = ’20’.
  itab-value2 = ’5’.
  itab-value3 = ’10’.
  APPEND itab.


itab-text = ’COL2’.
  itab-value1 = ’5’.
  itab-value2 = ’15’.
  itab-value3 = ’30’.
  APPEND itab.

itab-text = ’COL3’.
  itab-value1 = ’80’.
  itab-value2 = ’50’.
  itab-value3 = ’40’.
  APPEND itab.

itab-text = ’COL4’.
  itab-value1 = ’35’.
  itab-value2 = ’15’.
  itab-value3 = ’5’.
  APPEND itab.


CALL FUNCTION ’GRAPH_3D’
    EXPORTING
*     AUTO_CMD_1         = ’ ’
*     AUTO_CMD_2         = ’ ’
*     DIM1               = ’ ’
*     DIM2               = ’ ’
*     TYPE               = ’ ’
*     DISPLAY_TYPE       = ’ ’
*     INBUF              = ’ ’
*     INFORM             = ’ ’
*     MAIL_ALLOW         = ’ ’
*     PWDID              = ’ ’
*     SET_FOCUS          = ’x’
*     SO_CONTENTS        = ’ ’
*     SO_RECEIVER        = ’ ’
*     SO_SEND            = ’ ’
*     SO_TITLE           = ’ ’
*     STAT               = ’ ’
*     SUPER              = ’ ’
*     TIMER              = ’ ’
      TITL               = ’Testing graph 3D’
*     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
            .

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

EDITOR-CALL statement to show internal table as editor in ABAP/4

You can show the value of internal table as editor in ABAP/4 editor and you can modify data too by applying EDITOR-CALL statement.

Example

DATA: BEGIN OF itab occurs 0,
        text(100),
      END OF itab.
INITIALIZATION.
  itab-text = ’Line1: ’.
  APPEND itab.
  itab-text = ’Line2: ’.
  APPEND itab.
  itab-text = ’Line3: ’.
  APPEND itab.
  itab-text = ’Line4: ’.
  APPEND itab.
START-OF-SELECTION.
  EDITOR-CALL FOR itab TITLE ’Testing EDITOR-CALL for internal table’.
  LOOP AT itab.
    WRITE:/ itab-text.
  ENDLOOP.

BOX command in SAPscript

You can draw box in your SAPscript form by applying this command.

Syntax

/: BOX [XPOS] [YPOS] [WIDTH] [HEIGHT] [FRAME] [INTENSITY]

Example

We will draw box begins x origin 1 cm, y origin 2 cm, width 3 cm, height 4 cm, frame 10 tw and shade 10 %

/: BOX XPOS 1 CM YPOS 2 CM WIDTH 3 CM HEIGHT 4 CM FRAME 10 TW INTENSITY 10
img41

Output
img42

How to insert graphics image (Bitmap) in SAPscript

You can insert graphics object (Bitmap) in SAPscript as following:

  • Go to editor of SAPscript form  
    img33
  • Select menu Insert -> Graphics
    img34

    img35
  • Select tab img36 and input the graphic object that already uploaded to SAP by transaction SE78.
    img37

Step by step upload bitmap images to SAP

Step by step

  • Go to transaction SE78.
    img20
  • Select tree menu: Form Graphics -> Stroed on Document Server -> Graphics General Graphics -> BMAP Bitmap Images
    img23

    img25
  • Select img26 to import bitmap image file to SAP. System will popup screen for input file information and target name.
    img27