Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Enable Disable Alv cell on Codition?

Former Member
0 Likes
4,229

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

1 ACCEPTED SOLUTION
Read only

marvelmurugan
Explorer
0 Likes
2,311

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_maralwa_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

6 REPLIES 6
Read only

Former Member
0 Likes
2,311

Hi,

could you tell us wich Kind of ALV. OO, GRID, LIST?.

Regards, Dieter

Read only

0 Likes
2,311

Hi Dieter,

IN ALV Grid.

Regards

Neeraj

Read only

marvelmurugan
Explorer
0 Likes
2,312

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_maralwa_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



Read only

0 Likes
2,311

Hi Vel,

Can we do this in grid alv?

Regards

Neeraj

Read only

Former Member
0 Likes
2,311

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

Read only

asim_isik
Active Participant
0 Likes
2,311

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.