2009 May 21 12:21 PM
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........?????????
2009 May 21 12:26 PM
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
hi kiran, this will definitly work...
please paste your code : final table part...
2009 May 21 12:26 PM
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
2009 May 21 12:35 PM
2009 May 21 12:44 PM
hi kiran, this will definitly work...
please paste your code : final table part...
2009 May 21 12:45 PM
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 ALVRegards
Pinaki
2009 May 21 12:55 PM
Ye............ Its the exact answer what I need.
I had missed this statement
-
MODIFY itab TRANSPORTING ROW_NO.
Thanks
2009 May 21 12:55 PM
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
2009 May 21 12:27 PM
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..
2009 May 21 12:31 PM
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
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |