Is there a way to prevent the removal of CL_SALV_TABLE from leading spaces?

Is there a way to prevent the CL_SALV_TABLE instance from being removed from leading spaces in the display?

I have the following code snippet in which I put one space before the text Master and two spaces before the text Slave .

 REPORT zzy. CLASS lcl_main DEFINITION FINAL CREATE PRIVATE. PUBLIC SECTION. CLASS-METHODS: main. ENDCLASS. CLASS lcl_main IMPLEMENTATION. METHOD main. TYPES: BEGIN OF l_tys_test, name TYPE string, value TYPE i, END OF l_tys_test, l_tyt_test TYPE STANDARD TABLE OF l_tys_test WITH EMPTY KEY. DATA(lt_test) = VALUE l_tyt_test( ( name = `Root` value = 0 ) ( name = ` Master` value = 1 ) ( name = ` Slave` value = 2 ) ). cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_salv_table) CHANGING t_table = lt_test ). lo_salv_table->display( ). ENDMETHOD. ENDCLASS. START-OF-SELECTION. lcl_main=>main( ). 

Unfortunately, leading spaces are clipped in the view.

Spaces are trimmed

In this tutorial, the guy seems to have done it somehow.

+5
source share
1 answer

Yes there is:

 lo_salv_table->get_columns( )->get_column( 'NAME' )->set_leading_spaces( abap_true ). 
+7
source

All Articles