Skip to Content
0

Multiple ALV's with toolbar functionality using CL_SALV_TABLE

Apr 02 at 11:55 AM

43

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded

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

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

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

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

Share
10 |10000 characters needed characters left characters exceeded
Pratik Kasralikar Apr 02 at 07:31 PM
1

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

Share
10 |10000 characters needed characters left characters exceeded
Justin Loranger Apr 03 at 01:58 AM
1

I would suggest using two distinct salv objects.

Share
10 |10000 characters needed characters left characters exceeded