简体   繁体   中英

Set optimize for a single column via REUSE_ALV_GRID_DISPLAY?

I need to modify an old report using REUSE_ALV_GRID_DISPLAY. The requirement is that all columns are optimized except for one. As far as I can tell, i can only set optimization for all with layout-colwidth_optimize .

Is there a way to deactivate optimization for a single column?

You could just loop over your fieldcatalog and do something like this:

LOOP AT lt_fcat INTO DATA(ls_fcat).
  CASE fs_fcat-fieldname.
    WHEN 'YOUR_COL'.
      ls_fcat-outpulen = '10'.

    WHEN OTHERS.
      ls_fcat-col_opt = 'X'
  
  ENDCASE.
  MODIFY lt_fcat FROM ls_fcat.
ENDLOOP.

Then remove the colwidth_optimize from your layout. I can't test right now but it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM