cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a subnode and mapping to main node

Former Member
0 Kudos

Hi Guru

I have a node with subnode with no singleton. I'm able to display dropdown (using index) in table (not ALV) using subnode. After the user selects dropdown and enters values in other columns, I have to capture all the values in table including dropdown in background. If I read the node using get_static_attributes_table, I'm able to capture the entire table except dropdown as its populated thru subnode. Please let me kow how can I capture everything in a single shot.

Your help will be appreciated.

David.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

With a ByIndex field in there you won't be able to read everything "in a single shot" - as you say. The ByIndex will store its value via the leadSelection of the subnode. You will need to read the majority of the values from the attributes of the main node and this one via the leadSelection of the sub node.

If you want everything condensed into one node, consider the DropDownByKey instead. It places its selected value key into an attribute.

Former Member
0 Kudos

Hey Thomas,

Thanks for your response. Would be great if you can provide sample code for this.

Thanks,

David.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hey Thomas,

>

> Thanks for your response. Would be great if you can provide sample code for this.

>

> Thanks,

> David.

For what? Reading the subnode by Lead Selection?

For that you just need to get the element set of the parent table. Then loop through this element set and read the subnode for each parent element.

data lr_nd_course_assign type ref to if_wd_context_node.
  data lr_nd_course_ass_att type ref to if_wd_context_node.
  lr_nd_course_assign = wd_context->path_get_node( path = `COURSE_DETAILS.COURSE_ASSIGN` ).
  data lt_assign_elements   type wdr_context_element_set.
  field-symbols: <ls_element>     like line of lt_assign_elements.

 lt_assign_elements = lr_nd_course_assign->get_elements( ).
  loop at lt_assign_elements assigning <ls_element>.
    lr_nd_course_ass_att =  <ls_element>->get_child_node(
        name = wd_this->wdctx_course_ass_att ).
"do your processing on the leadSelection element of the child node now that you have its reference.
  endloop.

Former Member
0 Kudos

Thamas,

Can you please provide me code on how to read node for dropdown by key also.

Thanks,

David.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There is nothing special needed for byKey. The selected key value of the DDLB is placed into the bound attribute. This attribute could be in your parent context node (in fact no need for a child node at all in this case).

Answers (0)