cancel
Showing results for 
Search instead for 
Did you mean: 

EXPLAIN LEAD SELECTION WITH AN EXAMPLE? WHY IT IS IMPORTANT?

Former Member
0 Kudos

HI ALL,

please explian me lead selection with an example? what is the significance of lead selection?

Accepted Solutions (1)

Accepted Solutions (1)

russell_day2
Participant
0 Kudos

This is something that is not well explained anywhere, and it probably won't be well explained by me, either, but maybe when the clever people finish correcting me, we will have a good story.

Lead selection is a mechanism that WDA uses to define a default row in a multi-element (e.g. table) node in the context.

For example, lets say you display a list of flights in a table in WDA.

You put them into an internal table and bind them to a context node.

If the user selects one (by clicking the button beside the row of the table) then your program would like to know which row was selected. You could loop over the whole table looking for some indicator, but that is tedious and time consuming.

Because of the lead selection mechanism, you can call GET_STATIC_ATTRIBUTES which gets the values for a single row of the table. Which row? Well, the row selected by the user, which is called the lead selection. I think it is called 'lead selection' because if you select a range of rows, then the first or leading row is set as the lead selection and that is the one you will get if you ask for a single row.

Of course, nodes don't have rows, they have elements, but if you promise not to say it out loud, you can think of them as rows.

So lead selection is all about providing easy access to the selected element of a multi-element node If you ask the table for just one row, it will give you the selected row.

With lead selection, asking a table for one row without saying which one would probably be an error, but with lead selection, it makes sense. There are many node functions that work on a element that use lead selection to choose the element when you call them for a node with cardinality > 1.

There are a bunch of methods in IF_WD_CONTEXT_NODE that allow you to set and get the lead selection, and use it to do various things. This is useful, because with a big list of data, the thing you are probably interested in is the one the user has clicked.

For example you can write a program that displays spfli and a button that calls lr_node->GET_STATIC_ATTRIBUTES and displays the selected row's carrid and connid in a message. You can then select a row of the table and your button will always know which one you have chosen. It might be psychic, but it is probably really lead selection at work.

Or you can have an input field where you enter a row number and click a button. If you call

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

. lr_element = lr_node->get_element( index i ).

. lr_element->set_lead_selection( )

in the button action method you will see the button for that row suck into the screen as if you had clicked it.

I hope this does more good than harm.

Edited by: Russell Day on Feb 16, 2008 1:47 PM

Answers (2)

Answers (2)

thomas_szcs
Active Contributor
0 Kudos

Hello Vikram,

this [blog|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4001] [original link is broken] [original link is broken] [original link is broken]; of mine tries to explain it.

Best regards,

Thomas

Former Member
0 Kudos

hi vikram......

check this link:

[link|http://help.sap.com/saphelp_erp2005/helpdata/en/7a/787e40417c6d1de10000000a1550b0/content.htm]

---regards,

alex b justin