07-14-2010 11:26 AM
Hello Guys,
I would required to get the selected rows in ALV grid using method:GET_SELECTED_ROWS.
How to get it resolve this issue.
Thank&Regards,
Rpn.Reddy
07-14-2010 11:52 AM
07-14-2010 12:07 PM
Hi,
I have written the below logic to get the selected rows in the ALV grid but its giving dump.
ATA: i_rowindex TYPE lvc_t_row.
data:gv_alvgrid2 TYPE REF TO cl_gui_alv_grid.
CALL METHOD gv_alvgrid2->get_selected_rows
IMPORTING
et_index_rows = i_rowindex.
Any idea on this?
Regards,
Rpn
07-14-2010 12:13 PM
Hi,
what dump it is giving ? and are u using reuse_alv FM to display alv ?
07-14-2010 12:17 PM
Hi,
I am getting the following dump:OBJECTS_OBJREF_NOT_ASSIGNEDu201D.
Yes I am using this FM:'REUSE_ALV_GRID_DISPLAY' to display the ALV report.
Regards,
Rpn
07-14-2010 12:24 PM
Hi,
then the get_selected row will not work .. Exactly what u want to do ? do u want the selected row in user command event ?
then u will get the tabindex of the line selected as shown below
FORM ucom USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
IF rs_selfield-fieldname = 'D07'. --> this will give the field name
READ TABLE it_day INDEX rs_selfield-tabindex. ---> this will give the selected row
endif.
endformucom.
07-14-2010 12:22 PM
There are, no doubt, hundreds of posts regarding use of ALV. Please search the forum.
There is also SAP Documentation on ALV, but classic and OO, and should you develop an interest in using current technology in SAP, there is a wealth of information on NetWeaver ALV (aka SALV).
There are also a large number of programs available for review, named like BCALV*. For instance, look at BCALV_GRID_08 for user command handling.
07-14-2010 12:32 PM
Hi,
Yes ,I wanted the selected rows in the user-command event.user may select one or multiple rows in report.
Reagrds,
Rpn
07-14-2010 12:43 PM
Hi to all.
I think you have a field indicated as checkbox (field LAYOUT-BOX_FIELDNAME).
If you haven't determinated, it cannot be multiple choices, so on Selected field of user command form (field SLIS_SELFIELD-TABINDEX).
If you have determinated it, is needed to select all rows of your internal table where the field indicated is marcked.
I think this could help you.
07-14-2010 1:07 PM
Hi,
I have used the check box for each record in the report.Its working correctly when I select the rows for the first time.Once I come back to the screen report and I choose other record in the report,it is not displaying for the second selected record but it still displaying the report for previous selected row only.
My requirement is once we back to the report screen and choose other rows,it should display the report only for the selected rows,it should not display for the previous selected row.
Any idea on this?
Regards,
Reddy
07-14-2010 1:12 PM
Can you post here the code for User_Command event?
this could help us to find the error.
07-14-2010 1:23 PM
Hi,
Find the below logic which i have written in my program to get the selected rows.
Here IT_RPT is the internal table for the first report screen.
IT_FINAL is the internal table for the second report screen.
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. " new
CLEAR it_rpt.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
Replace table with modifications...
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
DELETE it_rpt WHERE chkbox IS INITIAL.
IF NOT it_rpt[] IS INITIAL.
clear it_final. refresh it_final.
SELECT matnr b_werk b_lager typbz sernr
serge charge lifnr "DV1K942921
FROM v_equi_eqbs_sml
INTO CORRESPONDING FIELDS OF TABLE it_final
FOR ALL ENTRIES IN it_rpt
WHERE matnr = it_rpt1-matnr
AND b_werk = it_rpt1-werks
AND b_lager = it_rpt1-lgort
and lifnr = it_rpt1-lifnr
AND b_lager IN s_lgort "DV1K942921
AND charge IN s_charg.
ENDIF.
Regards,
Rpn
07-15-2010 11:40 AM
01-13-2015 4:53 PM
Free the container instead of using refresh_grid_display
CALL METHOD OBJ_R_CONTAINER->FREE.
CALL METHOD CL_GUI_CFW=>FLUSH.