cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind chart type at run time

Former Member
0 Kudos

Hi,

I want to select chart type at run time using a drop down , i know the class name (CL_WD_BUSINESS_GRAPHICS) which

has to be bind. but iam unable to bind the class.

can any one help me.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi harish

this is the coding


data
       bg type ref to cl_wd_business_graphics.

CALL METHOD CL_WD_BUSINESS_GRAPHICS=>NEW_BUSINESS_GRAPHICS
  EXPORTING
     CHART_TYPE           = E_CHART_TYPE-COLUMNS
     ID                             = <name>
    MAP_SOURCE           = 
    VIEW                 = <view name- type if_wd_view>
  RECEIVING
    CONTROL              = bg
    .

---regards,

alex b justin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

**... check view exists

  • check me->if_salv_wd_view~r_view is bound.

*... get wd root uie for adding graphic control uie

data:

lr_wd_root type ref to cl_wd_transparent_container.

lr_wd_root ?= me->if_salv_wd_view~r_view->get_element( if_salv_wd_comp_table_ui=>c_uie_root ).

check lr_wd_root is bound.

*... use a group container

data:

lr_wd_group type ref to cl_wd_group.

lr_wd_group ?= me->if_salv_wd_view~r_view->get_element( if_salv_wd_comp_table_ui=>c_uie_graphic_container ).

*... if wd uie group container does not exist create group container

if lr_wd_group is not bound.

lr_wd_group = me->if_salv_wd_comp_table_ui~create_graphic_container( ).

endif.

*... get wd uie graphic

value ?= me->if_salv_wd_view~r_view->get_element( if_salv_wd_comp_table_ui=>c_uie_graphic ).

*... if wd uie graphic does not exist create graphic

if value is not bound.

data:

l_source_category type string,

l_source_series type string,

l_source_point type string.

concatenate if_salv_wd_comp_table_data=>c_name_node_graphic '.'

if_salv_wd_comp_table_data=>c_name_node_graphic_category

into l_source_category.

concatenate if_salv_wd_comp_table_data=>c_name_node_graphic '.'

if_salv_wd_comp_table_data=>c_name_node_graphic_series

into l_source_series.

concatenate if_salv_wd_comp_table_data=>c_name_node_graphic '.'

if_salv_wd_comp_table_data=>c_name_node_graphic_series '.'

if_salv_wd_comp_table_data=>c_name_node_graphic_point

into l_source_point.

value = cl_wd_business_graphics=>new_business_graphics(

view = me->if_salv_wd_view~r_view

id = if_salv_wd_comp_table_ui=>c_uie_graphic

bind_category_source = l_source_category

bind_series_source = l_source_series ).

data:

l_bind_value type string.

data:

lr_wd_category type ref to cl_wd_category.

concatenate l_source_category '.' 'LABEL' into l_bind_value.

lr_wd_category = cl_wd_category=>new_category(

view = me->if_salv_wd_view~r_view

bind_description = l_bind_value

bind_tooltip = l_bind_value ).

value->set_category( lr_wd_category ).

data:

lr_wd_series type ref to cl_wd_series.

concatenate l_source_series '.' 'LABEL' into l_bind_value.

lr_wd_series = cl_wd_series=>new_series(

view = me->if_salv_wd_view~r_view

bind_point_source = l_source_point

bind_label = l_bind_value

bind_tooltip = l_bind_value ).

value->add_series( lr_wd_series ).

data:

lr_wd_point type ref to cl_wd_point.

concatenate l_source_point '.' 'LABEL' into l_bind_value.

lr_wd_point = cl_wd_point=>new_point(

view = me->if_salv_wd_view~r_view

bind_value_source = l_source_point

bind_label = l_bind_value

bind_tooltip = l_bind_value ).

lr_wd_series->set_point( lr_wd_point ).

data:

lr_wd_value type ref to cl_wd_numeric_value.

concatenate l_source_point '.' 'VALUE' into l_bind_value.

lr_wd_value = cl_wd_numeric_value=>new_numeric_value(

view = me->if_salv_wd_view~r_view

bind_value = l_bind_value ).

lr_wd_point->add_value( lr_wd_value ).

me->if_salv_wd_comp_table_ui~add_child_to_container(

r_container = lr_wd_group

r_child = value ).

endif.

Former Member
0 Kudos

Hi harrish,

You can't bind the class with your drop down box.

First create one Dropdown box with different chart types.

Then based on chart type using Dynamic programming you can create your chart.

Thanks.