‎2009 May 28 7:29 AM
Hi Experts,
Can any one solve my problem?
I have displayed data using u2018CL_GUI_ALV_GRID=>SET_TABLE_FOR_FIRST_DISPLAYu2019. But my requirement is after the end of the last row one line should come in editable mode. User has to enter new values. One push button should be provided say u2018DISPu2019. After entering the values if he click u2018DISPu2019 the new values should be displayed in disabled mode. Then again after the end of all rows a new line should come in editable mode to give new values.
If it is possible in OOPS please give a clear idea to do this.
Thanks in Advance,
Regards,
Kumar
‎2009 May 28 1:50 PM
Hi,
Once the button is clicked, in PAI, use describe statement to find out the no. of records and then make the fieldcatalog for all the fields for the last line.
TYPES : BEGIN OF ty.
.....
* For cell editing and displaying cell as push button
TYPES : cellstyles TYPE lvc_t_styl,
END OF ty.
Data w_style TYPE lvc_s_styl.
Set the layout stylefname as CELLSTYLES.
* Setting layout
w_layout-stylefname = 'CELLSTYLES' ."cell-push button and edit
* Making a particular cell as non-editable and other editable
CLEAR w_style.
w_style-fieldname = 'ERNAM'.
w_style-style = cl_gui_alv_grid=>mc_style_disabled.
REFRESH wa-cellstyles.
APPEND w_style TO wa-cellstyles.
MODIFY itab FROM wa INDEX 3 TRANSPORTING cellstyles.
‎2009 May 28 7:36 AM
I can't give you any exact code for your requirement, but I want to refer to some sample report provided by SAP to get into editable ALV:
in SE38 enter BCALV_EDIT* and press F4. These report should definitely give you the necessary insights.
‎2009 May 28 1:25 PM
Please follow the following steps to get you requirement.
1. Append one empty record in your internal table at last.
2. Display the record using ALV Gird Control methods.
3. Call the proper methods for Edit in ALV Grid.
4. Declare the Data change and User comment event for ALV Grid.
I hope if you done this way you will achieve your expectation. If you see the some sample code in the following program.
BCALV_GRID_EDIT.
If you are not able to identify, Please let me know, I will help more on this.
-
Ravi.
‎2009 May 28 1:50 PM
Hi,
Once the button is clicked, in PAI, use describe statement to find out the no. of records and then make the fieldcatalog for all the fields for the last line.
TYPES : BEGIN OF ty.
.....
* For cell editing and displaying cell as push button
TYPES : cellstyles TYPE lvc_t_styl,
END OF ty.
Data w_style TYPE lvc_s_styl.
Set the layout stylefname as CELLSTYLES.
* Setting layout
w_layout-stylefname = 'CELLSTYLES' ."cell-push button and edit
* Making a particular cell as non-editable and other editable
CLEAR w_style.
w_style-fieldname = 'ERNAM'.
w_style-style = cl_gui_alv_grid=>mc_style_disabled.
REFRESH wa-cellstyles.
APPEND w_style TO wa-cellstyles.
MODIFY itab FROM wa INDEX 3 TRANSPORTING cellstyles.
‎2009 Jun 03 1:11 PM
Thank you Jayanthi,
Still I have small problem on this...
I am able to pass only one entry in 'wa-cellstyles'.
Suppose I have 5 fileds in row.. I cannot disable more than one field in a row.
My requirement is I have to diable more than one fields in a row.
After passing the two or three entries to 'wa-cellstyles', while modifying the 'itab' it is giving short dump.
Please solve my problem.
Thanks & Regards,
Kumar.
‎2009 Jun 03 1:15 PM
Hello Kumar
There is one big error in the coding which explains your dump:
TYPES : BEGIN OF ty.
.....
* For cell editing and displaying cell as push button
TYPES : cellstyles TYPE lvc_t_styl, " <<< SORTED table type !!!
END OF ty.
Data w_style TYPE lvc_s_styl.
Set the layout stylefname as CELLSTYLES.
* Setting layout
w_layout-stylefname = 'CELLSTYLES' ."cell-push button and edit
* Making a particular cell as non-editable and other editable
CLEAR w_style.
w_style-fieldname = 'ERNAM'.
w_style-style = cl_gui_alv_grid=>mc_style_disabled.
REFRESH wa-cellstyles.
" APPEND w_style TO wa-cellstyles. " <<< wrong
INSERT w_style INTO TABLE wa-cellstyles. " <<< correct
" MODIFY itab FROM wa INDEX 3 TRANSPORTING cellstyles.
Regards
Uwe
‎2009 Jun 05 10:14 AM