Application Development and Automation 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: 
Read only

Total record in list

Former Member
0 Likes
843

Hi!

i am using alv grid and i got the output. In the list i want to display the total number of records in the alv grid list.

thanks.....

Hi!

i am using alv grid and i got the output. In the list i want to display the total number of records in the alv grid list.

thanks.....

5 REPLIES 5
Read only

Former Member
0 Likes
812
Read only

Former Member
0 Likes
812

hi,

before displaying the internal table , describe itab line v_count.

you will have total no of records in ALV.

You can use this variable if you want to display total no of records in ALV.

Read only

Former Member
0 Likes
812

hi,use GET_COMPONENT_LIST

thanks

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
812

Hi,

If this is an ALV Grid report, then there are 2 answers:

===Answer1 (recommended by SAP)===

1. Create a "count" column of type I in your internal table.

2. In the field catalog specify do_sum = 'X'.

3. Put the value 1 in every record in your internal table:

LOOP AT itab.

itab-count = 1.

modify itab transporting count.

ENDLOOP.

===Answer2===

1. Add to your ITAB a column type c length 4 called color.

2. Put dummy data lines into the itab, and set their color to 'C310'. The alv Grid layout needs to set as:

ls_layout-info_fieldname = 'COLOR'.

3. In those dummy data lines, calculate the number of rows (the count) and put it as data.

4. You will have to add a hidden column (in FCAT: tech='X') and sort by it. For the dummy lines put '1' (for subtotal) or '2' (for total) and for regular data lines keep it initial.

The drawback of this approach is that the user has the power of destroying the sorting, so the yellow lines are not displayed at the end of report.

Let me know if you need some help.

Hope this helps you.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
812

Hi Balaji,

You can use DESCRIBE TABLE itab..

DESCRIBE TABLE itab. " internal table for ALV GRID.

WRITE: / SY-TFILL. " Number of rows..

Regards,

Nitin.