07-14-2008 10:11 AM
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.
07-14-2008 10:15 AM
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.
07-14-2008 10:40 AM
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.