Skip to Content

Add standard count functionality in z report using CL_SALV_ class/ factory mathod

Hello,

I have a requirement where in i want to add the standard count functionality which is available for SAP standard report into my Z report using CL_SALV_LAYOUT/factory method.

Inputs will be appreaciated.

Thank You.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 04, 2017 at 12:50 PM

    Hi.

    I suppose your goal is to activate standard functions. Hope to help. Bye

    DATA: lr_alv       TYPE REF TO cl_salv_table,
    lr_functions TYPE REF TO cl_salv_functions.
    
      TRY.
          CALL METHOD cl_salv_table=>factory
            IMPORTING
              r_salv_table = lr_alv
            CHANGING
              t_table      = gt_out_data.
    
    
          lr_functions = lr_alv->get_functions( ).
          lr_functions->set_all( abap_true ).
    
    
          lr_alv->display( ).
    
        CATCH cx_salv_msg .
      ENDTRY.
    
    Add comment
    10|10000 characters needed characters exceeded

    • Don't you have the "Sum" button? Did you make sure that you have at least one true numeric column? (packed or float, but neither integer, nor numeric text)

      If you have the Sum button and a numeric field, then it MUST work.

  • May 05, 2017 at 07:53 AM

    Hi Ajinkya,

    I think you must do that on your own.

    TRY.
    
        cl_salv_table=>factory(
          IMPORTING
            r_salv_table   = lo_alv
          CHANGING
            t_table        = gt_sflight
        ).
    
        DATA(lo_functions) = lo_alv->get_functions( ).
        lo_functions->set_all( abap_true ).
    
    
        DATA(lo_settings) = lo_alv->get_display_settings( ).
        lo_settings->set_list_header( |Number of Records: { lines( gt_sflight ) }| ).
    
        lo_alv->display( ).
    
      CATCH cx_salv_msg .
    
    ENDTRY.
    

    So you have it in your header. If you want it dynamically you must pass the events for changing the ALV and refresh the header with your actual count.

    Add comment
    10|10000 characters needed characters exceeded