08-19-2008 2:11 PM
hello,
I am facing a problem in optimising the width of a column while displaying an alv grid. the column i am displaying contains id's taken from table ADR6 and field name is SMTP_ADDR. I have tried giving the option CWIDTH_OPT as 'X' in layout structure LVC_S_LAYO , for getting the optimised column width.. i didnot get it and also i have tried changing in the filed caltalogue( of structure LVC_S_FCAT ) by setting the property of the column OUTPUTLEN to some value. But the column width it is showing in the grid display is of 241 characters..but my id's are too short to show such a big column width( roughly around 40 char)..kindly help me in solving this problem.
with regards,
sandeep akella.
08-19-2008 2:23 PM
I have tried with setting up the Column width in the field catalog and it is working fine for me.
Like:
clear ls_fcat.
ls_fcat-fieldname = 'EMAIL'.
ls_fcat-coltext = 'Email'.
ls_fcat-outputlen = 40.
append ls_fcat to t_fieldcat.
Regards,
Naimesh Patel
08-19-2008 2:22 PM
Try using this:
DATA: t_slis_layout_alv TYPE slis_layout_alv.
t_slis_layout_alv-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = t_slis_layout_alv
and so on and so forth..
This should give you optimum column.
Let me know if you need further help.
Thanks-
08-19-2008 2:27 PM
hello,
I am using object orientd fo r displayin the alv grid and to be more specfic the change is being made in standard report purchase requsetion-ME2N transaction. In thiis i have added 2 fields one is email id( field above mentioned ) and other one is gross price.
01-30-2014 9:01 AM
03-06-2020 10:26 AM
08-19-2008 2:23 PM
I have tried with setting up the Column width in the field catalog and it is working fine for me.
Like:
clear ls_fcat.
ls_fcat-fieldname = 'EMAIL'.
ls_fcat-coltext = 'Email'.
ls_fcat-outputlen = 40.
append ls_fcat to t_fieldcat.
Regards,
Naimesh Patel
08-19-2008 2:33 PM
hello,
I have tried the same code ..but i am not gettin it.
with regards,
sandeep akella.
08-19-2008 2:36 PM
use these options.
LVC_S_FCAT-COL_OPT = 'X'.
LVC_S_FCAT-COLTEXT = 'Email'.
08-19-2008 2:24 PM
09-11-2014 10:05 AM
Hi,
An approach I just discovered (I use FM in this case altough I'm not very fond of them....) is the following.
I also used a (nasty) trick to get access to the underlying CL_ALV_GUI_GRID object.
In the ALV_USER_COMMAND routine:
ASSIGN ('(SAPLSLVC_FULLSCREEN)GT_GRID-GRID') TO <lo_grid>.
CHECK <lo_grid> IS ASSIGNED.
lv_ucomm = '&OPT'.
<lo_grid>->refresh_table_display( EXPORTING i_soft_refresh = space ). " necessary before optimizing columns
<lo_grid>->set_function_code( CHANGING c_ucomm = lv_ucomm ).
Best regards,
Guillaume
03-12-2015 12:27 PM
You can use FM 'GET_GLOBALS_FROM_SLVC_FULLSCR' to get reference of the ALV Grid instead of using field symbols.