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 display

Former Member
0 Likes
1,176

How to minimise the column width in ALV display.

Thanx in Advance.

Regards,

Johnn.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,146

Hello John,

It can be done by using the fielcat variable <b>outputlen</b>.

If useful reward.

Vasanth

How to minimise the column width in ALV display.

Thanx in Advance.

Regards,

Johnn.

11 REPLIES 11
Read only

Former Member
0 Likes
1,146

Hi Johnn,

set the parameter colwidth_optimize in the layout as 'X'.

or refer standard ALV Programs that starts with BCALV*.

Regards,

Suchi

Read only

0 Likes
1,146

I am using this method.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'gt_STRUCT'

  • IS_VARIANT = GS_LAYOUT

I_SAVE = X_SAVE

I_DEFAULT = LV_DEF

  • IS_LAYOUT = GS_LAYOUT

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

  • IR_SALV_ADAPTER =

CHANGING

IT_OUTTAB = GT_BPSTAB[]

IT_FIELDCATALOG = GT_FIELDCATALOG[]

  • IT_SORT =

  • IT_FILTER =

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2

TOO_MANY_LINES = 3

OTHERS = 4

.

where can i set the colwidth_optimize.

Read only

Former Member
0 Likes
1,146

Hi,

In the SLIS_LAYOUT_ALV, there is a property called COLWIDTH_OPTIMIZE.

Set his property as COLWIDTH_OPTIMIZE = 'X'.

Automatically your column width will get reduced.

JLN

Read only

Former Member
0 Likes
1,147

Hello John,

It can be done by using the fielcat variable <b>outputlen</b>.

If useful reward.

Vasanth

Read only

0 Likes
1,146

Hello vasanth,

I am going to display nearly 15 columns.

First column should be of length 15.

Second & third column be of lenght 10.

Fourth column should be of length 15.

fifth & sixth column be of length 10.

..........

outputlen has value '00000' in debugging mode.

How to set the length.

please help me.

Read only

0 Likes
1,146

Hi Johnn,

U can write like this

fiedcattab-outputlen = '15'.

Hope this wud help u.

Regds,

Seema.

Read only

0 Likes
1,146

I cannot assign like this....

gt_fieldcatalog is a table without header line.

i declared it like this

Data : GT_FIELDCATALOG TYPE LVC_T_FCAT.

Read only

0 Likes
1,146

Hi john

use like this

DATA: I_FCAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FCAT LIKE LINE OF I_FCAT.

READ TABLE I_FCAT INTO WA_FCAT WITH KEY FIELDNAME = 'NDAYS'.

IF SY-SUBRC EQ 0.

WA_FCAT-REPTEXT_DDIC = 'X'.

WA_FCAT-SELTEXT_S = TEXT-007.

WA_FCAT-SELTEXT_M = TEXT-007.

WA_FCAT-SELTEXT_L = TEXT-007.

WA_FCAT-OUTPUTLEN = 12.

WA_FCAT-JUST = 'L'.

MODIFY I_FCAT FROM WA_FCAT INDEX SY-TABIX.

CLEAR WA_FCAT.

ENDIF.

so change the length here ..

declate fcat like above...it will work

Read only

0 Likes
1,146

Hi rk,

i can adjust the width only for column on monday,

How can i do it for other columns with days like tues,thurs, wed....

DATA : WA_FIELDCATALOG LIKE LINE OF GT_FIELDCATALOG.

LOOP AT GT_FIELDCATALOG INTO WA_FIELDCATALOG.

IF SY-SUBRC = 0.

READ TABLE GT_FIELDCATALOG INTO WA_FIELDCATALOG WITH KEY FIELDNAME = 'MONDAY' .

WA_FIELDCATALOG-OUTPUTLEN = 20.

MODIFY GT_FIELDCATALOG FROM WA_FIELDCATALOG INDEX SY-TABIX .

CLEAR WA_FIELDCATALOG.

ENDIF.

Read only

0 Likes
1,146

Hi John

You have to Read for every field and fill the catalog.

do same for all the columns you require.

Awards points if useful.

Read only

Former Member
0 Likes
1,146

Hi Johnn,

You can set the parameter CWIDTH_OPT in the structure for layout (LVC_S_LAYO - Passed in the method against IS_LAYOUT under EXPORTING) as 'X' and the column width will get adjusted automatically.

If you want to set the column width for each of the columns you can do so at the time of populating the Field Catalog with the parameter OUTPUTLEN.

Regards,

Manoj