Skip to Content
Author's profile photo Former Member

Using SAP Bar Chart Graphics (Lesson-1)

What is SAP Bar Chart Graphics?

The SAP Bar Chart Graphics displays bar charts over a given time period, and allows the user to manipulate the bar charts. An ideal tool to develop a planning board.

Features of SAP Bar Chart Graphics:

  1. Graph title appears in the window title bar.
  2. Time line – You could have many types (by second, minute, hour, day, week, month, year) of time lines.
  3. Display areas – Supports up to a maximum of 8 bar charts in one graphic window. You can resize the displays by dragging the dividing line between the bar charts. Each bar chart consists of the following elements:
    1. Time units line.
    2. Tables section – Here you could have supporting information displayed in tabular form for the graph display area objects.
    3. Graph display area – The graph display area contains objects/nodes (event blocks) depicting the duration of events. Each of the graph areas contain its own time units line. The user can choose among a number of time units (minute, hour, day, week, etc.).
    4. The standard pushbuttons in the pushbutton bar allow you to change the size of the graph display and the tables section.
  4. The calling ABAP program determines the elements to be contained in the graphics window. You could define more menus with additional functions or leave out standard functions and symbols.
  5. You could select, move, change, connect, insert, resize, copy and delete objects/nodes (event blocks).
  6. The ability to print the bar chart graphics.

BarchartComponents.jpg

Two ways to call Bar Chart Graphics:

Call as a Window – Here the bar chart appears in a separate window.

BarChartWindow.JPG

Calling as a Control – Here the bar chart appears as a control.

BarchartControl.jpg

The key function groups:

  1. GRAP – Contains function modules necessary when calling bar chart as a window.
  2. BARC – Contains function modules necessary to create, modify the bar chart.
  3. CNBC – Contains function modules necessary to call bar chart as a control.

The key function modules used when calling a bar chart as a window:

  1. GRAPH_SET_CUA_STATUS – Set graphics GUI status and allows creating application-specific menu entries.
  2. GRAPH_RECEIVE – Enables you to wait for user input.

The key function modules used when calling a bar chart as a control:

  1. BARCHART_CREATE – Calls bar chart as a control

The common key function modules used in window/control:

  1. BARC_SET_OPTIONS – This enables settings to be changed when the graphic is loaded or reloaded.
  2. BARC_SET_TIME_AXIS – Set start and end time of axis.
  3. BARC_ADD_SECTION – To create a section of the time axis as well as dividing the time axis into a maximum of eight parts. Every section has a different time unit (hour, day, week..)
  4. BARC_ADD_RIBBON – Ribbons are time scales to be defined for every time axis per chart and section.
  5. Setting a calendar to appear on the bar chart:
    1. BARC_ADD_CALENDAR
    2. BARC_ADD_TIME_OBJECT
    3. BARC_ADD_TIME_PROFILE
    4. BARC_SET_TIME_PROFILE_ATTRIB
    5. BARC_SET_CALENDAR_ATTRIB
    6. BARC_ADD_INTERVAL
    7. BARC_SET_INTERVAL_ATTRIB
  6. BARC_ADD_CHART – To create a chart. You could have 8 Charts in One Window.
  7. BARC_SET_CHART_ATTRIB – To set chart attributes.
  8. BARC_SET_COLUMN_WIDTH – Determine column width, Define columns for every table area of a chart.
  9. BARC_SET_ROW_HEIGHT – A line height can be specified for each line.
  10. BARC_ADD_GRID – To create a time fence grid.
  11. BARC_LOGIC – This module provides the semantics for editing the transfer tables, based on user commands. The tables NODES, NVALS, BOXES, BVALS, POSITIONS and DELETIONS can be returned to the graphics module in the dialog loop.
  12. BARC_GRAPHIC_PBO – Starting bar chart at PBO time.
  13. BARC_GRAPHIC_PAI – Analyze data returned by the graphic.
  14. BARCHART_SET_FUNCTION_CODE – Deliver Function Code to Control.

A simple Bar Chart example:

///////////////////////////////////////////////////////////////////////////////////////////////////////

REPORT zbarchartsimple.

INCLUDE sgrccnst.
INCLUDE lbarccon.
INCLUDE barcdata.

DATA: chart   LIKE bcchartid,
       section LIKE bcsectionid,
       val     LIKE bcvalsval.

PARAMETER: gruppe    LIKE tbcgtprf_gruppe  DEFAULT ‘DEMO’,
            name      LIKE tbcgtprf_name    DEFAULT ‘000000000001’,
            index     LIKE tbcgtprf_index   DEFAULT ‘1’.

* Assign Graphic profile
graph_profileprf_gruppe = gruppe.
graph_profileprf_name   = name.
graph_profileprf_index  = index.

* Start and end of the timeline
CALL FUNCTION ‘BARC_SET_TIME_AXIS’
   EXPORTING
     start = ‘01.01.2012;’
     end   = ‘31.12.2012;’.

* Add 1st Chart
CALL FUNCTION ‘BARC_ADD_CHART’
   IMPORTING
     id = chart.

* Width of the column in the tables
CALL FUNCTION ‘BARC_SET_COLUMN_WIDTH’
   EXPORTING
     chart_id = chart
     width    = 4000.

* Heading for the table
boxesid         = 1.
boxestype       = bc_constrow_box.
boxeschart_id   = chart.
boxesform_type  = ‘B1’.
boxescolor_type = ‘B0’.
APPEND boxes.

box_valsid  = boxesid.
box_valsfl  = ‘0’.
box_valsval = ‘Table Header’.
APPEND box_vals.

positionsobj_id     = boxesid.
positionsobj_type   = bc_constbox_object.
positionschart_id   = chart.
positionsrow_number = 0.
APPEND positions.

WRITE boxesid TO val.

CALL FUNCTION ‘BARC_SET_CHART_ATTRIB’
   EXPORTING
     fl  = bc_constchart_title_box
     id  = chart
     val = val.

* Add a Section of time axis
CALL FUNCTION ‘BARC_ADD_SECTION’
   EXPORTING
     size  = 100
     start = ‘01.01.2012;’
     unit  = ‘5’
   IMPORTING
     id    = section.

* Add a Ribbon to a Section
CALL FUNCTION ‘BARC_ADD_RIBBON’
   EXPORTING
     chart_id   = chart
     color_type = ‘R1’
     section_id = section
     unit       = ‘5’.

CALL FUNCTION ‘BARC_ADD_RIBBON’
   EXPORTING
     chart_id   = chart
     color_type = ‘R2’
     section_id = section
     unit       = ‘3’.

* Create Rows for the Table
PERFORM set_boxes TABLES boxes
                          box_vals
                          positions
                   USING  chart.

* Set Nodes in Graph area
PERFORM set_nodes TABLES nodes
                          node_vals
                          positions
                   USING  chart.

stat = sgrc_conststat_1“Open Window, Transfer Data, Wait for Input

DO.
* Start Bar Chart
   CALL FUNCTION ‘BARC_GRAPHIC_PBO’
     EXPORTING
       confirm   = space
       profile   = graph_profile
       stat      = stat
     TABLES
       boxes     = boxes
       box_vals  = box_vals
       deletions = deletions
       links     = links
       link_vals = link_vals
       nodes     = nodes
       node_vals = node_vals
       positions = positions.

* Wait for user input
   CALL FUNCTION ‘GRAPH_RECEIVE’
     IMPORTING
       mcode             = m_typ
     EXCEPTIONS
       inv_communication = 1
       no_batch          = 2.

   IF NOT sysubrc IS INITIAL.
     EXIT.
   ENDIF.

   CASE m_typ.
     WHEN sgrc_constm_typ_d.
       EXIT.
     WHEN sgrc_constm_typ_i.
*     Evaluation of data from the graph
       CALL FUNCTION ‘BARC_GRAPHIC_PAI’
         IMPORTING
           graph_cmd = graph_cmd
         TABLES
           boxes     = boxes
           box_vals  = box_vals
           deletions = deletions
           nodes     = nodes
           node_vals = node_vals
           positions = positions
           links     = links
           link_vals = link_vals
         EXCEPTIONS
           inv_winid = 1.

       abap_cmd = graph_cmd.
       stat = sgrc_conststat_4.    “Wait for input
   ENDCASE.
ENDDO.

