cancel
Showing results for 
Search instead for 
Did you mean: 

Reg Selection of Multiple Rows in a Table

jnmurthi
Participant
0 Kudos

Hi all,

I have to select multiple rows from a table and have to display those selected records in another table in the next screen.

The problem is, when I am selecting the records in a table, selection should not be allowed on some records based on a condition. Is it possible with the default selection mode of webdynpro. If so, Please tell me how can we disable the selection of certain records in a table(using the default selection mode provided by webdynpro)

Else, if we have to use check boxes for selection(in case of my problem), please do help me out in how to disable the selection of certain records in a table(using check boxes for selection).

Please help me out. Its urgent...

Reward points guranteed.

Regards,

Murthy.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

The requirement is not possible with default table selection mode.

And also for multiple record selection in a table the <b>selection property of table node</b> should be set to 0..n.

Your requirement of not allowing some rows depending on condition should be handled programmatically.

You can use Checkbox and set the checkbox to checked if required or unchecked if not required.

Define a method and associate it with OnToggle event of the CheckBox.

In the method

Get the index of lead selection

int i = wdContext.currentTableNodeElement().getLeadSelection()

// check if the selected node satisfies you condition.If not set the leadselection and checkbox unchecked to false and display a message

wdContetxt.currentTableNodElement().setLeadSelection

(fasle);

wdContext.currentTableNodeElement.setCheckbox(fasle);

jnmurthi
Participant
0 Kudos

Hi Fahad&Shriram,

Thank you for your response.

I have one more small doubt....I need to select records from a BAPI.

Now that I need to introduce a new column with checkbox, can i add the context attribute of that checkbox to the BAPI node or shall I take another new node for the attribute that needs to be mapped to checkbox.

Or,

Can I take a new node and read all the BAPI node elements into that node and also add the attribute for check box also to that node.

Please suggest me a better way.

Regards,

Murthy.

Former Member
0 Kudos

U can select any one, but I prefer second one because it is more maintainable.

Also if we cant create attributes inside a model node which is having structure binding

Regards

Fahad hamsa

Former Member
0 Kudos

Hi,

Even i feel you should go for the second one.

In that option what you can do is you set the checkbox to readonly while populating the value node depending on your condition.

So when the user selects the record with readonly checekbox you can display a message describing the reason for non selection of the record.

When you will be using the selected record to transfer to another table or as input to BAPI you need to check the status of the checkbox (no need of checking whether the record is selected using leadselecetion method) and then use the records that are checked.

In this case its not necessary for you to set the selection property of the Table node to multiple.Let it be 0..1, so that when ever a user tries to select the non selectable record you can prompt (using confirmation dialog) or display a message using message manager.

Former Member
0 Kudos

HI Narayana,

Multiple selection property is specific to a table, not for a tableElment(ie. for a row), so u cant set some of the rows as multi selected and some as node

U can use Checkbox for this purpose. Based on the condition u can make the check box as enabled and disabled

To achieve this, Create 2 boolean variables inside table node, one for checkbox value(Let it be <b>CBValue</b> .Bind this to checked property of Checkbox) and other for enabling and disabling Checkbox(Let it be <b>CBReadOnly</b>. Bind this to readonly property of CheckBox).

At the time of creation of table elements, as per the condition, u can control the selection as

IPrivate<View>.I<Table>Node tNode=wdContext.node<Table>();

for(int i=0;i<5;i++)

{

IPrivate<View>.I<Table>Element tEl=tNode.create<Table>Element();

tNode.addElement(tEl);

tEl.setCBValue(false);//Unchecking Checkboxes initially

if(condition=non selectable)

{

tEl.setCBReadOnly(true);

}

else

{

tEl.setCBReadOnly(false)

}

}

Regards

Fahad Hamsa