Skip to Content
avatar image
Former Member

Multiple ALV's with toolbar functionality using CL_SALV_TABLE

Hi All,

I am displaying two ALV's using splitter container. For first ALV, I am getting ALV Toolbar. But for second ALV, toolbar bar is not getting displayed. Below is my code wherin I am using CL_SALV_TABLE. Anyone have sample code for two alv's using factory methods, please help me.

START-OF-SELECTION.
go_object->get_data( ).
go_object->fill_output( ).
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& METHOD STATUS_0100 OUTPUT *
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'TITLE'.
CALL METHOD go_object->display_output( ).
ENDMODULE.

METHOD display_output.

display_alv( EXPORTING
container_name = 'CONTAINER1'
CHANGING im_grid = lo_grid1
i_data = t_mara ).

display_alv( EXPORTING
container_name = 'CONTAINER1'
CHANGING im_grid = lo_grid2
i_data = t_marc ).

ENDMETHOD.

METHOD display_alv.

TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = im_grid
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = i_data.
CATCH cx_salv_msg INTO l_result.
go_object->exception_msg( EXPORTING l_result = l_result ).
ENDTRY.

lo_columns = lo_alv->get_columns( ).

lr_column = lo_columns->get_column( c_matnr ).
lr_column->set_output_length( 10 ).

lr_column = lo_columns->get_column( c_mtart ).
lr_column->set_output_length( 10 ).

lr_column = lo_columns->get_column( c_werks ).
lr_column->set_output_length( 10 ).

lr_column = lo_columns->get_column( c_ekgrp ).
lr_column->set_output_length( 10 ).

*-- Display the ALV
lo_alv->display( ).

ENDMETHOD.

Thanks,

HT

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 10 at 11:26 AM

    Hi All,

    Thanks for your inputs.

    After the factory method, I have called
    CALL METHOD set_pf_status
    CHANGING ch_salv = lo_alv.

    And now I can see Main toolbar and also toolbar for both ALV's.


    Issue resolved.

    Thanks,

    Bharath

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 02 at 07:31 PM

    Try clearing your references before you are displaying 2nd ALV. It is actually overwriting.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 03 at 01:58 AM

    I would suggest using two distinct salv objects.

    Add comment
    10|10000 characters needed characters exceeded