cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying detail from selected row in table

steve_coombes
Participant
0 Kudos

Hello,

I am an absolute beginner when it comes to Web Dynpro, and I have a very basic question. I think I could achieve the results I want, but I'm not sure if I would do it in the best way and would welcome some advice.

Requirement

I have created a view with a PERNR field. When the user enters a value and clicks on a button a function module is called to retrieve absence records for the employee. The table of absences if bound to a table in the view and the results are displayed.

Now I would like to allow the user to select a row and for the details to be displayed in a collection of input fields in the same view.

I have enabled lead selection on the table but disabled initial lead selection. I have implemented an onLeadSelect method. I can get data from the selected row by navigating through the context nodes to the row element and getting attribute values.

Problem

My question is, how to populate the input fields with the values from the table? I thought that I would create a new context node with the same attributes as the table row and bind this to the input fields. Then I would populate the new node attributes and the values should appear on the screen.

But there is no data in the attributes when the screen loads and so it errors.

If this is the correct approach, what would be the best way to populate the attributes? Do I have to populate each one individually or can I just get the structure from the selected table row and set all the attributes in one.

Or should I approach this in an entirely different way.

Kind regards

Steve

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

if both you taband populatig data have same structure trhen just getting lead selected row data and binding with populating node will set all attribute.

steps you have to do.

1. on leadselect event of table create a method .

    in this method get select attribute by using method of interface if_wd_context_element

    get_static_attribute.

2. bind it with node which is bind with your populating data.

    by using method of interface if_wd_context_node

   bind_structure.

reward point if helpful

steve_coombes
Participant
0 Kudos

Hello Jitendra

Many thanks for your answer.

That works just as you said (and it took a lot less code than I had anticipated).

Kind regards

Steve

Answers (0)