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

Single Scroll Bar for multiple ALV

Hi Experts,

I have a requirement, i am placing 5 ALVs in a module pool screen which consist of 20 to 30 fields in each alv.i have done this by creating custom containers using OO ALV. As it consist of multiple fields we are getting horizontal scroll bars for each alv. so customer requirement was to place single

scroll bar for all ALVs .

Thanks,

Charan Tej

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Aug 14, 2016 at 09:43 AM

    Hi,

    Please look a my blog entry on this subject using the code in my responses here

    The case of multiple ALV horizontal scrolling

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 10, 2016 at 11:08 PM

    The only way you can do this is to make the screen so wide that the ALV's do not get scollbars, you then will get a scroll bar for the screen which will scroll all the tables. Note that this solution is not really scalable and that you cannot lock any key columns.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2016 at 03:52 AM

    Hi,

    ALV containers are independent of screen and other containers, you can increase the width of the screen and width of custom container in the layout!!

    thank you!!

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2016 at 03:56 AM

    Hi,

    Thinking aloud...

    We do have in CL_GUI_ALV_GRID method SET_SCROLL_INFO_VIA_ID

    I never used the IS_COL_INFO but it seems that you can (by adding some buttons and code....) utilize it .

    Worth a try.

    Also have a look at BCALV_TEST_GRID_INDEX

    Regards.

    Eitan.


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2016 at 07:49 AM

    Hi,

    Small update: (A bug found by my teammate Haim Bracha 🤪)

    And using CLASS-METHODS

    CLASS-METHODS: user_command_scroll

    IMPORTING

    e_ucomm TYPE syucomm

    ob_gui_alv_grid TYPE REF TO cl_gui_alv_grid .

    *----------------------------------------------------------------------*

    METHOD user_command_scroll .

    DATA: it_fieldcatalog TYPE lvc_t_fcat .

    DATA: st_fieldcatalog LIKE LINE OF it_fieldcatalog .

    DATA: st_row_no TYPE lvc_s_roid .

    DATA: st_row_info TYPE lvc_s_row .

    DATA: st_col_info TYPE lvc_s_col .

    ob_gui_alv_grid->get_scroll_info_via_id( IMPORTING

    es_row_no = st_row_no

    es_col_info = st_col_info

    es_row_info = st_row_info

    ) .

    ob_gui_alv_grid->get_frontend_fieldcatalog( IMPORTING et_fieldcatalog = it_fieldcatalog ) .

    DELETE it_fieldcatalog WHERE no_out EQ abap_true .

    DELETE it_fieldcatalog WHERE tech EQ abap_true .

    SORT it_fieldcatalog BY col_pos .

    FIELD-SYMBOLS: <st_fieldcatalog> LIKE LINE OF it_fieldcatalog .

    * Resequence

    LOOP AT it_fieldcatalog ASSIGNING <st_fieldcatalog> .

    <st_fieldcatalog>-col_pos = sy-tabix .

    ENDLOOP .

    READ TABLE it_fieldcatalog into st_fieldcatalog

    WITH KEY

    fieldname = st_col_info-fieldname .

    CHECK sy-subrc EQ 0 .

    CASE e_ucomm .

    WHEN cl_event_receiver=>c_column_right .

    st_fieldcatalog-col_pos = st_fieldcatalog-col_pos + 1 .

    WHEN cl_event_receiver=>c_column_left .

    st_fieldcatalog-col_pos = st_fieldcatalog-col_pos - 1 .

    WHEN OTHERS.

    ENDCASE.

    READ TABLE it_fieldcatalog INTO st_fieldcatalog

    WITH KEY

    col_pos = st_fieldcatalog-col_pos .

    CHECK sy-subrc EQ 0 .

    st_col_info-fieldname = st_fieldcatalog-fieldname .

    ob_gui_alv_grid->set_scroll_info_via_id( EXPORTING

    is_row_no = st_row_no

    is_col_info = st_col_info

    is_row_info = st_row_info

    ) .

    ENDMETHOD . "user_command_scroll

    *----------------------------------------------------------------------*

    In user_command we have :

    *----------------------------------------------------------------------*

    METHOD user_command .

    CASE e_ucomm.

    WHEN cl_event_receiver=>c_column_right OR

    cl_event_receiver=>c_column_left .

    user_command_scroll( EXPORTING e_ucomm = e_ucomm ob_gui_alv_grid = ob_gui_alv_grid_1 ) .

    ENDCASE.

    ENDMETHOD . "handle_user_command

    *----------------------------------------------------------------------*

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 10, 2016 at 09:06 PM

    Charan,

    I don't think this is possible since each ALV is an object independent of the others which sits in its own container.

    I might be wrong and will check what others say.

    Thanks,

    Vikram.M

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2016 at 06:21 AM

    Hi,

    Some fresh code... (fragments)

    In my program level cl_event_receiver:

    PUBLIC SECTION.

    CONSTANTS: c_column_left TYPE syucomm VALUE 'COLUMN_LEFT' ,

    c_column_right TYPE syucomm VALUE 'COLUMN_RIGHT' .

    METHODS: toolbar

    FOR EVENT toolbar OF cl_gui_alv_grid

    IMPORTING e_object e_interactive .

    METHODS: user_command

    FOR EVENT user_command OF cl_gui_alv_grid

    IMPORTING e_ucomm .

    *----------------------------------------------------------------------*

    METHOD toolbar.

    FIELD-SYMBOLS: <st_toolbar> LIKE LINE OF e_object->mt_toolbar .

    APPEND INITIAL LINE TO e_object->mt_toolbar ASSIGNING <st_toolbar> .

    <st_toolbar>-function = c_column_left .

    <st_toolbar>-icon = icon_column_left .

    APPEND INITIAL LINE TO e_object->mt_toolbar ASSIGNING <st_toolbar> .

    <st_toolbar>-function = c_column_right .

    <st_toolbar>-icon = icon_column_right .

    ENDMETHOD. "handle_toolbar

    *----------------------------------------------------------------------*

    METHOD user_command .

    DATA: it_fieldcatalog TYPE lvc_t_fcat .

    DATA: st_fieldcatalog LIKE LINE OF it_fieldcatalog .

    DATA: st_row_no TYPE lvc_s_roid .

    DATA: st_row_info TYPE lvc_s_row .

    DATA: st_col_info TYPE lvc_s_col .

    CASE e_ucomm.

    WHEN cl_event_receiver=>c_column_right OR

    cl_event_receiver=>c_column_left .

    ob_gui_alv_grid_1->get_scroll_info_via_id( IMPORTING

    es_row_no = st_row_no

    es_col_info = st_col_info

    es_row_info = st_row_info

    ) .

    ob_gui_alv_grid_1->get_frontend_fieldcatalog( IMPORTING et_fieldcatalog = it_fieldcatalog ) .

    DELETE it_fieldcatalog WHERE no_out EQ abap_true .

    DELETE it_fieldcatalog WHERE tech EQ abap_true .

    READ TABLE it_fieldcatalog INTO st_fieldcatalog

    WITH KEY

    fieldname = st_col_info-fieldname .

    CHECK sy-subrc EQ 0 .

    CASE e_ucomm .

    WHEN cl_event_receiver=>c_column_right .

    st_fieldcatalog-col_pos = st_fieldcatalog-col_pos + 1 .

    WHEN cl_event_receiver=>c_column_left .

    st_fieldcatalog-col_pos = st_fieldcatalog-col_pos - 1 .

    WHEN OTHERS.

    ENDCASE.

    READ TABLE it_fieldcatalog INTO st_fieldcatalog

    WITH KEY

    col_pos = st_fieldcatalog-col_pos .

    CHECK sy-subrc EQ 0 .

    st_col_info-fieldname = st_fieldcatalog-fieldname .

    ob_gui_alv_grid_1->set_scroll_info_via_id( EXPORTING

    is_row_no = st_row_no

    is_col_info = st_col_info

    is_row_info = st_row_info

    ) .

    ENDCASE.

    ENDMETHOD . "handle_user_command

    *----------------------------------------------------------------------*

    In your case you might need to put the buttons in a status not in the individual grids .

    you have to repeat the code for each grid (hint: create a static method that will accept a grid as parameter )

    Regards.

    Eitan.


    pastedImage_0.png (22.2 kB)
    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.