cancel
Showing results for 
Search instead for 
Did you mean: 

How to get selected value from a Table?

Former Member
0 Kudos

Dear Friends,

when i select a value form the table i want that value to be passed to controller for deleting that record,

please help in understaning what code must i write for the same?

the "Zpms_Master_Input.Output.It_P9001.Employee_Code" is the first field which i want to capture in some context or temp. variable to pass it on to controller for further porcessing.

please give a sample code on how do i catch this employee code value and use it for my processing.

Regards,

Jack

Edited by: Jack on Dec 6, 2011 11:20 AM

Accepted Solutions (0)

Answers (4)

Answers (4)

satish_kumar106
Explorer
0 Kudos

Hi Jack,

You probably missed the step where u add dependency of the controller to the view .

Goto properties of the viewcontroller & add the required controllers.

And code would be as below:

size=wdContext.node.size();

for(int j=0;j<size;j++)

{

wdContext.node().removeElement(wdContext.node().getElementAt(j));

j--;

size--;

}

Regards,

Satish S.

Former Member
0 Kudos

The above reply is for Webdynpro Java

Regards ,

Sana

Former Member
0 Kudos

Hi,

-you can create an attribute in the controller,

-then go to the view and select the attribute (ex: Name)and right click ... and select edit context mapping : bind this attribute to the controller attribute.

- in the coontroller , suppose you have a method created as delete()

- in that method just write : wdContext.currentNameElement() , it will give u the current lead selection on the table.

Hope that will help

Sana

Former Member
0 Kudos

Hi currently the data is at "Zpms_Master_Input.Output.It_P9001.Employee_Code"

i want to use this "Employee_Code" value .

i tried creating a attribute at the view ctx_emp now when i try to map it to controller it does not allow.

i think we need to create a context at a contorller and then bind it to view right? iam confused?

please expalin again with clear example.

Vijay my client doenst want to put etc checkbox , please give any simple idea.

Former Member
0 Kudos

HI Jack,

If I understand correctly, you want to capture one field from the selected row.

In that case you can you the following code,

<your variable> = wdContext.current<tableNodeElement>.get<fieldname> ;

Once its stored in the variable, you can do anything you want with it.

Sattam.

Edited by: Sattam Kumar Datta on Dec 6, 2011 6:17 PM

Former Member
0 Kudos

Hi Kumar you have perfectly understood my requirement .... i tried coding as per your suggestion but not able to get through ...it seems with little help i would make it... the code i am writing here is as follows.

input.setMode("DEL" );

P9009 inputParaABC = new P9009();

//inputParaABC.setEmployee_Code("2134"); ---> when i pass a hard coded employee code value i am able to delete

//<your variable> = wdContext.current<tableNodeElement>.get<fieldname> ; --> your suggestion

inputParaABC.setEmployee_Code(wdContext.currentIt_P9009Element().getEmployee_Code());

--> Here as per your suggestion i am not getting a <tableNodeElement> prompt by the system, it only gives

--> wdContext.currentIt_P9009Element() or .createOutputElement etc but no tableNode

the above code i have wriiten on the Controller where in am executing the RFC, how do we adjust the TableNodeElement thing in my code??

Please help.

Former Member
0 Kudos

Map the table node to the required controller.

Regards,

Mahesh

vijay_kumar49
Active Contributor
0 Kudos

Hi,

I will give Small Hit. Please follow that

1.Right now that Data is available in Table. So do one think create one Value Attribute(checkbox) data type is Boolean. You can add this attribute in your table. So now every row having check box right.

2. now you can put condition in BAPI execution method.


If(wdContect.currentContectElement.setCheckbook(true))
{
You can deleting that record
}
else
{
When click on Delete Button: Please Select Check Box
}

Best Regards

Vijay K