2008 Nov 11 8:08 AM
Hi All,
I am using ALV List display for a report, Now my issue is the column width keeps changing based on the line size, please advise how to calculate the width of each column.
Eg: for particular date range , the Description width is small ,
__________________________
| Name |`````` Descreption `````` |
for some different date range it changes to more wider,
____________________________________________________
| Name | ``````````````` ``````````` Descreption `````````` ````````````````|
so how should calculate the column width.
Edited by: soyunee on Nov 11, 2008 1:39 PM
Hi All,
I am using ALV List display for a report, Now my issue is the column width keeps changing based on the line size, please advise how to calculate the width of each column.
Eg: for particular date range , the Description width is small ,
__________________________
| Name |`````` Descreption `````` |
for some different date range it changes to more wider,
____________________________________________________
| Name | ``````````````` ``````````` Descreption `````````` ````````````````|
so how should calculate the column width.
Edited by: soyunee on Nov 11, 2008 1:39 PM
2008 Nov 11 8:15 AM
Hi,,,,,,,
There is an option in the LAYOUT of the alv,,,,, While setting the layout......... use
v_alv_layout-colwidth_optimize = 'x'.
This Will optimize the width of all the columns in your alv list display
Thanks
Saurabh
2008 Nov 11 8:15 AM
Hi,
u wont be able to calculate the column width....but can find the length of the ;'Description' in itab by the statement STRLEN( fld_name ).
and if u set the LAYOUT-colwidth_optimize = 'X'. then the output will take the length of the longest field.
and if u set LAYOUT-colwidth_optimize = ' '. then the output width will take the length u specify in FIELDCATALO-OUTPUTLEN.
2008 Nov 11 8:19 AM
Hi Soyunee,
If you are talking about Normal ALV:
you need to use the
LAYOUT-COLWIDTH-OPTIMIZE = 'X' .
and the layout structure you need to pass it to layout parameter of ALV.
if you are talking about ALV OO:
you need to use the
LAYOUT-CWIDTH_OPT = 'X'.
This will adjust your column length according to its values.
Hope this will help.
Regards,
Nitin.
2008 Nov 11 8:28 AM
Hi All,
I apretiate your response, Is there a way other than LAYOUT-colwidth_optimize, because if I use LAYOUT-colwidth_optimize = ' '. then the report dosent fit into a single page to print.
2008 Nov 11 8:38 AM
Hi,,,,,
If you don't want to LAYOUT-COL_WIDTH_OPTIMIZE,,, Then In your field-catalog specify the OUTPUT-length for each field......
for ex.....
fieldcat-outputlen = m_len.
In this case you can specify your own length for each field,specify the length accordingly so that it can fix in your papaer...........
still if it doesn't fit in your page......
Then while giving the print-out increase your page width... There is standard format provided by sap that is 'X_SPOLLER',,, THAT IS 65x255 ROWS YOU CAN CREATE YOUR OWN FORMAT AND THEN GIVE PRINTOUT,, THEN IT WILL WORK....
tHANKS
sAURABH
2008 Nov 11 8:43 AM
Hi Soyunee,
Following are the few options related to heading:
seltext_l (long field label)
· seltext_m (medium field label)
· seltext_s (short field label)
· reptext_ddic(header) Analogous to the Data element main header
· Ddictxt (specify text) : You can specify with values 'L', 'M', and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
Value set: SPACE, 'L', 'M', and S
You can set DDICTXT as S, then it will take short text seltext_s by default. This can reduce the width of your report.
Regards,
Nitin.
2008 Nov 12 3:10 AM
Hi All,
When using Colwidth_optimize = 'X', if I am not wrong , it takes the width of the field which has largest characters, and sets the column width as 'Y' (eg).
How do i know what is the value of 'Y' , which it sets as width.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |