This website is not affiliated with, sponsored by, or approved by SAP AG.

Buisness graphics dynamic PIE chart event id

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Buisness graphics dynamic PIE chart event id

Postby ak1979 » Wed Jul 23, 2014 9:11 am

HI all,

I'm trying to create dynamic PIE chart :

Link to sdn document

First I declared in the context node a table ( 0…n )

PIE – 0…N with attributes :

Categorty – type string

Series – type i

Then I'm creating the business graphics :

Code: Select all
DATA:lr_graph TYPE REF TO cl_wd_business_graphics,

lr_cat TYPE REF TO cl_wd_category,

lr_series TYPE REF TO cl_wd_simple_series,

lr_container TYPE REF TO cl_wd_uielement_container,

lr_flow TYPE REF TO cl_wd_flow_data.

lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_graph = cl_wd_business_graphics=>new_business_graphics(

bind_series_source = 'NODE_DYN'

chart_type = cl_wd_business_graphics=>e_chart_type-pie

height = 340

width = 750

id = 'GRAPH' ).

lr_flow = cl_wd_flow_data=>new_flow_data( element = lr_graph ).

lr_container->add_child( lr_graph ) .

wd_this->value_cs ?= lr_graph.

wd_this->mr_view ?= view.

Now I'm creating the category and series :

Code: Select all
wd_this->value_cs =? Lr_graph

wd_this->mr_view ?= view.

Series :

Code: Select all
DATA: lr_bgr_ss TYPE REF TO cl_wd_simple_series.

lr_bgr_ss = cl_wd_simple_series=>new_simple_series(

bind_value = ‘NODE_DYN.SERIES’

label = ‘Series_1’

event_id = ‘Series_1’

id       = ‘Series_1’

view = wd_this->mr_view ).

Wd_this->value_cs->add_series( lr_bgr_ss ).

Category :

Code: Select all
DATA: lr_bgr_cs TYPE REF TO cl_wd_category.

lr_bgr_cs = cl_wd_category=>new_category(

view = wd_this->mr_view

event_id = ‘Series_1’

id       = ‘Series_1’

bind_description = 'NODE_DYN.CATEGORY').

wd_this->value_cs->set_category( lr_bgr_cs ).

Now I'm binding the data :

Code: Select all
Data : ls_pie type wd_this->element_pie.

Data : lt_pie type table of element_pie.

ls_pie-category = 'test_category1'.

ls_pie-series = '34'.

Append ls_pie to lt_pie.

ls_pie-category = 'test_category2'.

ls_pie-series = '73'.

Append ls_pie to lt_pie.

Data : lo_nd_pie type ref to if_Wd_context_node.

Data : lo_el_pie type ref to if_wd_context_element.

Lo_nd_pie = wd_context->get_child_node(

Name = wd_this-> wdctx_pie.

The above is the only way that I succeeded to create 2 categories for the pie chart but I cant isolate the event id for every category.

I tried also to create another series with the same id and other event id but still got the same problem.

Please suggest a solution for creating dynamic pie chart with event id for every category or series .


Last edited by Gothmog on Wed Jul 23, 2014 9:22 am, edited 1 time in total.
Reason: fixed code tags
Posts: 1
Joined: Wed Jul 23, 2014 9:01 am

Re: Buisness graphics dynamic PIE chart event id

Postby DrSidewalk » Wed Sep 03, 2014 9:41 am

Silly question, but did you look at the example ABAP programs?. I don't have access at this point in time, but I know these samples exist.
It's always best to see a working example of one, then you can look at the code and hey presto.

Dr Sidewalk
Posts: 180
Joined: Thu May 03, 2012 9:35 am

Return to ABAP

Who is online

Users browsing this forum: No registered users and 12 guests


This website is not affiliated with, sponsored by, or approved by SAP AG.