‎2009 Nov 17 7:20 AM
Hi,
I am facing this peculiar problem in OOPS ALV. the requirement was to have a field and 2 radio buttons in ALV as editable when user clicks on CHANGE mode. but initially the table should be in display mode.
I have used the icons in ALV to provide the radio button functioanlity and its working.. but cant find solution to these 2 issues:
1) how to make radio button display only ?
2) when appending a new row in the ALV, its just appending a row with 4 columns ( 2 of field and 2 of radio button), but it is not able to append icons by default.
KIndly provide help on this. let me know if u need to clarify anything..
Thankx in advance,
Rohan Malik
‎2009 Nov 17 5:36 PM
Hi Rohan,
I'll try to give precise answer to your problem :
1. At any point of time you want to make Radiobutton display or change on click of your custom Push button you should change contents of your table field CELL_STYLE namely to do so. like
CASE E_UCOMM.
WHEN 'DISPLAY'
Read your display internal table and chek whether contents of field cell_style-style..if it is cl_gui_alv_grid=>mc_style_enabled then make it cl_gui_alv_grid=>mc_style_disabled or vice versa..
wal_cell_stl-fieldname = 'RADIO1'.
wal_cell_stl-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT wal_cell_stl INTO TABLE wal_out_tab-cell_style.
2. When you are appending records in ALV then very first thing should be you should not use standard functionality for adding rows rather you need to create a custom button for adding rows and handle everything regarding the same in event ON_USER_COMMAND. Now to make your radiobutton column display only on addition to row you should be writing something like this in evnt USER_COMMAND
CASE E_UCOMM.
WHEN 'ADD''
wal_cell_stl-fieldname = 'RADIO1'.
wal_cell_stl-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT wal_cell_stl INTO TABLE wal_out_tab-cell_style.
wal_out_tab-radio1 = icon_wd_radio_button_empty.
*&--Append the record
APPEND wal_out_tab TO t_out_tab.
CLEAR wal_out_tab.
the above peice of code will add new row with Radiobutton icon in display mode .
hope this solves your problem..
bye
‎2009 Nov 17 6:23 PM
below is code for changing contents of ALV with new ones....
FIELD-SYMBOLS:
*&--Holds the value for Item Table
<l_item_tab> TYPE ANY TABLE,
*&--Holds the value for Output line
<l_outtab_line> TYPE type_sec_slsshp_data,
*&--Holds values for changed cells in ALV
<l_changed_cell> TYPE lvc_s_modi.
*&--Getting table with modified data in field-symbol
ASSIGN er_data_changed->mp_mod_rows->* TO <l_item_tab>.
*&--Adding changed values to display table
LOOP AT <l_item_tab> ASSIGNING <l_outtab_line>. "#EC GEN_OK
wl_tabix = sy-tabix.
*&--Getting changed values from frontend
LOOP AT er_data_changed->mt_good_cells ASSIGNING <l_changed_cell>
WHERE tabix = wl_tabix.
*&--Adding changed values to display table
READ TABLE t_alv_data ASSIGNING <fs_alv_data>
INDEX <l_changed_cell>-row_id.
IF sy-subrc = 0.
CASE <l_changed_cell>-fieldname.
*&--When Division
WHEN 'RADIOBUTTON'.
<fs_alv_data>-zzspart = <l_changed_cell>-value.
*&--When Customer
WHEN c_zzkunnr.
<fs_sec_slsshp>-zzkunnr = <l_changed_cell>-value.
<fs_sec_slsshp>-usnam = sy-uname.
<fs_sec_slsshp>-cpudt = sy-datum.
<fs_sec_slsshp>-cputm = sy-uzeit.
ENDCASE.
ENDIF.
ENDLOOP.
‎2009 Nov 24 2:42 PM
done... thought i didn't use on_data_change event.. i was able to achieve the same thing using is_Ready_for_input.
Thanks for the solution...