Application Development and Automation 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: 
Read only

Problem when creating multiple traffic lights column in SALV...

aris_hidalgo
Contributor
0 Likes
863

Hello Experts,

I am using ALV display using the SALV(factory) method. My problem is,

only the last excception column shows. I making 3 exception columns. Below is my code:


gt_output[] = im_output[].

    TRY.
        cl_salv_table=>factory(
          EXPORTING
            list_display = ''
          IMPORTING
            r_salv_table = lcl_table
          CHANGING
            t_table      = gt_output ).
      CATCH cx_salv_msg.                                "#EC NO_HANDLER
    ENDTRY.

    lcl_functions = lcl_table->get_functions( ).
*   Set all standard ALV functions
    lcl_functions->set_all( abap_true ).

    lcl_columns = lcl_table->get_columns( ).
    lcl_columns->set_optimize( '' ).

*   Set display to striped pattern
    lcl_display = lcl_table->get_display_settings( ).
    lcl_display->set_striped_pattern( cl_salv_display_settings=>true ).

*/Sort columns
    TRY.
        lcl_sorts = lcl_table->get_sorts( ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

    lcl_sorts->set_group_active( ).

    TRY.
        lcl_sorts->add_sort(
          columnname = 'EBELN'
          subtotal   = '' ).
      CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
    ENDTRY.

    TRY.
        lcl_sorts->add_sort(
          columnname = 'EBELP'
          subtotal   = '' ).
      CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
    ENDTRY.

*/Set column names
    TRY.
        lcl_columns->set_exception_column( 'EXCEPTION1' ).
        lcl_columns->set_exception_column( 'EXCEPTION2' ).
        lcl_columns->set_exception_column( 'EXCEPTION3' ).
      CATCH cx_salv_data_error.                         "#EC NO_HANDLER
    ENDTRY.

    TRY.
        lcl_column ?= lcl_columns->get_column( 'EXCEPTION1' ).
        lcl_column->set_short_text( text-h01 ).
        lcl_column->set_medium_text( text-h01 ).
        lcl_column->set_long_text( text-h01 ).
        lcl_column->set_output_length( '9' ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

*    TRY.
*        lcl_columns->set_exception_column( 'EXCEPTION2' ).
*      CATCH cx_salv_data_error.                         "#EC NO_HANDLER
*    ENDTRY.

    TRY.
        lcl_column ?= lcl_columns->get_column( 'EXCEPTION2' ).
*        lcl_column->set_short_text( text-h07 ).
        lcl_column->set_medium_text( text-h07 ).
        lcl_column->set_long_text( text-h07 ).
        lcl_column->set_output_length( '15' ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

*    TRY.
*        lcl_columns->set_exception_column( 'EXCEPTION3' ).
*      CATCH cx_salv_data_error.                         "#EC NO_HANDLER
*    ENDTRY.

    TRY.
        lcl_column ?= lcl_columns->get_column( 'EXCEPTION3' ).
*        lcl_column->set_short_text( text-h08 ).
*        lcl_column->set_medium_text( text-h08 ).
        lcl_column->set_long_text( text-h08 ).
        lcl_column->set_output_length( '23' ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

Hope you can help me guys. Thank you and take care!

Edited by: Viraylab on Feb 15, 2008 3:50 PM

Hello Experts,

I am using ALV display using the SALV(factory) method. My problem is,

only the last excception column shows. I making 3 exception columns. Below is my code:


gt_output[] = im_output[].

    TRY.
        cl_salv_table=>factory(
          EXPORTING
            list_display = ''
          IMPORTING
            r_salv_table = lcl_table
          CHANGING
            t_table      = gt_output ).
      CATCH cx_salv_msg.                                "#EC NO_HANDLER
    ENDTRY.

    lcl_functions = lcl_table->get_functions( ).
*   Set all standard ALV functions
    lcl_functions->set_all( abap_true ).

    lcl_columns = lcl_table->get_columns( ).
    lcl_columns->set_optimize( '' ).

*   Set display to striped pattern
    lcl_display = lcl_table->get_display_settings( ).
    lcl_display->set_striped_pattern( cl_salv_display_settings=>true ).

*/Sort columns
    TRY.
        lcl_sorts = lcl_table->get_sorts( ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

    lcl_sorts->set_group_active( ).

    TRY.
        lcl_sorts->add_sort(
          columnname = 'EBELN'
          subtotal   = '' ).
      CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
    ENDTRY.

    TRY.
        lcl_sorts->add_sort(
          columnname = 'EBELP'
          subtotal   = '' ).
      CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
    ENDTRY.

*/Set column names
    TRY.
        lcl_columns->set_exception_column( 'EXCEPTION1' ).
        lcl_columns->set_exception_column( 'EXCEPTION2' ).
        lcl_columns->set_exception_column( 'EXCEPTION3' ).
      CATCH cx_salv_data_error.                         "#EC NO_HANDLER
    ENDTRY.

    TRY.
        lcl_column ?= lcl_columns->get_column( 'EXCEPTION1' ).
        lcl_column->set_short_text( text-h01 ).
        lcl_column->set_medium_text( text-h01 ).
        lcl_column->set_long_text( text-h01 ).
        lcl_column->set_output_length( '9' ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

*    TRY.
*        lcl_columns->set_exception_column( 'EXCEPTION2' ).
*      CATCH cx_salv_data_error.                         "#EC NO_HANDLER
*    ENDTRY.

    TRY.
        lcl_column ?= lcl_columns->get_column( 'EXCEPTION2' ).
*        lcl_column->set_short_text( text-h07 ).
        lcl_column->set_medium_text( text-h07 ).
        lcl_column->set_long_text( text-h07 ).
        lcl_column->set_output_length( '15' ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

*    TRY.
*        lcl_columns->set_exception_column( 'EXCEPTION3' ).
*      CATCH cx_salv_data_error.                         "#EC NO_HANDLER
*    ENDTRY.

    TRY.
        lcl_column ?= lcl_columns->get_column( 'EXCEPTION3' ).
*        lcl_column->set_short_text( text-h08 ).
*        lcl_column->set_medium_text( text-h08 ).
        lcl_column->set_long_text( text-h08 ).
        lcl_column->set_output_length( '23' ).
      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    ENDTRY.

Hope you can help me guys. Thank you and take care!

Edited by: Viraylab on Feb 15, 2008 3:50 PM

2 REPLIES 2
Read only

aris_hidalgo
Contributor
0 Likes
615

Hi Guys,

Any help on my problem? Thanks!

Read only

Former Member
0 Likes
615

you can only define one exception per alv table. it's a limitation.

if you require more than one traffic light, use icons instead