cancel
Showing results for 
Search instead for 
Did you mean: 

getting multiple row data of the table at a time

Former Member
0 Kudos

hi

i have a table where multi selection is possible

now when i multiselect two rows of the

of the table , where there may be 100 row in the

table , i may select that is multi select two rows

i need to get the data of the corresponding rows .

put it in String or any other and set the data to

a structure

can any one help me how can i catch the multiple rows in

a table at a time .

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi

thanks for the response

conditions are ok as

for(int i=0;i<n;i++) n is the size of the node

{

if(wdcontext.nodeTable1.ismultiselect(i))

{

now iam getting the row values in string as

String name =wdcontext.nodetablename.currentcontextelemt.getname();

now this is ok for the first row .

now i need also the second row in to the string or array

as i need to set this row values which i have get

into a structure. which has elements same as table elements.

so what is the procedure as to capture , as i have put

table property Selection Mode to Multi

rows data .

}

i am able to get the single row data for single selection .

any suggestions .

Former Member
0 Kudos

Hi

fetching of records depend upon the value of i.

So for whatever value of i ur condition is true set ur lead select of the node to i.

use below code


if(wdcontext.nodeTable1.ismultiselect(i))
{

wdcontext.nodetablename.setLeadselection(i)
String name =wdcontext.nodetablename.currentcontextelemt.getname();
}

U can use array to hold values.

Regards

Surender Dahiya

Former Member
0 Kudos

hi

thanks for response

int n =wdContext.nodeIt_Car_Data().size();

int n1=wdContext.nodeIt_Carv_Data().size();

int leadSelection=wdContext.nodeIt_Car_Data().getLeadSelection();

int carvLeadSelection=wdContext.nodeIt_Carv_Data().getLeadSelection();

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

{

if(wdContext.nodeIt_Car_Data().isMultiSelected(i))

{

//wdContext.nodeIt_Car_Data().setLeadSelection(i);

Collection col=new ArrayList();

String make =wdContext.nodeIt_Car_Data().currentIt_Car_DataElement().getP_Make();

.....

...........................

......................

similarly there will be some other string values

i have to add it the structure , but i am not able to add the

structure are all the string data has been to the col.

as i need to get the data of the selected rows

col.add(make);

AbstractList lst = new Zlgs_Car_Data.Zlgs_Car_Data_List();

Zlgs_Car_Data carData = new Zlgs_Car_Data();

carData.setP_Body_Type(bodyType);

carData.setP_Fuel_Typ(fuelType);

carData.setP_Trim(trim);

carData.setP_Year(year);

col.add(carData);

now i need to added this abstract list to the RFC

and about selecting the multiple rows in the table

there may 100 or even more rows , so i may select any number of rows , if i select all the rows i need the data of all the rows and set this rows data to the structure .

how can this be solved .

can any one help me ? its very urgent?

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

hi Kishore,

i have implemented this, in that case i have to select multiple row frm table and delete them...for that on toggle of checkbox i have written this code where i m capturing the data for the row in the context and on the action of delete i m deleting data:-

i have decleare global variable like;-

int selectedtableindexes[] = new int[50];

int selectedcount = 0;

array accoring to my need:-

String SequenceNoIndexes[] = new String[50];

String ProjIDIndexes[] = new String[50];

String ModuleTypeIndexes[] = new String[50];

function code on the action of toggle:-

public void onActiongetSelectedRow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActiongetSelectedRow(ServerEvent)

int countselected = wdContext.nodeTable().getLeadSelection();

int temp = countselected + 1;

flag = true;

for (int i = 0; i <= selectedcount; i++) {

if (selectedtableindexes<i> == temp) {

selectedtableindexes<i> = 0;

flag = false;

}

}

if (flag) {

selectedtableindexes[selectedcount++] = ++countselected;

deleteCount = deleteCount + 1;

}else{

deleteCount = deleteCount - 1;

}

for (int j = 0; j < selectedcount; j++) {

if (selectedtableindexes[j] != 0) {

SequenceNoIndexes[j] =

wdContext

.nodeTable()

.getTableElementAt(

(selectedtableindexes[j]) - 1)

.getSequenceNo();

ProjIDIndexes[j] =

wdContext

.nodeTable()

.getTableElementAt(

(selectedtableindexes[j]) - 1)

.getProject_Id();

ModuleTypeIndexes[j] =

wdContext

.nodeTable()

.getTableElementAt(

(selectedtableindexes[j]) - 1)

.getModule_Type();

}

}

//@@end

}

after that imlementaed delete function like that:-

public void onActionDelete(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionDelete(ServerEvent)

wdContext.nodeVnDeleteNode().invalidate();

IPrivateAuthorizationView.IVnDeleteNodeElement deleteNodeElement;

try {

if(deleteCount!=0){

for(int index=0;index<SequenceNoIndexes.length;index++){

deleteNodeElement = wdContext.nodeVnDeleteNode().createVnDeleteNodeElement();

deleteNodeElement.setVaModule_Type(ModuleTypeIndexes[index]);

deleteNodeElement.setVaProj_Id(ProjIDIndexes[index]);

deleteNodeElement.setVaSequenceNo(SequenceNoIndexes[index]);

wdContext.nodeVnDeleteNode().addElement(deleteNodeElement);

}

wdThis.wdGetAuthorizationController().doProcess(2);

wdComponentAPI.getMessageManager().reportSuccess("Records deleted successfully.");

}else{

wdComponentAPI.getMessageManager().reportException("Please select atleast one item.",true);

}

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException("Unalbe to delete the Record. Please contact administrator.",true);

}

wdThis.getRecords();

selectedcount = 0;

RejectedCount = 0;

deleteCount = 0;

flag = true;

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

selectedtableindexes<i> = 0;

selectFlag = 0;

//@@end

}

Hope that may be help you......

Regards,

Deepak