cancel
Showing results for 
Search instead for 
Did you mean: 

Problems trying to use set_suppress_empty_data

luis_rod
Participant
0 Kudos
104

Hi all:

(Running ABAP 7.50)

I’m trying to use the set_suppress_empty_dataabap_true ), but keep getting a dump and an error message (Class DISPLAY_SETTINGS, method SET_SUPPRESS_EMPTY_DATA not supported for CL_SALV_TABLE Control Technology).

My test code is as follows:

REPORT ztest.

DATA alv             TYPE REF TO cl_salv_table.
DATA display_setting TYPE REF TO cl_salv_display_settings.
" ====================================
" Get some sample data
" ====================================
select * FROM trdir
  where name = 'DEMO_EXPRESSIONS'
  into table @DATA(itab).

TRY.
  " ====================================
  " Just a plain CL_SALV_TABLE
  " ====================================
    cl_salv_table=>factory( IMPORTING r_salv_table = alv
                            CHANGING  t_table      = itab ).
    display_setting = alv->get_display_settings( ).
  " ====================================
  " This generates a DUMP (ignores TRY)
  " ====================================
    display_setting->set_suppress_empty_data( abap_true ).

    alv->display( ).
  CATCH cx_salv_msg INTO data(error_cx).
    MESSAGE  error_cx TYPE 'E' DISPLAY LIKE 'I'.
ENDTRY.

The error ignores the TRY…CATCH block.

Any ideas?

TIA,

Luis

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor

You only catch CX_SALV_MSG and its subclasses, but not CX_SALV_METHOD_NOT_SUPPORTED which is not a subclass of this one but of CX_SALV_NO_CHECK.

  • Syntax of CATCH - CATCH block handles the exceptions of the exception classes cx_class1 cx_class2 ... that are specified after the statement CATCH, as well as the exceptions of the subclasses of these exception classes
  • The method seems only allowed on list and hierarchy sequence, not tree and grids
luis_rod
Participant
0 Kudos
Raymond: "The method seems only allowed on list and hierarchy sequence, not tree and grids". Thanks!! That's the answer I needed. The TRY...CATCH portion is, in fact, not as important. The code depicted was just a quick and dirty test for the set_suppress_empty_data() method. Thanks again, Luis

Answers (0)