cancel
Showing results for 
Search instead for 
Did you mean: 

Is there anyway to know whether leadselection is set or not??

Former Member
0 Kudos

Hi,

Is there anyway to know whether leadselection is set or not ??

Problem scenario :

I have a table which is bound to a context node containing a database table. Based on condition the table gets populated at runtime. At times there may be no record in the table. At that time wat happens to the leadselection value?? Is there any way to know that the context(which is bound to the table) is empty???

Please help me out!!!

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hi,

the easiest way to find out if the table in your context is populated, or not, is probably to get a count of the rows.

data: lo_node type ref to if_wd_context_node,
        l_number_of_rows type i,
        lo_selected_element type ref to if_wd_context_element.

  lo_node = wd_context->get_child_node( name = wd_this->wdctx_my_node ).

  l_number_of_rows = lo_node->get_element_count( ).

  if l_number_of_rows = 0.
    " nothing populated in context.
  else.
    lo_selected_element = lo_node->get_lead_selection( ).
    if lo_selected_element is not initial.
      " have details of element that has been selected.
    else.
      "nothing selected
    endif.
  endif.

This means you're not passing around large tables of data but mearly looking at references to them.

Hope this helps,

Cheers,

Chris

Answers (2)

Answers (2)

Former Member
0 Kudos

thanks a lot!!!

saket_abhyankar
Active Participant
0 Kudos

Hi,

If I have understood your question correctly, You may proceed as follows:

You can know if lead selection is set or not by checking the lead selection property (check box) of context node.

You can also get the index of lead selection in code using method GET_LEAD_SELECTION_INDEX of interface IF_WD_CONTEXT_NODE.

You can get the table bound to node using method GET_STATIC_ATTRIBUTES_TABLE of interface IF_WD_CONTEXT_ELEMENT. Then check if the table got through this method is initial or not. This way you will come to know if context is empty or not.

Hope this will help you.

Regards,

Saket.