FORM make_box TABLES boxes STRUCTURE bcboxes
                      box_vals STRUCTURE bcvals
                      positions STRUCTURE bcposition
               USING  chart LIKE bcchartid
                      id TYPE i
                      format
                      color
                      text
                      row TYPE i.

   boxesid         = id.
   boxestype       = bc_constrow_box.
   boxeschart_id   = chart.
   boxesform_type  = format.
   boxescolor_type = color.
   APPEND boxes.

   box_valsid  = boxesid.
   box_valsfl  = ‘0’.
   box_valsval = text.
   APPEND box_vals.

   positionsobj_id     = boxesid.
   positionsobj_type   = bc_constbox_object.
   positionschart_id   = boxeschart_id.
   positionsrow_number = row.
   APPEND positions.

ENDFORM.

FORM set_boxes TABLES boxes STRUCTURE bcboxes
                       box_vals STRUCTURE bcvals
                       positions STRUCTURE bcposition
                USING  chart LIKE bcchartid.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 2 ‘B1’ ‘B1’ ‘Row – 1’ 1.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 3 ‘B1’ ‘B1’ ‘Row – 2’ 2.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 4 ‘B1’ ‘B1’ ‘Row – 3’ 3.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 5 ‘B1’ ‘B1’ ‘Row – 4’ 4.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 6 ‘B1’ ‘B1’ ‘Row – 5’ 5.

ENDFORM.

FORM set_nodes TABLES nodes STRUCTURE bcnodes
                       node_vals STRUCTURE bcnvals
                       positions STRUCTURE bcposition
                USING  chart LIKE bcchartid.

   nodesid         = 1.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘12.01.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘27.06.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’00’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 1.
   APPEND positions.

*———————————————————————-*
   nodesid         = 2.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘02.02.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘25.07.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’01’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 2.
   APPEND positions.

*———————————————————————-*
   nodesid         = 3.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘01.04.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘25.09.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’02’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 3.
   APPEND positions.

*———————————————————————-*
   nodesid         = 4.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘11.02.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘11.07.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’00’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 4.
   APPEND positions.

*———————————————————————-*
   nodesid         = 5.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘01.05.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘11.12.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’01’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 5.
   APPEND positions.

ENDFORM.

///////////////////////////////////////////////////////////////////////////////////////////////////////

Calling a Bar Chart as a control example:

///////////////////////////////////////////////////////////////////////////////////////////////////////

REPORT zbarchartcontrol.

INCLUDE sgrccnst.
INCLUDE lbarccon.
INCLUDE barcdata.
INCLUDE <ctldef>.

DATA: all_boxes     LIKE bcboxes    OCCURS 0 WITH HEADER LINE,
       all_box_vals  LIKE bcvals     OCCURS 0 WITH HEADER LINE,
       all_links     LIKE bclinks    OCCURS 0 WITH HEADER LINE,
       all_link_vals LIKE bcnvals    OCCURS 0 WITH HEADER LINE,
       all_nodes     LIKE bcnodes    OCCURS 0 WITH HEADER LINE,
       all_node_vals LIKE bcnvals    OCCURS 0 WITH HEADER LINE,
       all_positions LIKE bcposition OCCURS 0 WITH HEADER LINE.

DATA: chart        LIKE bcchartid,
       section      LIKE bcsectionid,
       val          LIKE bcvalsval,
       barc_ocx     TYPE cntl_handle,
       this_repid   LIKE syrepid,
       this_dynnr   LIKE sydynnr,
       ok_code      TYPE syucomm,
       save_ok_code LIKE ok_code,
       graph_cmd_info LIKE bccmdinfo,
       gr_sel_field   LIKE net_graphsel_field,
       layer_kind     LIKE tbcllayer_type,
       settings       LIKE barc_set,
       symboltype     LIKE tbclsymboltype.

PARAMETER: gruppe    LIKE tbcgtprf_gruppe  DEFAULT ‘DEMO’,
            name      LIKE tbcgtprf_name    DEFAULT ‘000000000001’,
            index     LIKE tbcgtprf_index   DEFAULT ‘1’.

this_dynnr = ‘100’.
this_repid = syrepid.

CALL FUNCTION ‘BARCHART_CREATE’
   EXPORTING
     owner_repid = this_repid
     dynnr       = this_dynnr
   CHANGING
     handle      = barc_ocx.

