Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9564

Re: Enable a particular cell in alv display

$
0
0

Okay. From the beginning.

1. create a ddic structure with your field + CELLSTYLES    1 Type    LVC_T_STYL --> lets call it DDIC_STRUCT

2014-11-04 13_39_30-Clipboard.png

 

2.Building the Fieldcat:

     CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
         i_structure_name = 'DDIC_STRUCT'
       CHANGING
         ct_fieldcat      = gt_fieldcat.

3. Adding Cellstyles to layout:  gs_layout-stylefname = 'CELLSTYLES'.


4. looping thrugh the fieldcat:

LOOP AT gt_outtab ASSIGNING <wa_pt_outtab>.

             ls_stylerow-fieldname = 'ZFIELD1'.
             ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled + cl_gui_alv_grid=>mc_style_f4_no..
             INSERT ls_stylerow INTO TABLE lt_celltab.
             INSERT LINES OF lt_celltab INTO TABLE <wa_pt_outtab>-cellstyleS.
         ENDLOOP.


5.CALL METHOD g_grid->set_ready_for_input
           EXPORTING
             i_ready_for_input = abap_true.

 

 

.....

But now i think i can see whats the problem.

Go to point 4 and add a if condition:

<wa_pt_outtab>-zfield = '78'.




LOOP AT gt_outtab ASSIGNING <wa_pt_outtab>.

              if <wa_pt_outtab>-zfield = '78'.
             ls_stylerow-fieldname = 'ZFIELD1'.
             ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled + cl_gui_alv_grid=>mc_style_f4_no..
             INSERT ls_stylerow INTO TABLE lt_celltab.
             INSERT LINES OF lt_celltab INTO TABLE <wa_pt_outtab>-cellstyleS.
           ENDIF.
         ENDLOOP.


Now only the cell, which got the value 78 should be editable


Br,

Nikolaus


 

 




Viewing all articles
Browse latest Browse all 9564

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>