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

alv interactive

Former Member
0 Likes
951

HI all........

Lets for suppose I am displaying a alv grid display out-put of 20 rows... and I want to display the row numbers too as the first coloum for each row.

viz : Row-no Col1 Col2 Col3

1 data data data

2 data data data

3 data data data

and so on.....

to do that, is there any predefined code is there........?????????

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
926

Hi,

Declare a new column in your internal table and update it with the row number as follows:-

Loop at itab into <fs>.

<fs>-row_number = sy-tabix.

endloop.

In this way you will have the row number of all the lines in your itab and then display it in ALV.

Regards,

Ankur Parab

8 REPLIES 8
Read only

Former Member
0 Likes
927

Hi,

Declare a new column in your internal table and update it with the row number as follows:-

Loop at itab into <fs>.

<fs>-row_number = sy-tabix.

endloop.

In this way you will have the row number of all the lines in your itab and then display it in ALV.

Regards,

Ankur Parab

Read only

0 Likes
926

tHX....... But i dont think it is working

Read only

0 Likes
926

hi kiran, this will definitly work...

please paste your code : final table part...

Read only

0 Likes
926

Hi Kiran,

You can check this code - -

DATA : w TYPE i,
BEGIN OF fs_itab,
  row_id TYPE i,
  carrid TYPE spfli-carrid,
  connid TYPE spfli-connid,
END OF fs_itab,
t_itab LIKE TABLE OF fs_itab.
SELECT carrid
       connid
       FROM spfli
       INTO CORRESPONDING FIELDS OF TABLE t_itab.



LOOP AT t_itab INTO fs_itab.
  fs_itab-row_id = sy-tabix.
  MODIFY t_itab FROM fs_itab TRANSPORTING row_id."WHERE row_id EQ space.
ENDLOOP.
" Now pass this internal table t_itab  to display the ALV

Regards

Pinaki

Read only

0 Likes
926

Ye............ Its the exact answer what I need.

I had missed this statement

-


MODIFY itab TRANSPORTING ROW_NO.

Thanks

Read only

0 Likes
926

hi,

<Fs> means a field symbol.

Using field-symbol in your loop statement will avoid using modify and will speed up the loop also.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
926

hi kiran.

you need to number the rows which are there inyour ouput screen.. rt?

just include one more field in your internal table and incremnt the values .

Loop itab .

your program conditions.

itab-index = c + 1.

c = itab-index

endloop.

now in field catalog add index as the first field and call the alv function

simple..

Read only

Former Member
0 Likes
926

Hi ,

You need to create a Field (with type I) in that table which you are passing in the ALV.

You need to modify that table's field with the SY-TABIX.

Now pass the table in the ALV.

Regards

Pinaki