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

Implementing in code the same as Settings -> Columns -> Optimize Width

Former Member
0 Likes
838

Is there a way I can code the field catalog form (one of its parameters, maybe ? although I didn't find a suitable one...) so the ALV is displayed like if I went over Settings -> Columns -> Optimize Width ? In other words, displaying all the columns with their proper medium/long texts (according to what I choose), without having to adjust the column widths, whenever the DDIC definition, for the given data element, doesn't suffice ?

Thanks,

Avraham

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
803

well if you are talking of an ALV you should look in the structure Layout not in the fieldcat.

there you can find your desired parameter.

6 REPLIES 6
Read only

Former Member
0 Likes
804

well if you are talking of an ALV you should look in the structure Layout not in the fieldcat.

there you can find your desired parameter.

Read only

Former Member
0 Likes
803

Hi ,

u can make use of there fields

OUTPUTLEN

OFFSET

SELTEXT_L

SELTEXT_M

SELTEXT_S

of FCAT.

Regards

prabhu

Read only

Former Member
0 Likes
803

Hi Avaraham,

Check the Layout of Exporting parameters, there is one option

'colwidth_optimize' pass 'X' to this parameter.

Source:

https://forums.sdn.sap.com/click.jspa?searchID=14944109&messageID=5468942

Have A Good Day

Chaitanya.

Read only

Former Member
0 Likes
803

hi,

there is a field in layout.

layout-colwidth_optimize = 'X'.

By using this no need to declare fieldcatalog length. it opts automatically optimum length for all column.

Read only

Former Member
0 Likes
803

Hi,

before building fieldcatalog do follow below logic.

Data it_layout type slis_layout_alv. "Declare Globally

it_layout-colwidth_optimize = 'X'.

it_layout-zebra = 'X'.

then

clear wa_fieldcat.

add 1 to col_pos.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = col_pos.

wa_fieldcat-fieldname = 'SNO'.

wa_fieldcat-seltext_l = 'S. No.'.

append wa_fieldcat to it_fieldcat.

rgds

rajesh

Read only

Former Member
0 Likes
803

if you are talking about Normal ALV

you need to use the

LAYOUT-COLWIDTH-OPTIMIZE .

and the layout structure you need to pass it to layout parameter of ALV.

if you are talking about ALV OO

LAYOUT-CWIDTH_OPT