cancel
Showing results for 
Search instead for 
Did you mean: 

Access Subnode

Former Member
0 Kudos

Hi

I have create a Node TP which has a sub node general with an attribute BU_GROUP.

Plus on the layout I have created a fields of type Drop down by Key and is binded with the field BU_GROUP.

Now I have to set value to this field. I have added the following code, but its restrns with an error message of TAXPAYER.TP.GENERAL Node not found while running.

Code is TYPES : BEGIN OF sty_grp,

bu_group TYPE tb001-bu_group,

END OF sty_grp.

DATA: git_data TYPE STANDARD TABLE OF sty_grp,

gwa_data LIKE LINE OF git_data.

DATA lo_node_info TYPE REF TO if_wd_context_node_info.

DATA value1 TYPE wdy_key_value.

DATA set TYPE wdy_key_value_table.

DATA lo_nd_general TYPE REF TO if_wd_context_node.

DATA lo_el_general TYPE REF TO if_wd_context_element.

DATA ls_general TYPE wd_this->Element_general.

DATA lv_bu_group TYPE wd_this->Element_general-bu_group.

  • navigate from <CONTEXT> to <GENERAL> via lead selection

lo_nd_general = wd_context->path_get_node( path = `TP.GENERAL` ).

  • @TODO handle non existant child

  • IF lo_nd_general IS INITIAL.

  • ENDIF.

  • get element via lead selection

lo_el_general = lo_nd_general->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_general IS INITIAL.

ENDIF.

  • get single attribute

lo_el_general->get_attribute(

EXPORTING

name = `BU_GROUP`

IMPORTING

value = lv_bu_group ).

SELECT bu_group FROM tb001 INto TABLE git_data.

LOOP AT git_data INTO gwa_data.

move gwa_data-bu_group to value1-key.

move gwa_data-bu_group to value1-value.

APPEND value1 to set.

endloop.

lo_nd_general = wd_context->get_child_node( name = 'TP.GENERAL' ).

lo_node_info = lo_nd_general->get_node_info( ).

lo_node_info->SET_ATTRIBUTE_VALUE_SET( name = 'BU_GROUP' value_set = set ).

Please help

Rgrds

Shakti

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi.

U can not access the sub node directly....

use the following code...

  • navigate from <CONTEXT> to <CN_NODE> via lead selection

lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).

  • @TODO handle not set lead selection

IF lo_nd_cn_node IS INITIAL.

ENDIF.

  • navigate from <CN_NODE> to <CN_DROPDOWN1> via lead selection

lo_nd_cn_dropdown1 = lo_nd_cn_node->get_child_node( name = wd_this->wdctx_cn_dropdown1 ).

Former Member
0 Kudos

Hi Pankaj,

i tried wht you suggested and it got failed aagain.

Regards

Shakti

Former Member
0 Kudos

Hi.

what is the cardinality of ur parent node and sub node.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

You seems to have created three nodes but in path only two nodes.

Pls check the same.

Where have you written code.

Write in Supply funciton.