Skip to Content
avatar image
Former Member

How to change ALV width in column?? Urgen :(

Column width:

I can'T change the column width in my coding. I think it should be mady by lr_column_ORDER->set_width( '50' ). - but it doens'T????

Please help!

method CONFIG_ALV_COLUMNS .

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table,

lr_config_table type ref to cl_salv_wd_config_table.

data: lr_column_ZPM_META type ref to cl_salv_wd_column,

lr_column_ZPM_ORDER type ref to cl_salv_wd_column,

data: lr_header type ref to cl_salv_wd_column_header.

************************************************************************

Get config model

************************************************************************

l_ref_interfacecontroller = wd_this->wd_cpifc_ALV_ORDER( ).

lr_config_table ?= l_ref_interfacecontroller->get_model( ).

**************************

Get rows

**************************

lr_column_ZPM_ORDER = lr_config_table->if_salv_wd_column_settings~get_column( '/BIC/ZPM_ORDER' ).

**************************************

Create header Text

**************************************

lr_header = lr_column_ZPM_ORDER->create_header( ).

lr_header->set_text( 'Auftrag' ).

*****************************************

Set witdh

*****************************************

lr_column_ORDER->SET_RESIZABLE( ABAP_TRUE ).

lr_column_ORDER->set_width( '50' ).

endmethod.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Nov 28, 2008 at 05:10 AM

    Hi,

    This is possible:

    " 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 ).

    You can refer to webdynpro component SALV_WD_TEST_TABLE_PROPS. Go to the view TABLE and look inside the method SET_COLUMN_SETTINGS. I hope this will help you.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 27, 2008 at 10:57 PM

    Ezachiael,

    check CREATE_ATTCH_RESULT_TABLE method in component controller of HRASR00_KEYWORD_SEARCH

    and SET_COLUMN_SETTINGS method of view TABLE in SALV_WD_TEST_TABLE_PROPS

    Thanks

    Bala Duvvuri

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 28, 2008 at 04:28 AM

    Hi,

    Try changing the width of the column with more than 50 and check whether it is chainging.

      lr_caption->set_text_fieldname( 'WBSTX' ).
      lo_column_settings ?= lo_table.
      lo_column = lo_column_settings->get_column( 'WBSTX' ).
      lo_column->set_h_align( cl_wd_table_column=>e_h_align-center ).
      lo_column->set_width( value = '250' ) .
      lo_column->set_fixed_position( cl_wd_abstr_table_column=>e_fixed_position-left ) .
    

    Regards

    Vishal

    Add comment
    10|10000 characters needed characters exceeded