<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Customizing bar chart ( Function Group BARC ) like TCode CM21 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782522#M1585607</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With the example above, the EVENT_DOUBLE_CLICK form should contain some logic to send a new command to the barchart:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM event_double_click .
  DATA: lw_selected_node TYPE bcnvals.

* Check if a box has been clicked in table part
  READ TABLE boxes INDEX 1.
  IF sy-subrc = 0.
    IF boxes-chart_id = gf_chart_1.            "Double-click on chart 1
        abap_cmd = gc_dis_person.
    ELSE.                                      "Double-click on chart 2
        abap_cmd = gc_dis_order.             "Display order master data
    ENDIF.
  ENDIF.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then our form ACTION_AFTER_EVENT will take care of sending a new function code to trigger the desired action... In the case here, display the person signaletic data when a box is double-clicked on the top chart, or the order master data when the bottom chart is double-clicked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM action_after_event .
  DATA: lf_retval TYPE i,
        lf_new_function_code TYPE sy-ucomm.

  CASE abap_cmd(2).
    WHEN 'SL'. lf_new_function_code = abap_cmd.
    WHEN OTHERS. EXIT.
  ENDCASE.

  CHECK abap_cmd IS NOT INITIAL.

  CALL METHOD barchart-&amp;gt;set_function_code
    EXPORTING
      function_code = lf_new_function_code
    IMPORTING
      return        = lf_retval.

  IF lf_retval = 0.
    PERFORM user_command.
  ENDIF.
ENDFORM.                    " ACTION_AFTER_EVENT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 25 Sep 2011 15:43:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-25T15:43:23Z</dc:date>
    <item>
      <title>Customizing bar chart ( Function Group BARC ) like TCode CM21</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782520#M1585605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have copied report BARCOCX1 and want to show a bar chart within a control.&lt;/P&gt;&lt;P&gt;Now I am looking for a solution to trigger an event orPAI after the user makes a &lt;/P&gt;&lt;P&gt;double-click on a box in the chart area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´ve tried to debug transaction CM21 but I didn´t find the necessary settings / customizing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help? Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 13:20:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782520#M1585605</guid>
      <dc:creator>o_seifer</dc:creator>
      <dc:date>2011-03-23T13:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing bar chart ( Function Group BARC ) like TCode CM21</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782521#M1585606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better later then never &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reacting to event can be a little be tricky for a barchart object as you have to code everything by yourself. Your PAI module should be something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
MODULE pai INPUT.
  save_ok_code = ok_code.
  CLEAR ok_code.

  CASE save_ok_code.
    WHEN 'EXIT' OR 'QUIT' OR 'BACK'.
      PERFORM end_300.                                   "Free controls
    WHEN OTHERS.
      IF save_ok_code(4) = sgrc_const-event               "Event '%_GC'
      OR save_ok_code(4) = sgrc_const-shell_event.  "Shell-Event '%_GS'
*------ Handle Barchart events
        PERFORM user_command.
        PERFORM action_after_event.
      ELSE.                                              "Function code
*------ Send function code to graphic (transfer graph_cmd)
        CALL METHOD barchart-&amp;gt;set_function_code
          EXPORTING
            function_code = save_ok_code
          IMPORTING
            return        = gf_retval.
        IF gf_retval = 0.
          PERFORM user_command.                           "User command
        ELSE.
*-------- Function code cannot be directly transferred (Zoom in, ...)
          stat = sgrc_const-stat_4.                     "Wait for input
        ENDIF.
      ENDIF.
  ENDCASE.
ENDMODULE.                             " USER_COMMAND_0300  INPUT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then In your user command form you have to call the method &lt;EM&gt;graphic_pai&lt;/EM&gt; of your barchart object. It will update the boxes/nodes attributes tables and return a graph command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM user_command.
"..
* Analyze data returned by the graphic (PAI)
  CALL METHOD barchart-&amp;gt;graphic_pai
    IMPORTING
      graph_cmd      = graph_cmd
      graph_cmd_info = graph_cmd_info
      gr_sel_field   = gr_sel_field
      layer_type     = layer_kind
      settings       = gw_settings
      symboltype     = symboltype
    CHANGING
      charts         = gt_charts[]
      boxes          = boxes[]
      box_vals       = box_vals[]
      deletions      = deletions[]
      links          = links[]
      link_vals      = link_vals[]
      nodes          = nodes[]
      node_vals      = node_vals[]
      positions      = positions[].
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after that, process the graph command returned in GRAPH_CMD parameter and call function BARC_LOGIC to update again the internal tables for boxes, nodes, ..:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 CLEAR: abap_cmd, status_text.
  stat = sgrc_const-stat_4.                             "Wait for input

* Process graph commands ------------------------------------ &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
  CASE graph_cmd.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
    WHEN bc_const-ask_for_insert.             "Box/node/layer Insertion
      PERFORM ask_for_insert.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
    WHEN bc_const-ask_for_modify.          "Box/node/layer modification
      PERFORM ask_for_modify.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
    WHEN bc_const-double_click.                           "Double-click
      PERFORM event_double_click.
"...
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
    WHEN gc_dis_person.                     "Display person master data
      PERFORM display_master_data.
  ENDCASE.                                              "case GRAPH_CMD
*&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; ------------------------------------------------------------

* Actualise charts tables
  CHECK graph_cmd IS NOT INITIAL.
  CALL FUNCTION 'BARC_LOGIC'
    EXPORTING
      graph_cmd     = graph_cmd
    TABLES
      all_boxes     = gt_all_boxes
      all_box_vals  = gt_all_box_vals
      all_links     = gt_all_links
      all_link_vals = gt_all_link_vals
      all_nodes     = gt_all_nodes
      all_node_vals = gt_all_node_vals
      all_positions = gt_all_positions
      boxes         = boxes
      box_vals      = box_vals
      deletions     = deletions
      links         = links
      link_vals     = link_vals
      nodes         = nodes
      node_vals     = node_vals
      positions     = positions.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The constants used above are defined in include LBARCCON.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 15:07:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782521#M1585606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-25T15:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing bar chart ( Function Group BARC ) like TCode CM21</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782522#M1585607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With the example above, the EVENT_DOUBLE_CLICK form should contain some logic to send a new command to the barchart:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM event_double_click .
  DATA: lw_selected_node TYPE bcnvals.

* Check if a box has been clicked in table part
  READ TABLE boxes INDEX 1.
  IF sy-subrc = 0.
    IF boxes-chart_id = gf_chart_1.            "Double-click on chart 1
        abap_cmd = gc_dis_person.
    ELSE.                                      "Double-click on chart 2
        abap_cmd = gc_dis_order.             "Display order master data
    ENDIF.
  ENDIF.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then our form ACTION_AFTER_EVENT will take care of sending a new function code to trigger the desired action... In the case here, display the person signaletic data when a box is double-clicked on the top chart, or the order master data when the bottom chart is double-clicked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM action_after_event .
  DATA: lf_retval TYPE i,
        lf_new_function_code TYPE sy-ucomm.

  CASE abap_cmd(2).
    WHEN 'SL'. lf_new_function_code = abap_cmd.
    WHEN OTHERS. EXIT.
  ENDCASE.

  CHECK abap_cmd IS NOT INITIAL.

  CALL METHOD barchart-&amp;gt;set_function_code
    EXPORTING
      function_code = lf_new_function_code
    IMPORTING
      return        = lf_retval.

  IF lf_retval = 0.
    PERFORM user_command.
  ENDIF.
ENDFORM.                    " ACTION_AFTER_EVENT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Sep 2011 15:43:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/customizing-bar-chart-function-group-barc-like-tcode-cm21/m-p/7782522#M1585607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-25T15:43:23Z</dc:date>
    </item>
  </channel>
</rss>

