cancel
Showing results for 
Search instead for 
Did you mean: 

BGR - Dynamic Series

Former Member
0 Kudos

I am trying to create a dinamic BGR following the step by step tutorial from the link.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/000da649-0059-2c10-239e-90208b664...

But It does not active, and the error is the following:

Properties "seriesSource" of element "GRAPH" must be bound .

Does anyone how to solve it?

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hallo Gaston,

Have you followed the instructions exactly as described or you did it on your own.

It is activating for me .

Since you say not activating, seems to me that you have created the BGR on your view and you didnt bind the property as described by the error.

According to the instruction you do not have to do anything in your layout. It is all dynamically created on wddomodifyview.

The Pdf is not really for the beginners as it is not guiding where you should write your code. For example creating dynamic node should happen before the control goes to the wddomodifyview. That can be either in component controller or called in the from doinit method.

Answers (1)

Answers (1)

gill367
Active Contributor
0 Kudos

HI

write the logic for creating the node in the wddoinit method like as shown below.

IN the wddoinit

DATA:
node_info type ref to if_wd_context_node_info,
 struct_type TYPE REF TO cl_abap_structdescr,
 table_type type ref to cl_abap_tabledescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
 comp LIKE LINE OF comp_tab.
comp-name = 'SERIES'.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'CHAR4' ).
 APPEND comp TO comp_tab.
 comp-name = 'CATEGORY'.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'I' ).
 APPEND comp TO comp_tab.
"now this structure contains the required fields
struct_type = cl_abap_structdescr=>create( comp_tab ).
" now the nodeinfo is created only first time
node_info = wd_context->get_node_info( ).
 node_info = node_info->add_new_child_node(
name = 'NODE_DYN'
IS_MANDATORY = ABAP_false
 IS_MULTIPLE = ABAP_true
STATIC_ELEMENT_RTTI = struct_type
 IS_STATIC = ABAP_false ).

then write th rest of the code in the wddomodify which contains creating BG dynamically and binding the seriessource and category.

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.
if first_time eq abap_true.

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-lines
 height = 340
 width = 750
* * BIND_TOOLTIP = 'GRAPH.TT'
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.

endif.


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'
view = wd_this->mr_view ).

DATA: lr_bgr_cs TYPE REF TO cl_wd_category.
lr_bgr_cs = cl_wd_category=>new_category(
 view = wd_this->mr_view
 bind_description = 'NODE_DYN.CATEGORY'
).

wd_this->value_cs->set_category( lr_bgr_cs ).

Code user two attributes also.

create them also

first one is

MR_VIEW of type ref to IF_WD_VIEW

other one is

VALUE_CS of type ref to CL_WD_BUSINESS_GRAPHICS.

thanks

sarbjeet singh

Former Member
0 Kudos

Thanks you very much for the answer. It works.

Just one more question:

I have the series and the categories in internal tables. Do you have any logic to generate dinamic each serie and category?

Thank you in advance.

Regards