Application Development 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: 

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

former_member201541
Participant
0 Kudos

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.

6 REPLIES 6

roberto_vacca2
Active Contributor

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.

0 Kudos

Hello,

Thanks for your reply. I have already done that but that doesnt provide the standard functionality of Count.

I hope I'm clear.

0 Kudos

Hello Ajinkya Ket,

Which is the Count function? Do you mean the summarize one?

0 Kudos

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.

SaschaW
Participant
0 Kudos

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.

Jelena
Active Contributor
0 Kudos

Google -> SALV record count -> 344K results. Were none of them helpful?