Application Development 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: 

Editable ALV grid -Issue

former_member225134
Participant
0 Kudos

Hi,

    In an alv report i want to display 12 fields but the last field is editable one based on the condition

table-date field <= sy-datum means the grid is to be editable one other wise it is non editable.

In my code:

IF GT_QINF-FREI_DAT <= SY-DATUM.

     PERFORM ADD_FILEDCAT USING '13' 'EDIT' 'GT_QINF' 'Modified Date' '20' 'X'   '' ''.   -------->editable

   ELSE.

     PERFORM ADD_FILEDCAT USING '13' 'EDIT' 'GT_QINF' 'Modified Date' '20' ''   '' ''.  ------------->non editable.

   ENDIF.

 

But the GT_QINF-FREI_DAT does not having values,because internal table not working inside fieldcatalog.

How to solve this issue?????

9 REPLIES 9

Former Member
0 Kudos

Which way are you using for ALV report?

Class CL_GUI_*? or FM - REUSE_ALV_GRID***?

0 Kudos

Thanx for your repli,

   am using reuse_alv_grid display

raymond_giuseppi
Active Contributor
0 Kudos

There is one field catalog for the whole internal table, not for each record, you have to code that for the cell for each rows.

So you need to add a field of structure LVC_T_STYL to your internal table, also declare it in layout parameter.

Then in a loop set the style CL_GUI_ALV_GRID=>MC_STYLE_DISABLED or MC_STYLE_ENABLED for the specified field for each record.

But don't forget to also set the field editable in field catalog, else the style wont perform.

NB: Look in scn for thread similar to MC_STYLE_ENABLED not working for making the cell editable to get some samples.

Regards,

Raymond

0 Kudos

Hi Raymond,

One question came in my mind, never tried that.

For LVC_T_STYL, do we need to use REUSE_ALV_GRID_DISPAY_LVC?

or it can also work with simple grid alv (without LVC)?

Thanks.

0 Kudos

The field STYLEFNAME is not in old REUSE FM signature, it should be possible to "play" with GET_GLOBALS_FROM_SLVC_FULLSCR, but better use class CL_GUI_ALV_GRID or FM REUSE_ALV_GRID_DISPLAY_LVC if you don't fell confident with OO programming.

Regards,

Raymond

former_member225134
Participant
0 Kudos

Thanx for ur repli sir,

DATA ls_stylerow TYPE lvc_s_styl.

    DATA lt_styletab TYPE lvc_t_styl .

    data wa_data1-field_style type lvc_t_styl.

    data : prev_txt50(50).

    LOOP AT GT_QINF INTO GS_QINF.

        clear ls_stylerow.

  IF GS_QINF-FREI_DAT <= SY-DATUM.

      ls_stylerow-fieldname = 'EDIT' .

      ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.

  ELSE.

      ls_stylerow-fieldname = 'EDIT' .

      ls_stylerow-style      cl_gui_alv_grid=>mc_style_disabled.

endif.

      Insert ls_stylerow  INTO TABLE wa_data1-field_style.

       MODIFY GT_QINF FROM GS_QINF.

       clear GS_QINF.

    ENDLOOP.


But how to display it is in fieldcatalog...

Because already am having one fieldcatalog to display in(reuse_alv)

now am using oo concept means how to merge this one field...

Or any idea to display the fieldcatalog.


Thanx...

Former Member
0 Kudos

As per my understanding now, you just need to keep your fieldcatalog editable.

So for this column just pass the fcat-edit = 'X'. That's all.

0 Kudos

Correct, in field catalog set edit = 'X' for the field.

Regards,

Raymond

0 Kudos

Hi,

     Am using cl_gui_alv_grid=>mc_style_enabled method.



LOOP AT GT_QINF INTO GS_QINF.

      IF GS_QINF-FREI_DAT <= SY-DATUM.

        gs_celltab-fieldname = 'STYLE'.

        GS_QINF-style = cl_gui_alv_grid=>mc_style_disabled.

     ELSE.

       GS_QINF-style = cl_gui_alv_grid=>mc_style_enabled.

       endif.

       MODIFY GT_QINF FROM GS_QINF TRANSPORTING style .

    clear GS_QINF.

    ENDLOOP.


PERFORM ADD_FILEDCAT USING '13' 'STYLE' 'GT_QINF' 'Modified Date' '20' ''   '' ''."

Now in style tab am getting output as 00800000 and 00100000.(based on condition am given)....

After that only i put perform display(field catalog display)..Now how to display these value as editable and non editable.(remaining fields am using reuse_alv_grid_display)