Skip to Content

Hi,

It’s a basic Development to display information’s in Different-2 charts.

Note: –  For display information in chart IGS Server should be active in SAP System.

Input: –

Here, Number of Information’s indicates the total number of information which will be display in Chart, as below output Picture,

Height and Width indicates the charts Height and Width and In chart type select the existing chart type.

Based on the selection information will be display as selected selected chart type.

As below picture Displaying the information in PIE_3D chart.

Output: –

Source Code: –

REPORT  ZCHART_PRO.
TYPE-POOLS: VRM.

DATA:   G_NAME      TYPE VRM_ID,
         GIT_LIST    TYPE VRM_VALUES,
         GFL_LIST    LIKE LINE OF GIT_LIST.

DATA:   g_rfc       TYPE char32 VALUE ‘IGS_RFC_DEST’.
DATA:   cl_html     TYPE REF TO cl_gui_html_viewer,
         CL_CON      TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
         cl_chart    TYPE REF TO cl_igs_chart,
         git_html    TYPE w3htmltabtype,
         gfl_html    TYPE w3html,
         git_igs     TYPE igs_data_tab,
         gfl_igs     TYPE igs_data,
         g_url       TYPE w3url,
         g_bool      TYPE c,
         g_str       TYPE string,
         g_no        TYPE i.

DATA:   git_cont    TYPE w3paramcont_type,
         git_sub     TYPE w3paramcont_type,
         g_len       TYPE i,
         git_mine    TYPE w3mimetabtype,
         git_htm     TYPE w3htmltabtype.

DATA:   p_no        TYPE i,
         g_width     TYPE i,
         g_height    TYPE i,
         P_CTYPE     TYPE CHAR2.

DATA:   G_UCOMM     TYPE SYUCOMM.

INITIALIZATION.
   CALL METHOD cl_igs_data=>is_registered_type
     EXPORTING
       destination             = g_rfc
       type                    = cl_igs_chart=>interpreter_type
     RECEIVING
       rval                    = g_bool
     EXCEPTIONS
       rfc_communication_error = 1
       rfc_system_error        = 2
       internal_error          = 3
       OTHERS                  = 4.
   IF sysubrc <> 0.
     MESSAGE ‘No “Chart” interpreter installed on IGS’ TYPE ‘E’.
   ENDIF.

START-OF-SELECTION.
   CALL SCREEN 9000.

END-OF-SELECTION.

*&———————————————————————*
*&      Module  STATUS_9000  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE status_9000 OUTPUT.
   SET PF-STATUS ‘9000MENU’.
   SET TITLEBAR ‘9000INFO’.
   IF GFL_LIST IS INITIAL.
     PERFORM SUB_ADD_CHART_TYPE.
   ENDIF.

   IF CL_CON IS INITIAL.
     CREATE OBJECT cl_con
       EXPORTING
         container_name = ‘HTML’.
     IF sysubrc <> 0.
     ENDIF.
   ENDIF.
   IF cl_html IS INITIAL.
     CREATE OBJECT cl_html
       EXPORTING
         parent = cl_con.
   ENDIF.

   CALL METHOD CL_HTML->DO_REFRESH.
   IF cl_chart IS INITIAL.
     CREATE OBJECT cl_chart.
   ENDIF.

   cl_gfw=>its_rfc_dest  = g_rfc.

   CALL METHOD cl_html->load_data
     EXPORTING
       type                   = git_cont
       subtype                = git_sub
       size                   = g_len
     IMPORTING
       assigned_url           = g_url
     CHANGING
       data_table             = git_mine
     EXCEPTIONS
       dp_invalid_parameter   = 1
       dp_error_general       = 2
       cntl_error             = 3
*     html_syntax_notcorrect = 4
       OTHERS                 = 5.
   IF sysubrc <> 0.
     MESSAGE ‘ERROR’ TYPE ‘E’.
   ENDIF.

   CONCATENATE  ‘<HTML><HEAD><TITLE>Chart By Praveer</TITLE></HEAD>’
   ‘<BODY BGCOLOR=#DEDEC8>’
   ‘<MAP NAME = CHART>’ INTO gfl_htmlline.
   APPEND gfl_html TO git_html.
   APPEND LINES OF git_htm TO git_html.
   CONCATENATE ‘</MAP>’
               ‘<IMG SRC=”‘ g_url ‘” USEMAP=#CHART BORDER=0>’
               ‘</BODY></HTML>’ INTO gfl_htmlline.
   APPEND gfl_html TO git_html.

   CALL METHOD cl_html->load_data
     EXPORTING
       type         = ‘TEXT’
       subtype      = ‘HTML’
     IMPORTING
       assigned_url = g_url
     CHANGING
       data_table   = git_html.

   CALL METHOD cl_html->show_url
     EXPORTING
       url = g_url.
ENDMODULE.                 ” STATUS_9000  OUTPUT
*&———————————————————————*
*&      Form  SUB_ADD_CHART_TYPE
*&———————————————————————*
form SUB_ADD_CHART_TYPE .
   REFRESH: GIT_LIST.
   G_NAME = ‘P_CTYPE’.
   GFL_LISTKEY = ’01’.GFL_LISTTEXT = ‘TREND’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’02’.GFL_LISTTEXT = ‘LINES’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’03’.GFL_LISTTEXT = ‘LINES_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’04’.GFL_LISTTEXT = ‘AREA’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’05’.GFL_LISTTEXT = ‘AREA_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’06’.GFL_LISTTEXT = ‘AREA_STACKED’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’07’.GFL_LISTTEXT = ‘AREA_STACKED_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’08’.GFL_LISTTEXT = ‘BARS’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’09’.GFL_LISTTEXT = ‘BARS_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’10’.GFL_LISTTEXT = ‘BARS_STACKED’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’11’.GFL_LISTTEXT = ‘BARS_STACKED_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’12’.GFL_LISTTEXT = ‘COLS’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’13’.GFL_LISTTEXT = ‘COLS_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’14’.GFL_LISTTEXT = ‘COLS_STACKED’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’15’.GFL_LISTTEXT = ‘COLS_STACKED_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’16’.GFL_LISTTEXT = ‘PIE’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’17’.GFL_LISTTEXT = ‘PIE_3D’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’18’.GFL_LISTTEXT = ‘PIE_EX’.APPEND GFL_LIST TO GIT_LIST.
   GFL_LISTKEY = ’19’.GFL_LISTTEXT = ‘PIE_EX_3D’.APPEND GFL_LIST TO GIT_LIST.

   CALL FUNCTION ‘VRM_SET_VALUES’
     EXPORTING
       ID              = G_NAME
       VALUES          = GIT_LIST
     EXCEPTIONS
       ID_ILLEGAL_NAME = 1
       OTHERS          = 2.
endform.                    ” SUB_ADD_CHART_TYPE
*&———————————————————————*
*&      Form  SET_CHART_TYPE
*&———————————————————————*

form SET_CHART_TYPE .
   CASE P_CTYPE.
     WHEN ’01’.
       cl_chart->type    = cl_igs_chart=>co_type_TREND.
     WHEN ’02’.
       cl_chart->type    = cl_igs_chart=>co_type_LINES.
     WHEN ’03’.
       cl_chart->type    = cl_igs_chart=>CO_TYPE_LINES_3D.
     WHEN ’04’.
       cl_chart->type    = cl_igs_chart=>co_type_AREA.
     WHEN ’05’.
       cl_chart->type    = cl_igs_chart=>co_type_AREA_3D.
     WHEN ’06’.
       cl_chart->type    = cl_igs_chart=>co_type_AREA_STACKED.
     WHEN ’07’.
       cl_chart->type    = cl_igs_chart=>co_type_AREA_STACKED_3D.
     WHEN ’08’.
       cl_chart->type    = cl_igs_chart=>co_type_BARS.
     WHEN ’09’.
       cl_chart->type    = cl_igs_chart=>co_type_BARS_3D.
     WHEN ’10’.
       cl_chart->type    = cl_igs_chart=>co_type_BARS_STACKED.
     WHEN ’11’.
       cl_chart->type    = cl_igs_chart=>CO_TYPE_BARS_STACKED_3D.
     WHEN ’12’.
       cl_chart->type    = cl_igs_chart=>co_type_COLS.
     WHEN ’13’.
       cl_chart->type    = cl_igs_chart=>co_type_COLS_3D.
     WHEN ’14’.
       cl_chart->type    = cl_igs_chart=>co_type_COLS_STACKED.
     WHEN ’15’.
       cl_chart->type    = cl_igs_chart=>co_type_COLS_STACKED_3D.
     WHEN ’16’.
       cl_chart->type    = cl_igs_chart=>co_type_PIE.
     WHEN ’17’.
       cl_chart->type    = cl_igs_chart=>co_type_PIE_3D.
     WHEN ’18’.
       cl_chart->type    = cl_igs_chart=>co_type_PIE_EX.
     WHEN ’19’.
       cl_chart->type    = cl_igs_chart=>co_type_PIE_EX_3D.
   ENDCASE.
endform.                    ” SET_CHART_TYPE
*&———————————————————————*
*&      Module  USER_COMMAND_9000  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
module USER_COMMAND_9000 input.

   CASE G_UCOMM.
     WHEN ‘VIEW’.
       REFRESH: git_html, git_igs.
       IF cl_chart IS INITIAL.
         CREATE OBJECT cl_chart.
       ELSE.
         FREE cl_chart.
         CREATE OBJECT cl_chart.
       ENDIF.
       PERFORM SET_CHART_TYPE.
       cl_chart->width   = g_width.
       cl_chart->height  = g_height.

       g_no = p_no.
       DO p_no TIMES.
         g_str = g_no * 10.
         g_no = g_no 1.
         gfl_igsgroupid = ‘Praveer’.
         CONCATENATE ‘INCRS’ g_str INTO gfl_igsx.
         gfl_igsy = g_str.
         APPEND gfl_igs TO git_igs.
       ENDDO.

       cl_chart->data = git_igs.

       REFRESH: GIT_MINE, GIT_HTM.
       CLEAR: G_LEN, GIT_CONT.
       CALL METHOD cl_chart->send
         IMPORTING
           content_type            = git_cont
           content_length          = g_len
           content                 = git_mine
           imagemap                = git_htm
         EXCEPTIONS
           rfc_communication_error = 1
           rfc_system_error        = 2
           internal_error          = 3
           OTHERS                  = 4.
       IF sysubrc NE 0.
         MESSAGE ‘ERROR’ TYPE ‘E’.
       ENDIF.
       SPLIT  git_cont  AT ‘/’ INTO git_cont git_sub.

     WHEN ‘BACK’.
       LEAVE PROGRAM.
     WHEN ‘EXIT’.
       LEAVE PROGRAM.
   ENDCASE.
endmodule.                 ” USER_COMMAND_9000  INPUT

Screen: –

Screen Logic: –

PROCESS BEFORE OUTPUT.
  MODULE STATUS_9000.
*
PROCESS AFTER INPUT.
  MODULE USER_COMMAND_9000.

Thanks & Regards

Praveer Kumar Sen.

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply