Skip to Content
author's profile photo Former Member
Former Member

resizable table columns

Hello experts!

I have 2 questions

1) How can I make a table column resizable , so user can play with its size?

2) How to make an ALV column optimized in web dynpro as the same as in dynpro?

thnaks for your help!!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Sep 29, 2013 at 12:45 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2013 at 06:18 PM

    Hi,

    Can use below logic to resize the ALV table column.

    For increasing Display layout width to 100 use below code

    DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
    DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
    DATA l_table TYPE REF TO cl_salv_wd_config_table.

    l_ref_cmp_usage = wd_this->wd_cpuse_it_alv( ).

    IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
    ENDIF.

    l_salv_wd_table = wd_this->wd_cpifc_it_alv( ).
    l_table = l_salv_wd_table->get_model( ).


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

    And please refer standard WD component where column setting scenario is handled

    WD componant name: SALV_WD_TEST_TABLE_PROPS.

    2)

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


    LR_TABLE_SETTING->SET_FIXED_TABLE_LAYOUT( ABAP_TRUE ).

    Check above code, may be usefull.

    Regards,

    Shaik Farooq

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.