cancel
Showing results for 
Search instead for 
Did you mean: 

Select Webdynpro ALV dynamically

former_member187651
Active Participant
0 Kudos

Hello Experts,

I have created an ALV in webdynpro application. This ALV contains the list of projects.  User can select any project --> Navigate to Edit View for particular project. When user comes back.... that project should be selected as left before.

This functionality is working fine, when user works with standard view(ALV) without any modification on GUI level like sorting in ALV settings.

But when user makes any modification on GUI level basically sorting with any column, selection of last changed row (projectid) do not works.

What I have done:

when user comes back to the ALV screen, I make a loop on ITAB which fills the data to the Node of ALV.  Get the index value for the last selected project and write the code below:

LOOP AT lt_prolist INTO ls_prolist.                         "contains list of projects to display
   IF ls_prolist-projectid =  projectid.                        "last selected project for edit
        CALL METHOD lo_nd_prolist->clear_selection.  "clears the selection
   lo_nd_prolist->set_lead_selection_index( sy-tabix ).   "select the row with index

   ENDIF.

ENDLOOP.

Does any one knows that why I am getting this issue? User can have any no of view created for them. My  requirement is just that, what ever the configuration done on GUI level by the user in the ALV settings, the Last project should be selected..

Please let me know what should I do...

Thanks

Chandan

Accepted Solutions (0)

Answers (3)

Answers (3)

alex_campbell
Contributor
0 Kudos

As with all forum posts, when you say "it does not work" it would be helpful for you to be more specific about what bad result you are getting. Is an incorrect row selected? Is no row selected? Are you getting an exception? Is the entire database deleted and the app server has caught fire ?

former_member187651
Active Participant
0 Kudos

Hello Alex,

My scenario is:

I have one ALV in webdynpro having list of projects. Now user can select any project for change.

Select the project and move to the next view, changes the required detail and comes back.

When user comes back to the ALV list view, the project x that was changed should be selected.

I have used a method to select the row with index. set_lead_selection_index( sy-tabix ).


It is even working fine when no Sorting is done on ALV, but as we do sorting on ALV selection gone.

I have gone through one post, where it was described that ALv invalidate the node when sorting is done by it and clears all the index.

Now my question is, how can I select the row when user comes back???

thanks..

former_member187651
Active Participant
0 Kudos

Dear all,

Problem resolved by own..

With searching on SDN I have found that there is limitation with Webdynpro ALV with sorting. \

When we sort on ALV column, Control is taken by ALV completely after getting out from calling Component. ALV invalidates the context and and update it again.

While Invalidating the node: selection of index is gone.

I have use one alternate to call the Refresh method of SALV_WD_TABLE.

and then make the index selection from my code..

Closing thread.. Thanks to all...

former_member187651
Active Participant
0 Kudos

Hello Experts...

Please let me help on it. Is there any solution for it.

I just want to select the ALV row dynamically in Webdynpro depending on some business logic.

former_member184958
Active Participant
0 Kudos

Hi,

As per my understand,

Using describe table find the total record of internal table. Then set the lead selection for that variable total.

Regards,

John

former_member187651
Active Participant
0 Kudos

Hello John,

You did not understand my question I think. My problem is when user modifies the Views from standard to custom for ALV, Set lead selection index not working for the index I am passing.

Is there any way that do not depend upon this custom view of ALV. Last selected project should be always selected....

Thanks..