* Assign Graphic profile
graph_profileprf_gruppe = gruppe.
graph_profileprf_name   = name.
graph_profileprf_index  = index.

* Start and end of the timeline
CALL FUNCTION ‘BARC_SET_TIME_AXIS’
   EXPORTING
     start = ‘01.01.2012;’
     end   = ‘31.12.2012;’.

* Add 1st Chart
CALL FUNCTION ‘BARC_ADD_CHART’
   IMPORTING
     id = chart.

* Width of the column in the tables
CALL FUNCTION ‘BARC_SET_COLUMN_WIDTH’
   EXPORTING
     chart_id = chart
     width    = 4000.

* Heading for the table
boxesid         = 1.
boxestype       = bc_constrow_box.
boxeschart_id   = chart.
boxesform_type  = ‘B1’.
boxescolor_type = ‘B0’.
APPEND boxes.

box_valsid  = boxesid.
box_valsfl  = ‘0’.
box_valsval = ‘Table Header’.
APPEND box_vals.

positionsobj_id     = boxesid.
positionsobj_type   = bc_constbox_object.
positionschart_id   = chart.
positionsrow_number = 0.
APPEND positions.

WRITE boxesid TO val.

CALL FUNCTION ‘BARC_SET_CHART_ATTRIB’
   EXPORTING
     fl  = bc_constchart_title_box
     id  = chart
     val = val.

* Add a Section of time axis
CALL FUNCTION ‘BARC_ADD_SECTION’
   EXPORTING
     size  = 100
     start = ‘01.01.2012;’
     unit  = ‘5’
   IMPORTING
     id    = section.

* Add a Ribbon to a Section
CALL FUNCTION ‘BARC_ADD_RIBBON’
   EXPORTING
     chart_id   = chart
     color_type = ‘R1’
     section_id = section
     unit       = ‘5’.

CALL FUNCTION ‘BARC_ADD_RIBBON’
   EXPORTING
     chart_id   = chart
     color_type = ‘R2’
     section_id = section
     unit       = ‘3’.

* Create Rows for the Table
PERFORM set_boxes TABLES boxes
                          box_vals
                          positions
                   USING  chart.

* Set Nodes in Graph area
PERFORM set_nodes TABLES nodes
                          node_vals
                          positions
                   USING  chart.

CALL FUNCTION ‘BARC_LOGIC’
   TABLES
     all_boxes     = all_boxes
     all_box_vals  = all_box_vals
     all_links     = all_links
     all_link_vals = all_link_vals
     all_nodes     = all_nodes
     all_node_vals = all_node_vals
     all_positions = all_positions
     boxes         = boxes
     box_vals      = box_vals
     deletions     = deletions
     links         = links
     link_vals     = link_vals
     nodes         = nodes
     node_vals     = node_vals
     positions     = positions.

stat = sgrc_conststat_1“Open Window, Transfer Data, Wait for Input

CALL SCREEN 100.

FORM make_box TABLES boxes STRUCTURE bcboxes
                      box_vals STRUCTURE bcvals
                      positions STRUCTURE bcposition
               USING  chart LIKE bcchartid
                      id TYPE i
                      format
                      color
                      text
                      row TYPE i.

   boxesid         = id.
   boxestype       = bc_constrow_box.
   boxeschart_id   = chart.
   boxesform_type  = format.
   boxescolor_type = color.
   APPEND boxes.

   box_valsid  = boxesid.
   box_valsfl  = ‘0’.
   box_valsval = text.
   APPEND box_vals.

   positionsobj_id     = boxesid.
   positionsobj_type   = bc_constbox_object.
   positionschart_id   = boxeschart_id.
   positionsrow_number = row.
   APPEND positions.

ENDFORM.

FORM set_boxes TABLES boxes STRUCTURE bcboxes
                       box_vals STRUCTURE bcvals
                       positions STRUCTURE bcposition
                USING  chart LIKE bcchartid.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 2 ‘B1’ ‘B1’ ‘Row – 1’ 1.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 3 ‘B1’ ‘B1’ ‘Row – 2’ 2.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 4 ‘B1’ ‘B1’ ‘Row – 3’ 3.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 5 ‘B1’ ‘B1’ ‘Row – 4’ 4.

   PERFORM make_box TABLES boxes box_vals positions
                    USING  chart 6 ‘B1’ ‘B1’ ‘Row – 5’ 5.

