cancel
Showing results for 
Search instead for 
Did you mean: 

column-width in SALV with web-dynpro ABAP

davidwallner
Participant
0 Kudos

Hi there,

can anyone help me? I want to set the column width to a fix value e.g. 50px.

How can i do this in SAP List Viewer for ABAP Web Dynpro? At the moment i use this code:

lo_value->if_salv_wd_table_settings~set_scrollable_col_count( 6 ).

lo_value->if_salv_wd_table_settings~set_width( '100%' ).

lo_value->if_salv_wd_table_settings~set_fixed_table_layout( 'X' ).

The effect is that there are 6 columns all the same width. Is it possible to fix width for one specific column??

best regards...

David Wallner

Accepted Solutions (1)

Accepted Solutions (1)

davidwallner
Participant

wow thanks a lot. working fine!!!!

uday_gubbala2
Active Contributor
0 Kudos

Hi David,

Glad that its working. Hope that you would make out some time & return back the favour!

Regards,

Uday

Answers (1)

Answers (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi David,

You need to change Table setting Layout. Please check this code:

* create an instance of ALV component
DATA: LR_IF_CONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,
LR_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE,
LR_CMDL TYPE REF TO CL_SALV_WD_CONFIG_TABLE,
LR_TABLE_SETTING TYPE REF TO IF_SALV_WD_TABLE_SETTINGS.
LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).
 
IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
  LR_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
 
** get reference to the ALV model
LR_IF_CONTROLLER = WD_THIS->WD_CPIFC_ALV( ).
LR_CMDL = LR_IF_CONTROLLER->GET_MODEL( ).
LR_TABLE_SETTING ?= LR_CMDL.
 
** Set column width
DATA LR_COL TYPE REF TO CL_SALV_WD_COLUMN.
 
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'PERNR' ).
LR_COL->SET_WIDTH( '70' ) .
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'ENAME' ).
LR_COL->SET_WIDTH( '100' ) .
 
LR_TABLE_SETTING->SET_FIXED_TABLE_LAYOUT( ABAP_TRUE ).

This is the important thing:

LR_TABLE_SETTING->SET_FIXED_TABLE_LAYOUT( ABAP_TRUE ).

Regards,

Uday