2013 Dec 04 2:14 PM
Hi,
I have a requirement in my alv report that on some condition alv cell should get enable and disable.
How to do that.
Please guide me.
Regards
Naeeraj
2013 Dec 04 2:33 PM
Hi Tiwari,
Here i am giving my piece of code to achieve the Enable / Disable Fn
before displaying the ALV , add this code
* ALV Display
TYPES : BEGIN OF ty_rept,
celltab TYPE lvc_t_styl. ---- > Enable / Disable
INCLUDE TYPE mara.
TYPES : END OF ty_mara.
Data : it_rept type table of ty_mara.
DATA :
lwa_celltab1 TYPE lvc_s_styl,
lt_celltab1 TYPE lvc_t_styl.
LOOP AT it_mara INTO lwa_mara.
MOVE-CORRESPONDING lwa_mara TO lwa_alv_mara.
lwa_celltab1-fieldname = 'MATNR'.
lwa_celltab1-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT lwa_celltab1 INTO TABLE lt_celltab1.
INSERT LINES OF lt_celltab1 INTO TABLE lwa_alv_mara-celltab.
APPEND lwa_alv_mara TO it_rept.
CLEAR : lwa_celltab1, lwa_alv_mara, lwa_mara.
ENDLOOP.
CALL METHOD gr_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = gt_toolbar_exc
is_variant = gs_variant
i_save = gv_save
CHANGING
it_outtab = it_rept
it_fieldcatalog = gt_session_fieldcat[].
Regards,
Vel
Hi,
I have a requirement in my alv report that on some condition alv cell should get enable and disable.
How to do that.
Please guide me.
Regards
Naeeraj
2013 Dec 04 2:30 PM
Hi,
could you tell us wich Kind of ALV. OO, GRID, LIST?.
Regards, Dieter
2013 Dec 05 7:35 AM
2013 Dec 04 2:33 PM
Hi Tiwari,
Here i am giving my piece of code to achieve the Enable / Disable Fn
before displaying the ALV , add this code
* ALV Display
TYPES : BEGIN OF ty_rept,
celltab TYPE lvc_t_styl. ---- > Enable / Disable
INCLUDE TYPE mara.
TYPES : END OF ty_mara.
Data : it_rept type table of ty_mara.
DATA :
lwa_celltab1 TYPE lvc_s_styl,
lt_celltab1 TYPE lvc_t_styl.
LOOP AT it_mara INTO lwa_mara.
MOVE-CORRESPONDING lwa_mara TO lwa_alv_mara.
lwa_celltab1-fieldname = 'MATNR'.
lwa_celltab1-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT lwa_celltab1 INTO TABLE lt_celltab1.
INSERT LINES OF lt_celltab1 INTO TABLE lwa_alv_mara-celltab.
APPEND lwa_alv_mara TO it_rept.
CLEAR : lwa_celltab1, lwa_alv_mara, lwa_mara.
ENDLOOP.
CALL METHOD gr_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = gt_toolbar_exc
is_variant = gs_variant
i_save = gv_save
CHANGING
it_outtab = it_rept
it_fieldcatalog = gt_session_fieldcat[].
Regards,
Vel
2013 Dec 05 9:18 AM
2013 Dec 05 1:38 PM
Hii Neeraj,
Go to this link Disable or Enable Input fields Conditionally In OO ALV - Code Gallery - SCN Wiki
and copy the program and run.
The sample code is all about how to make a particular cell enable or disbale.
Just create the screen by double clicking the screen 100 and enable the PF-STATUS and set BACK, EXIT and CANCEL button.
A it is implemented on OOPS but you can also implement in ALV grid display.
regards
Syed
2013 Dec 05 2:57 PM
Hi Neeraj,
After you make your fielcatalog loop it and do it.
loop at gt_fieldcatalog into gs_fieldcatalog.
if your condition.
gs_fieldcatalog-no_out = 'X'.
endif.
endloop.
this will disable your column up to your condition other way it is enable so you can your condition up to you need.