cancel
Showing results for 
Search instead for 
Did you mean: 

Add new static attribute

0 Kudos

Hi All,

I'm having an issue about adding static attributes to a newly defined context node.

how is this possible ? (adding them with add_attribute will make them dynamic, which gives me problems later on)

As it is now i having some sucess with defining the node as follows:

rootnode_info->add_new_child_node( name = tablename is_static = abap_true STATIC_ELEMENT_TYPE = iobj_tab_name ).

where the element type is a structure in the DDIC.

The problem is that if I add adition attributes to this node they become dynamic, and since I don't have a DDIC type containing all my desired attributes, I can't use this approach.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

For the static node or root node do you want to add attributes dynamically or statitcally...

rootnode_info->add_new_child_node( name = tablename is_static = abap_true STATIC_ELEMENT_TYPE = iobj_tab_name ).

The above statement is for adding a node under the root node....

Regards,

Lekha.

Edited by: Lekha on Nov 4, 2009 5:34 PM

0 Kudos

I want to add static attributes to the node... but I want to add them from a method, not by adding them to the node in the context tab of the webDynpro workbench.

Former Member
0 Kudos

Hi,

I guess you already have some node(EMP) under the Root node. Using the code wizard try to get the refernece of this.

ans also the node info for this node not for the root node..

Now using this nodeinfo you can use the methof ADD_ATTRIBUTE method....

DATA:

lo_node type ref to if_wd_context_node,

lo_info type ref to if_wD_context_node_info.

ls_attr type WDR_CONTEXT_ATTRIBUTE_INFO.

lo_node = wd_context->get_child_node( name = 'EMP' ).

lo_node is not initial.

lo_info = lo_node->get_node_info( ).

endif.

*fill tle Ls_attr structure

if lo_info is not initial.

lo_info->ADD_ATTRIBUTE(

exporting

attribute_info = ls_attr.

endif.

Regards,

Lekha.

Edited by: Lekha on Nov 4, 2009 5:43 PM

0 Kudos

As I wrote in the question - adding them with add_attribute will make them dynamic and not static

Former Member
0 Kudos

Try to use this IS_STATIC of that structure as X

0 Kudos

Doesn't help

Former Member
0 Kudos

HI,

Try to pass space and check it out...

It should work...

Regards,

Lekha.

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You can add dynamic attribute in following way:

DATA lo_nd_info_root TYPE REF TO if_wd_context_node_info.

DATA lo_nd_info_flights TYPE REF TO if_wd_context_node_info.

DATA ls_atribute TYPE wdr_context_attribute_info.

*GET META DATA OF THE ROOT CONTEXT NODE

lo_nd_info_root = wd_context->get_node_info( ).

*CREATE A NODE WITH NAME FLIGHTS

lo_nd_info_root->add_new_child_node( u2026u2026.).

*define attribute CARRID

Ls_attribute-NAME = 'CARRID'.

Ls_attribute-TYPE_NAME = 'S_CARR_ID'.

LS_ATTRIBUTE-VALUE_HELP_MODE = '0'.

lo_nd_info_flights->ADD_ATTRIBUTE(ATTRIBUTE_INFO = LS_ATTRIBUTE ).

Regards,

Priya

Former Member
0 Kudos

Hi,

Check in debugging or paste your code..

Regards,

Lekha.

0 Kudos

I don't want to add a dynamic attribute - as I wrote, I want to add a STATIC one.

Former Member
0 Kudos

Hi,

Yes i got your requirement.....IS_STATIC is X means it is static i guess....have you passed the same to the structure..

One you do this....It means that you donot see it in the context node..but internally it is statitc..

Use the HAS_ATTRIBUTE method of if_wd_context_node....

if that attribute is geting created then use the GET_ATTRIBUTE of if_wd_context_node_info and check the properties....

Regards,

Lekha.

0 Kudos

'X' or ' ' or even ABAP_TRUE... doesn't seem to do any difference... in the end the Node still have static attributes, and 1 (or however many I make) dynamic attributes.

I event tried changing the IS_STATIC attribute at runtime (in the debugger) - didn't help either.

Note that with the STATIC_ELEMENT_TYPE = iobj_tab_name line I will get some static attributes, but only the ones in the structure, all attributes added afterwards will be dynamic

0 Kudos

The STATIC reply was for Priya

Former Member
0 Kudos

Hi,

the above method is used for adding a node to the root context or some existing node right...ADD_NEW_CHILD_NODE

Regards,

Lekha.

0 Kudos

yes - and if you set the STATIC_ELEMENT_TYPE to a structure in the DDIC the node it creates has static attributes matching the fields of that strcuture.

My problem is though, that I want to add more (since no DDIC structure exists to meet my requirements) attributes... but these cannot (it seems) become static.