‎2010 Mar 12 1:11 AM
Hi all,
I'm having an issue where my row selection is not being captured. I'm using cl_salv_table and having the codes in SE24. Everything was fine initially when the ALV is displayed. I can somehow select the row for the first time and the row selection is being captured in lt_row. When I click on SAVE (PAI coded in se80), I will call METHOD A (below) which have the code for selecting the line and process something. The issue arise whenever the process is done and the selected row is deleted, selecting another row and clicking SAVE didn't seems to populate lt_row anymore. This is what I don't understand. I construct my ALV in METHOD A, selecting the row & process it in METHOD B & my SAVE button in PAI (SE80).
METHOD A
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = lo_container
container_name = 'CONTAINER'
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = gt_data.
CATCH cx_salv_msg.
ENDTRY.
gr_selection = go_alv->get_selections( ).
gr_selection->set_selection_mode( if_salv_c_selection_mode=>row_column ).
go_alv->display( ).
METHOD B
lt_temp[] = gt_data[].
go_alv->get_metadata( ). --> I can only select the row for the first time after I place this line in. If not, I can't select at all.
lt_row = gr_selection->get_selected_rows( ).
IF lt_row IS NOT INITIAL.
"do something.
ENDIF.
go_alv->set_data(CHANGING t_table = gt_data ).
go_alv->display( ).
PAI (USER_COMMAND)
go_object->METHOD A( ).
Please do help.
‎2010 Mar 12 1:33 AM
Alvin,
I see that you have another post too on a similar issue. It is difficult to see through your logic. I hope you have taken a look at the many DEMO programs provided by SAP. I remember a demo program in ALV GRID that outputs the row number of selected row.
‎2010 Mar 12 1:38 AM
Fred,
Yes, I did look at the sample. I have no problem if I code my program in 1 piece (all via SE80). But now my requirement is to separate the program logic (needs to code in SE24) from the screen logic (SE80). I'm not very familiar with OO s o there might be a link or certain instantiation which I have missed.
‎2010 Mar 12 2:15 AM
I am sorry if I am stating the obvious, I hope you have defined local classes to handle the alv changes, and used set handler <.....->handle_data_changed> for the alv.
‎2010 Mar 12 2:19 AM
Hi Fred,
I'm using the new object model cl_salv_table. So, I don't need the event.
‎2010 Mar 12 2:44 AM