Skip to Content
0

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

May 04, 2017 at 12:48 PM

110

avatar image

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.

10 |10000 characters needed characters left characters exceeded

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

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Roberto Vacca May 04, 2017 at 12:50 PM
1

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.
Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

Hello Ajinkya Ket,

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

0

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.

0
Sascha Wächter May 05, 2017 at 07:53 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded