cancel
Showing results for 
Search instead for 
Did you mean: 

adding dynamic attributes to static context node

former_member210967
Participant
0 Kudos

Hi All,

I have defined a context node LINES with several attributes. This is done staticly during developmenttime.

During run-time node LINES is extended with several attributes dynamicly. See below:

10 HEADER_GUID ->

11 DETAIL_GUID ->

12 EXTERNAL_ID ->

13 OBJECT_TYPE ->

14 IN_OUT_PLAN ->

15 TRAFFIC_LIGHT_1 ->

16 TRAFFIC_LIGHT_2 ->

17 TRAFFIC_LIGHT_3 ->

18 TRAFFIC_LIGHT_4 ->

19 _LOCATION \TYPE=STRING ->

20 _ZZTOPGROUPING \TYPE=STRING ->

21 _STATUS \TYPE=STRING ->

22 _100000200 \TYPE=STRING ->

19..22 are added dynamicly.

I have an internal table that matches de new context. This <fs_tb_tree_new> I want to bind like:

*&- bind table

lr_node->bind_table( new_items = <fs_tb_tree_new>

set_initial_elements = abap_true ).

In <fs_tb_tree_new> the dynamicly added attrbutes contains values e.g. (the static attributes also have values via <fs_tb_tree_new>):

_LOCATION _ZZTOPGROUPING _STATUS _100000200

5 Africa 0002 Reporting Entity 0.000

6 Russia, CIS 0003 Identify 0.000

An ALV presents the values of the attribute. But.... only the values of the static part are presented, not the dynamic attributes added during runtime.

Please advise what I forget or do wrong .

Thanks in advance.

John

Accepted Solutions (0)

Answers (2)

Answers (2)

Madhu2004
Active Contributor
0 Kudos

Hi John,

All you need to do after binding the data to the node is bind the node to the ALV component again using the SET_DATA method of the ALV interface controllr a.

Regards,

Madhu

former_member210967
Participant
0 Kudos

Hi Madhu,

I did that, but it seems not to work for the combination of static and dynamic attributes with ALV being the reason for posting my thread.

John

Madhu2004
Active Contributor
0 Kudos

Hi John,

For static ALV, we map the node containing data to the DATA node of the ALV component.

In your case do not map the node to the DATA node of the ALV component, Instead use the SET_DATA method of the ALV interface contoller and pass the node reference to this method after binding the data to the node.

Regards,

Madhu

former_member210967
Participant
0 Kudos

I solved the issue:

If you use a combination of static attributes added with dynanic attributes (during runtime) for dynamic ALV, I advise to create a new node and bind the values to this new created node:

Cheers, John

wd_this->extend_context( EXPORTING im_struc_descr = lr_cl_abap_structdescr

IMPORTING ex_node = lr_node_alv ).

Method:

*&- Create new dynamic context LINES_DYN

  • Node for alv-table

lr_node_info = wd_context->get_node_info( ).

CALL METHOD lr_node_info->add_new_child_node

EXPORTING

name = 'LINES_NEW'

static_element_rtti = im_struc_descr

is_static = abap_true

is_multiple = abap_true

is_multiple_selection = abap_false

RECEIVING

child_node_info = lr_subnode_info.

  • lr_node = lr_subnode_info->get_parent( ).

lr_node = wd_context->get_child_node( 'LINES_NEW' ).

ex_node = lr_node.

*&- bind table for alv

lr_node_alv->bind_table( new_items = <fs_tb_tree_new>

set_initial_elements = abap_true ).

...

....

former_member210967
Participant
0 Kudos

Solved!

Former Member
0 Kudos

I am not sure if Dynamic attributes are supported in ALV . i THINK IT IS NOT.

former_member210967
Participant
0 Kudos

I managed in earlier stages to setup an ALV dynamicly from a context defined during runtime. So you mean to say that I have to set up my context also complete dynamicly in stead of combined static/dynamic ?

Cheers, John

Edited by: John Maas on Mar 12, 2011 4:19 PM

Former Member
0 Kudos

yes, you can creAte dynamic node with static attributes And that willn work with ALV

former_member450736
Active Participant
0 Kudos

John,

below thread might help you

[;

former_member210967
Participant
0 Kudos

Hi Kranthi

SO I need to copy my combined Node (STatic and dynamicly added attributes) to a new dynamic Node (with add child node) ? Then it certainly must work ?

But is is only for ALV or do we face the same problem if we want to extend an hier. tree e.g. ?

Thanks for your help.

Point we be given.

John

gill367
Active Contributor
0 Kudos

I guess this is a problem with the ALV only.

because we are doing th eexternal mapping here.

and only attirbutes defined statically will be passing the value to the alv component.

thanks

sarbjeet singh

former_member450736
Active Participant
0 Kudos

John,

I am not sure in other cases where it is this case, probably alv is the only one i guess.

thanks,

Kranthi.