on 03-22-2015 8:02 AM
Hi All,
I need to display a row count in my ALV table.
It is suppose to be located within the ALV (header or preferably footer).
The row count must be calculated dynamically based on the current lines of the ALV (including any filter that the user may apply).
Best Regards,
Aviad
Hi Aviad,
The following lines of code will show the row count in the last line.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_<Your ALV component usage name>( ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
).
CALL METHOD lv_value->if_salv_wd_std_functions~set_count_records_allowed
EXPORTING
value = abap_true.
CALL METHOD lv_value->if_salv_wd_field_settings~set_count_records_enabled
EXPORTING
value = abap_true.
The result is as below:
Initially without any filter
After applying filter:
Let me know if does not help you. there is some other way.
Regards,
Ajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aviad,
You can achive this functionality to display no of entries after filter criteria on your ALV toolbar.
=> Create and input field with label which will display no of entries.
Set READY_ONLY property of input field.
=> Create an node to store entry value
Node name: FUNCTION_ELEMENT
Attribute: ENTRIES type string.
=> Bind the above node to node 'FUNCTION_ELEMENT' of ALV interfacecontroller_usage.
=> Create an method in your view to calculate entries
Method type: EVENT HANDLER
Event: ON_STD_FUNCTION_AFTE of your ALV component
=> Write below code.
Data: lt_entries type if_SALV_bs=>t_type_row,
lt_entries_out type if_SALV_bs=>t_type_row.
Fetch the node entries into an internal table which you have used to display data on ALV.
CL_SALV_WD_FILTER_EXECUTE(
EXPORTING
T_INPUT = INTERNAL-TABLE
T_FIELDS = ALV_MODEL->IF_SALV_WD_FIELD_SETTINGS~T_FIELDS
CHANGING
T-ROWS = LT_ENTRIES
T_ROWS_OUTSIDE = LT_ENTRIES_OUT
EXPECTIONS
NO_FILTER-RULES = 1 ).
DESCRIBE TABLE LT_ENTRIES LINES L_ENTRIES.
Bind L_entries to node FUNCTION_ELEMENT->ENTRIES.
In this way you can have no of entries on your ALV toolbar.
Output attached...
Hope with will help you...
After copying the code I get the following error:
Method "CL_SALV_WD_FILTER_EXECUTE" is unknown or PROTECTED or PRIVATE.
Edited:
It suppose to be CL_SALV_WD_FILTER=>EXECUTE
Aviad
Message was edited by: Aviad Levy
Hi,
Just a few minor adjustments
CALL METHOD cl_salv_wd_filter=>execute(
EXPORTING
t_input = <INTERNAL-TABLE>
t_fields = lo_value->if_salv_wd_field_settings~t_fields
CHANGING
t_rows = lt_entries
t_row_outside = lt_entries_out
EXCEPTIONS
no_filter_rules = 1 ).
IF sy-subrc EQ 0.
DESCRIBE TABLE lt_entries LINES l_entries.
ELSE.
DESCRIBE TABLE <INTERNAL-TABLE> LINES l_entries.
ENDIF.
Aviad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.