cancel
Showing results for 
Search instead for 
Did you mean: 

Record Deletion in a Table

jnmurthi
Participant
0 Kudos

Hi All,

I am having a problem with deleting records from the table.

I am not using any checkboxes, but using the default selection provided by webdynpro tables. Now, how do I need to select multiple records and delete them. Also, is there any facility delete all records in the table.

Please do help me and gain reward points.

Regards,

Murthy.

Accepted Solutions (0)

Answers (9)

Answers (9)

nitin_mahajan2
Contributor
0 Kudos

i would suggest a different way, thats how i would do it.

While creating the table, assign a key to each row. This would be a kind of index. now on select of that key, you can use the key value to invalidate that particular row using the regular functionality.

will send u the code after trying it. i have used this key feature to check for multiple selection in checkboxes, i believe we can use the same feature for deleting the row.

Regards

Nitin

Former Member
0 Kudos

<b>Hi...

For Deleting All the records without selecting

Try thid code...

wdContext.node<"NodeName">.invalidate();

For Deleting Multiple Selection(ie Only Selected Rows)

Try this Code...

for(int i=wdContext.node<"NodeName">().size()-1;i>=0;i--)
 {
   if(wdContext.node<"NodeName">().isSelected(i))
   {
     wdContext.node<NodeName>().removeElement(wdContext.node<"NodeName">().get<"NodeName">ElementAt(i));
    }
}

Regards

Chandran</b>

former_member751941
Active Contributor
0 Kudos

Hi Narayana,

Take a button(say delete) inside view layout.

Inside the actions of the delete button use this code.

try {

for (int i = wdContext.node<put node name here>().size() -1 ; i >= 0 ; --i)

{

if ((!wdContext.node<put node name here>().isMultiSelected(i))

&& (wdContext.node<put node name here>().getLeadSelection()

!= i)) {

continue;

}

else

{

wdContext. node<put node name here >().removeElement(

wdContext node<put node name here>().get<put node name>ElementAt(i));

}

}

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException(

"NO RECORD TO DELETE",

false);

}

Related Thread :

Regards,

Mithu

Former Member
0 Kudos

Hi,

Go through the tutorial.It implements the functionality of single and multi row deletion.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/developing%20with%20tables%20in%20web%20dynpro.pdf">Working with tables</a>

Former Member
0 Kudos

Hi,

Change the selectionmode property of the Table to 'multi' , then you will be able to select multiple rows. Then delete the multipleselected rows in the table through the corresponding API.

Regards,

Prabhakar.

Former Member
0 Kudos

Hi murthy..

U can do this by using invalidate method..

<i><b>wdContext.node<YOUR_NODE>().invalidate();</b></i>

For more Details..

http://www.sappro.com/downloads/WebDynproJava.pdf

URs GS..

Former Member
0 Kudos

Hi,

For deleting all records, use wdContext.node<TableNode>().invalidate();

Regards

Fahad Hamsa

Former Member
0 Kudos

Hai,

To delete all the record form the table simply

wdcontext.nodeTable().invalidate();

For multiple selection

Make the selection propty of table =multiple

in code

if(wdContext.nodeTable().getTableElement(i).ism,ultiSelected())// true when the row selected

make sure node selection proprty=o..n or 1..n

Regards,

Naga

Former Member
0 Kudos

<b>Hi

You can use Invaildate() function to delete all the records in the table

Use this Code in your application

WdContext.<nodename>.invalidate();

Regards

Chandran</b>