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

ALV grid - making column lengths fixed

Former Member
0 Likes
4,447

Hi.. I need to knw how to make the column lenghts fixed.. The fields gets adjusted according to the data available. But i don't want it to get adjusted but wants to give fixed lengths to some columns.. The report is in ALV format.

Cn anyone pls tell how this can be done? Tnx in advance.

Keshi

Hi.. I need to knw how to make the column lenghts fixed.. The fields gets adjusted according to the data available. But i don't want it to get adjusted but wants to give fixed lengths to some columns.. The report is in ALV format.

Cn anyone pls tell how this can be done? Tnx in advance.

Keshi

8 REPLIES 8
Read only

Former Member
0 Likes
2,217

I don't think the column width can be fixed, In fact that is supposed to be a feature of ALV report. why do you want to do that.

If you want optimize the width of the columns, save that as the default layout for the report.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

Former Member
0 Likes
2,217

Hi,

You might have set the value for CWIDTH_OPT in the layout.

if it is used comment it..and set the outputlen in teh field catalogue.

Regards

Sandeep.

Read only

Former Member
0 Likes
2,217

Hi,

Use the field outputlen of the fieldcatalog to make your column length fixed.

Also check whether you have used optimize_colwidth of your ALV layout. If you have set this variable then the ALV display adjusts its width based on the content.

Regards

Wenceslaus

Read only

Former Member
0 Likes
2,217

This is wht i hv used... Cn anyone tell me wht to do, if i wnt to limit the name to 7 characters even if it has 20 characters ? Only the first 7 characters should be displayed in da report.. Tnx.

fieldcatalog-fieldname = 'NAME1'.

fieldcatalog-KEY = 'X'.

fieldcatalog-seltext_m = 'Vendor'.

fieldcatalog-col_pos = 4.

fieldcatalog-outputlen = 7.

fieldcatalog-edit = ''.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

Read only

0 Likes
2,217

Hi Keshini,

The fieldcatalog looks good.

Check whether you have used a layout for displaying ALV grid

And clear the field colwidth_optimize if you have used.

Regards

Wenceslaus

Read only

0 Likes
2,217

Tnx. For all ur replies.. I cleared the mentioned field.

gd_layout-colwidth_optimize = ' '.

But still it doesn't work.. Anything else?

Read only

0 Likes
2,217

Hi Keshini,

if you set the output length in field catalog and in layout you remove cwith_opt then ALV will display the length as mentioned in field catalog. ALV will not truncate any values, say for example you want to display 7 characters then ALV will keep all 20 char but will display only 7 char if you manually increase the size then only it will show rest of the 13 characters.

Read only

Former Member
0 Likes
2,217

IN YOUR FIELDCATALOG ADD THE CODE FOR THE FIELD NAME

IFIELDCAT-OUTPUTLEN = <DESIRED LENGTH>.

SHIBA PRASAD DUTTA