ENDFORM.

FORM set_nodes TABLES nodes STRUCTURE bcnodes
                       node_vals STRUCTURE bcnvals
                       positions STRUCTURE bcposition
                USING  chart LIKE bcchartid.

   nodesid         = 1.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘12.01.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘27.06.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’00’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 1.
   APPEND positions.

*———————————————————————-*
   nodesid         = 2.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘02.02.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘25.07.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’01’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 2.
   APPEND positions.

*———————————————————————-*
   nodesid         = 3.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘01.04.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘25.09.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’02’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 3.
   APPEND positions.

*———————————————————————-*
   nodesid         = 4.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘11.02.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘11.07.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’00’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 4.
   APPEND positions.

*———————————————————————-*
   nodesid         = 5.
   nodeschart_id   = chart.
   APPEND nodes.

   node_valsid       = nodesid.
   node_valschart_id = nodeschart_id.
   node_valsfl       = ‘1’.
   node_valsval      = ‘01.05.2012;’.
   APPEND node_vals.

   node_valsfl       = ‘2’.
   node_valsval      = ‘11.12.2012;’.
   APPEND node_vals.

   node_valsfl  = bc_constadd_layer.
   node_valsval = ’01’.
   APPEND node_vals.

   positionsobj_id     = nodesid.
   positionsobj_type   = bc_constnode_object.
   positionschart_id   = nodeschart_id.
   positionsrow_number = 5.
   APPEND positions.

ENDFORM.

MODULE graphic_pbo OUTPUT.

   CALL FUNCTION ‘BARC_GRAPHIC_PBO’
     EXPORTING
       abap_cmd       = abap_cmd
       confirm        = ‘X’
       profile        = graph_profile
       stat           = stat
       status_text    = status_text
       control_handle = barc_ocx
     TABLES
       boxes          = boxes
       box_vals       = box_vals
       deletions      = deletions
       links          = links
       link_vals      = link_vals
       nodes          = nodes
       node_vals      = node_vals
       positions      = positions
     EXCEPTIONS
       err_in_profile = 1
       inv_profile    = 2
       inv_winid      = 3.

ENDMODULE.

MODULE status_0100 OUTPUT.
   SET PF-STATUS ‘GRAFIK’.
   SET TITLEBAR ‘100’.
ENDMODULE.

MODULE user_command_0100 INPUT.

   DATA: retval TYPE i.

   save_ok_code = ok_code.
   CLEAR ok_code.

   CASE save_ok_code.
     WHEN ‘EXIT’.
       PERFORM end_100.
     WHEN ‘QUIT’.
       PERFORM end_100.
     WHEN ‘BACK’.
       PERFORM end_100.
     WHEN OTHERS.
       IF save_ok_code(4) = sgrc_constevent
       OR save_ok_code(4) = sgrc_constshell_event.
*       Event Double Click
         PERFORM user_command.
       ELSE.                            “function Code
*       Otherwise function code passed to graphics
         CALL FUNCTION ‘BARCHART_SET_FUNCTION_CODE’
           EXPORTING
             handle        = barc_ocx
             function_code = save_ok_code
           IMPORTING
             return        = retval.
         IF retval = 0.

*         If data changes associated with function code
           PERFORM user_command.

           IF abap_cmd = bc_constget_selection
           OR abap_cmd = bc_constget_overlap
           OR abap_cmd = bc_constget_settings
           OR abap_cmd = bc_constget_color.

             CALL FUNCTION ‘BARC_GRAPHIC_PBO’
               EXPORTING
                 abap_cmd       = abap_cmd
                 stat           = stat
                 control_handle = barc_ocx.

             PERFORM user_command.

           ENDIF.

         ELSE.

           stat = sgrc_conststat_4.    “Wait for input

         ENDIF.

       ENDIF.

   ENDCASE.

ENDMODULE.

FORM end_100.

   CALL FUNCTION ‘BARC_GRAPHIC_PAI’
     EXPORTING
       control_handle     = barc_ocx
       at_control_destroy = sgrc_constyes.

   CALL FUNCTION ‘CONTROL_DESTROY’
     CHANGING
       h_control = barc_ocx
     EXCEPTIONS
       OTHERS    = 1.

   SET SCREEN 0.
   LEAVE SCREEN.

ENDFORM.

FORM user_command.

* Evaluation of the data from the graphic
   CALL FUNCTION ‘BARC_GRAPHIC_PAI’
     EXPORTING
       control_handle = barc_ocx
     IMPORTING
       graph_cmd      = graph_cmd
       graph_cmd_info = graph_cmd_info
       gr_sel_field   = gr_sel_field
       layer_type     = layer_kind
       settings       = settings
       symboltype     = symboltype
     TABLES
       boxes          = boxes
       box_vals       = box_vals
       deletions      = deletions
       links          = links
       link_vals      = link_vals
       nodes          = nodes
       node_vals      = node_vals
       positions      = positions
     EXCEPTIONS
       inv_winid      = 1.

   CLEAR: abap_cmd,
          status_text.

   stat = sgrc_conststat_4.            “Wait for input

* Evaluation of user commands
   CASE graph_cmd.

     WHEN bc_constask_for_delete.
       abap_cmd = graph_cmd.

     WHEN bc_constask_for_scaleleft.
       abap_cmd = graph_cmd.

     WHEN bc_constask_for_scaleright.
       abap_cmd = graph_cmd.

     WHEN bc_constask_for_back.
       abap_cmd = graph_cmd.

     WHEN bc_constask_for_quit.
       abap_cmd = graph_cmd.

     WHEN bc_constask_for_exit.
       abap_cmd = graph_cmd.

   ENDCASE.

   CALL FUNCTION ‘BARC_LOGIC’
     EXPORTING
       graph_cmd     = graph_cmd
     TABLES
       all_boxes     = all_boxes
       all_box_vals  = all_box_vals
       all_links     = all_links
       all_link_vals = all_link_vals
       all_nodes     = all_nodes
       all_node_vals = all_node_vals
       all_positions = all_positions
       boxes         = boxes
       box_vals      = box_vals
       deletions     = deletions
       links         = links
       link_vals     = link_vals
       nodes         = nodes
       node_vals     = node_vals
       positions     = positions.

ENDFORM.

///////////////////////////////////////////////////////////////////////////////////////////////////////

Lesson -2 will teach you all about Bar Chart Profile & making an interactive planning board.

1.       Graph title appears in the window title bar

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo nilesh shrivastava
      nilesh shrivastava

      sir where to add these codes.

      Author's profile photo Manish Meshram
      Manish Meshram

      Can you share where is 2nd lesson link on portal.

      Regards

      Manish

      Author's profile photo Former Member
      Former Member

      Manish, your comment is in response to Nilesh, but it looks like question is meant for blog author.

      You could have directly commented on blog instead of replying to existing comment.

      Looking at Author's content list, it is clear that lesson 2 does not exist.

      Author's profile photo Manish Meshram
      Manish Meshram

      Can you share where is 2nd lesson link on portal.

      Regards

      Manis

      Author's profile photo Bala Manchikalapati
      Bala Manchikalapati

      Hi Kishan,

      Can you please let me know how to use Edit and save options for barchart values.

      As in your Jam Demo, I need your help.

      Please post lesson 2 also on portal.

      Highly apprieciate your help in this regard.

      Please post the prg details for Jam demo.

      With REgards,

      Bala M

      Author's profile photo Bala Manchikalapati
      Bala Manchikalapati

      Good one.

      I need to implement the same.

      Please help me in answering few points from this blog.

      Also post the Remaining Blogs which you have.

      Thanks and Regards,

      Bala M

      Author's profile photo Srithar Thillairajan
      Srithar Thillairajan

      Hi kishan

      Good one

      I whant to show  to the user  in the  section 1,2,3,,5,6,7,8,9 up to 31  for  january month like individual  date  which was  run and  which job is  currently running like that i whant to show  could u please let me  know the solution how  to add 

      * Add a Section of time axis

      CALL FUNCTION 'BARC_ADD_SECTION'

          EXPORTING

            size  = 100

            start = '01.01.2012;'

            unit  = '5'

          IMPORTING

            id    = section.

      it wont  work for that case... any idea???