cancel
Showing results for 
Search instead for 
Did you mean: 

WDA - Business Graphics - On Click Event

tharaka_fernando
Contributor
0 Kudos

Dear All Gurus,

Is there any method to capture "ON CLICK" event on Business Graphic.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

There is onAction event for Business Graphics, which will get triggered when user selects certain area in business graphics.

Regards,

Kiran

tharaka_fernando
Contributor
0 Kudos

yes..thank you for the reply..

How can I get a sample coding of that? I was searching in the internet but was unable to find...

ex : To read the click event ID, Values

former_member184578
Active Contributor
0 Kudos

Hi,

In the onAction event handler method, you have to create the importing parameter EVENT_ID of type string. Then the clicked event ID will automatically available in EVENT_ID parameter.

Edit: Check the below image for reference:

You can check the standard WDA application WDR_TEST_EVENTS (business graphics) for reference

Hope this helps u,

Regards,

Kiran

former_member217916
Participant
0 Kudos

You need to add Action to the Business graphic event by creating a new onAction <action_name>

Inside the <action_name> handler, you need to read the values from the context.

For example if you have following node structure

Node- Chart

     Attributes - Month, Count

   DATA lo_nd_chart TYPE REF TO if_wd_context_node.

   DATA lo_el_chart TYPE REF TO if_wd_context_element.

   DATA ls_chart TYPE wd_this->element_chart.

* navigate from <CONTEXT> to <CHART> via lead selection

   lo_nd_chart = wd_context->get_child_node( name = wd_this->wdctx_chart ).

* get element via lead selection

   lo_el_chart = lo_nd_chart->get_element( ).

  * get all declared attributes

   lo_el_chart->get_static_attributes(

     IMPORTING

       static_attributes = ls_chart ).

The above code will give the value of the selected column in the ls_chart (structure)

Regards,

Karan

tharaka_fernando
Contributor
0 Kudos

Hi Karan,

Thank you for the reply...

This doesn't give selected column values instead 01st values of the table graphs...

How do I get the values of selected column?

Thank you in advance...

former_member222068
Active Participant
0 Kudos

Hi Tharu,

   DATA lo_nd_chart TYPE REF TO if_wd_context_node.

   DATA lo_el_chart TYPE REF TO if_wd_context_element.

   DATA ls_chart TYPE wd_this->element_chart.

* navigate from <CONTEXT> to <CHART> via lead selection

   lo_nd_chart = wd_context->get_child_node( name = wd_this->wdctx_chart ).

* get element via lead selection

   lo_el_chart = wdevent->get_context_element(  'CONTEXT_ELEMENT' ). " This will return the data

  * get all declared attributes

   lo_el_chart->get_static_attributes(

     IMPORTING

       static_attributes = ls_chart ).

Hope this will help you

Thanks & Regards,

Sankar Gelivi

former_member184578
Active Contributor
0 Kudos

Hi,

I hope you have created the context node like below and bind the data source of business graphics to that Context node

Now, in onAction, when you read the context, you will get the selected column values

DATA lo_nd_series TYPE REF TO if_wd_context_node.
   DATA lo_el_series TYPE REF TO if_wd_context_element.
   DATA ls_series TYPE wd_this->element_series.

*  navigate from <CONTEXT> to <SERIES> via lead selection
   lo_nd_series = wd_context->get_child_node( name = wd_this->wdctx_series ).

   lo_el_series = lo_nd_series->get_element( ).
   lo_el_series->get_static_attributes(
     IMPORTING
       static_attributes = ls_series ).  " ls_series will contain the selected column values



Regards,

Kiran

Former Member
0 Kudos

Hi Fernando,

I am facing the same issue as yours. When i try to click on a portion of Business Graphic's, the selection is giving only first record of the node and not the selected record. The value of 'CONTEXT_ELEMENT' is initial under the action method. Did you get an answer to overcome it ?

Thanks in advance..

Former Member
0 Kudos

Hi Kiran,

When i try to click on a portion of Business Graphic's, the code that you gave is giving only first record of the node and not the selected record. The value of 'CONTEXT_ELEMENT' is initial under the action method. Am i missing anything to get the selected record details ?

Thanks in advance..