2005 Sep 20 3:06 PM
Hi,
I am working on an interactive ALV list. As per the requirement I have been able to remove the standard delete button through the following technique:
...
...
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append ls_exclude to pt_exclude.
...
It is working fine and the delete button is removed from the tool bar as required. But it is still possible to delete a row by selecting the row and pressing the 'Delete' key in the key board. Can anyone tell be how to stop this. I have already gone through various SDN postings and "An easy reference for ALV grid control.pdf" but could not find any clue.
2005 Sep 20 4:05 PM
Hi Nilay,
set field NO_ROWINS of grid layout structure to 'X'.
Sri
Hi,
I am working on an interactive ALV list. As per the requirement I have been able to remove the standard delete button through the following technique:
...
...
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append ls_exclude to pt_exclude.
...
It is working fine and the delete button is removed from the tool bar as required. But it is still possible to delete a row by selecting the row and pressing the 'Delete' key in the key board. Can anyone tell be how to stop this. I have already gone through various SDN postings and "An easy reference for ALV grid control.pdf" but could not find any clue.
2005 Sep 20 4:05 PM
Hi Nilay,
set field NO_ROWINS of grid layout structure to 'X'.
Sri
2005 Sep 21 9:09 AM
Hi Sri,
Thank you very much for this tip. But I still have the problem as I need to have the 'Create Row' button. When NO_ROWINS is set to 'X', both the 'Create Row' and 'Delete Row' button disappear from the toolbar and I am not able to create new row.
Any solution/work around for this?
Thanks in advance
Nilay
2005 Sep 20 5:07 PM
Another way is:
Declare a field in your itab called CELLTAB with TYPE LVC_T_STYL.
Add this field in your layout structure, field STYLEFNAME.
GS_LAYOUT-STYLEFNAME = 'CELLTAB'.
Loop over your itab and fill the deep itab CELLTAB. Set field celltab-style to CL_GUI_ALV_GRID=>MC_STYLE_NO_DELETE_ROW.
Good luck,
Bert
With this
2005 Sep 21 9:13 AM
For each row in the ALV grid, I filled the deep itab CELLTAB with all the columns that I am using in the grid and set the celltab-style = CL_GUI_ALV_GRID=>MC_STYLE_NO_DELETE_ROW.
It is not working. Am I doing something wrong.
Also I used the tip given by Sri but it takes away both the 'Create' and 'Delete' button. I need the 'Create' button intact with all the functionalities. Any help?
Thanks in advance.
2005 Sep 21 11:15 AM
2005 Sep 22 4:24 PM
Yes Sri, I did try with layout-stylefname = 'STYLE' but still not working. Apart from that I have another issue:
I need to generate a number (last no + 10) in one of the column. How to do that while inserting a new row.
Any help
Nilay
2005 Sep 22 4:28 PM
Hi Nilay,
--->I need to generate a number (last no + 10) in one of the column. How to do that while inserting a new row.
If you are using the standard create button to insert a new row then it is not possible.
You have to exclude the standard create button and add your own button for create row to grid toolbar.
Actually this way you will be able to solve the previous issue also as now you do not require the standard create button.
Hope this helps..
Sri
2005 Sep 22 8:16 PM
Hi,
It should work just fine so let me expand a little more.
STEP 1:
Your datadeclaration should look something like this:
TYPES: BEGIN OF TY_OUTTAB.
INCLUDE STRUCTURE <FILL IN YOUR STRUCTURE>.
TYPES: CELLTAB TYPE LVC_T_STYL.
TYPES: END OF TY_OUTTAB.
TYPES: TT_OUTTAB TYPE TABLE OF TY_OUTTAB.
DATA: GT_OUTTAB TYPE TABLE OF TY_OUTTAB.
DATA: GS_OUTTAB TYPE TY_OUTTAB.
DATA: GS_CELLTAB TYPE LVC_S_STYL.
DATA: GT_CELLTAB TYPE LVC_T_STYL.
DATA: L_INDEX TYPE SY-TABIX.
STEP 2:
Select wat you want to select and then loop over your itab.
LOOP AT GT_OUTTAB INTO GS_OUTTAB.
L_INDEX = SY-TABIX.
REFRESH GT_CELLTAB.
CLEAR GS_CELLTAB.
GS_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_NO_DELETE_ROW.
INSERT GS_CELLTAB INTO TABLE GT_CELLTAB.
INSERT LINES OF GT_CELLTAB INTO TABLE GS_OUTTAB-CELLTAB.
MODIFY GT_OUTTAB FROM GS_OUTTAB INDEX L_INDEX.
ENDLOOP.
STEP 3:
remember to fill GS_LAYOUT-SYLEFNAME = 'CELLTAB'.
Did you do all this ?
Hope it helps.
2005 Sep 22 8:31 PM
Hi,
For you second question you should trigger the event data_changed, then loop over mt_mod_cells and call method modify_cell.