Application Development 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: 

Fixed length for the fields of ALV output

Former Member
0 Kudos

Hi,

How to fix a field in the ALV output to its max length..For example..if a field's max length is 10...that coloumn should not be dragged or moved to right..Its lenght shluld be fixed to 10...Could any bod suggest me how to perform this...thanks..

Shyam.

2 REPLIES 2

Former Member
0 Kudos

Hi,

U can better optimize the width.it will be good.

data : W_LAYOUT TYPE SLIS_LAYOUT_ALV.

W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_STRUCTURE_NAME = 'T_ALV'

IS_LAYOUT = W_LAYOUT

IT_FIELDCAT = T_FIELDCAT_ALV

I_CALLBACK_TOP_OF_PAGE = 'ALV_TOP_OF_PAGE'

TABLES

T_OUTTAB = T_ALV

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Former Member
0 Kudos

Populate field catalog with

Key = 'X' and outputlen = 10.

data: ls_fieldcat type slis_fieldcat_alv.

*

clear ls_fieldcat.

ls_fieldcat-fieldname = 'XXXXX'. << Your field name

ls_fieldcat-fieldname = 'YYYY'. << Your internal table name

ls_fieldcat-key = 'X'.

ls_fieldcat-outputlen = 10 .

append ls_fieldcat to e01_lt_fieldcat.

Pass the field catalog table to ALV FM.

Regards,

JOy.