Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple ALV's with toolbar functionality using CL_SALV_TABLE

Bharath84
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

Bharath84
Participant
0 Kudos

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

4 REPLIES 4

pokrakam
Active Contributor
0 Kudos

Please use code formatting, it makes it easier to read.

kasralikarpratik
Explorer

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

jdloranger
Participant

I would suggest using two distinct salv objects.

Bharath84
Participant
0 Kudos

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