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: 

Alv Grid -> Number of records

Former Member
0 Kudos

Hi all,

We have a few programs calling alv grid using the oo method. However, we need to change the program to cater for when users do a filter of the results, so that the number of records shld be dynamic, instead of passed in from the abap program.

Can someone pt me to the correct way of doing this? I would like to avoid using the call function way of calling the alv grid.

DATA : PS_LAYOUT TYPE LVC_S_LAYO.

DATA : TITLE(70).

CONCATENATE 'Records selected : ' COUNTER INTO TITLE.

PS_LAYOUT-GRID_TITLE = title.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_VARIANT = GS_LAYOUT

I_SAVE = X_SAVE

I_DEFAULT = 'X'

IS_LAYOUT = GT_LAYOUT

CHANGING

IT_OUTTAB = ITAB1[]

IT_FIELDCATALOG = GT_FIELDCAT.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Leonard,

When you use the Filter functuionality for the ALV Grid, adjusting the number of rows to satisfy the filter condition will take place automatically.

You can take a look at the example program BCALV_TEST_FULLSCREEN_FILTER. Observe how the number of rows gets changed as you change the filter automatically. These filters can also be set and manipulated programmatically.

Regards,

Anand Mandalika.

6 REPLIES 6

Former Member
0 Kudos

Hi Leonard,

When you use the Filter functuionality for the ALV Grid, adjusting the number of rows to satisfy the filter condition will take place automatically.

You can take a look at the example program BCALV_TEST_FULLSCREEN_FILTER. Observe how the number of rows gets changed as you change the filter automatically. These filters can also be set and manipulated programmatically.

Regards,

Anand Mandalika.

0 Kudos

hi anand,

thanks for your help, i mean is there anyway for me to capture the number of rows that is displayed after the filtering has been set.

regards.

0 Kudos

Hi Leo,

Have you tried using the method GET_FILTERED_ENTRIES ?

Regards,

anand mandalika.

0 Kudos

That method would give you the list of the indexes of all the entries of the table that have now becme hidden as a result of applyting the filter.

So, you now have the total number of entries in the internal table ans the number of entries that are hidden. you can easily obtain the number of entries that are being displayed.

Lemme know if that helped. If yes, reward points and close the thread. Otherwise get back with any problem that you may be facing.

Regards,

Anand Mandalika.

0 Kudos

Pls bear with me, i'm very new to abap alv programming.

Does this mean i have to declare a event handler, and when a filter action is being done, i have to call the alv grid again? updating my header as needed.

What i need is something like this:-

Number of records : 100 "GRID-TITLE

ALV Grid with 100 records.

*Users filter resets to 50 records.

Number of records : 50 "GRID-TITLE

ALV Grid with 50 records.

0 Kudos

That is correct. Just give it a try and let me know if you're facing some problems doing that.