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

serial numbers

Former Member
0 Likes
2,493

Hi Experts,

How to get serial numbers in ALV's ?

Thanks & Regards,

Sreedhar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,081

after all the data is fetched in your itab.

loop at itab.

itab-slno = sy-tabix.

modify itab index sy-tabix.

endloop.

it will show the sl no but if you sort or filter it will not rearrange the thing.

regards

shiba dutta

Hi Experts,

How to get serial numbers in ALV's ?

Thanks & Regards,

Sreedhar.

14 REPLIES 14
Read only

Former Member
0 Likes
2,081

declare one field in internal table. And append the values by increment.

Read only

0 Likes
2,081

loop at itab.

itab-serial_no = sy-tabix.

modify itab index sy-tabix.

endloop.

pass this internal table to ALV grid FM..

amit

Read only

Former Member
0 Likes
2,082

after all the data is fetched in your itab.

loop at itab.

itab-slno = sy-tabix.

modify itab index sy-tabix.

endloop.

it will show the sl no but if you sort or filter it will not rearrange the thing.

regards

shiba dutta

Read only

0 Likes
2,081

Hi,

i am taken the field slno, but it comes dump.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = POS.

LS_FIELDCAT-FIELDNAME = 'slno'.

LS_FIELDCAT-SELTEXT_M = 'Serial No'.

APPEND LS_FIELDCAT TO RT_FIELDCAT.

CLEAR LS_FIELDCAT.

Read only

0 Likes
2,081

Hi Sreedhar ,

LS_FIELDCAT-COL_POS = POS.

What is the value of the varaible POS.

Regards

Arun

Read only

0 Likes
2,081

Thank U Shiba & all.

it is working.

Sreedhar.

Read only

Former Member
0 Likes
2,081

make the one column for number in internal table.

after getting the all values in itab.

loop at itab.
itab-slno = sy-tabix.
modify itab index sy-tabix.
endloop.

now use this internal table for alv.

Read only

Former Member
0 Likes
2,081

Hi,

You need to add an additional field in the internal table which you are going to disply as ALV and just before displaying the ALV , modify the internal table populating the serial number.

But i would not prefer having serial number in ALV , because in ALV we have many feature like Sort e.t.c , when you do all this the sequence of serial number will not be correct.

Regard's

Arun

Read only

Former Member
0 Likes
2,081

CHECK WHETHER YOUR POS CONTAINS 0 VALUE OR NOT.

IT MUST START AT 1.

AND CHECK WHETHER IT IS COINCIDING WITH ANY OTHER FIELDS OR NOT

REGARDS

SHIBA DUTTA

Read only

0 Likes
2,081

Hi shiba,

i am given the pos = 1, still the dump is continiue.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = 1.

LS_FIELDCAT-FIELDNAME = 'slno'.

LS_FIELDCAT-SELTEXT_M = 'Serial No'.

APPEND LS_FIELDCAT TO RT_FIELDCAT.

CLEAR LS_FIELDCAT.

Read only

Former Member
0 Likes
2,081

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = 1.

LS_FIELDCAT-FIELDNAME = 'slno'.

LS_FIELDCAT-SELTEXT_M = 'Serial No'.

APPEND LS_FIELDCAT TO RT_FIELDCAT.

CLEAR LS_FIELDCAT.

Give the field name in capital letters and try

LS_FIELDCAT-FIELDNAME = 'SLNO'.

Read only

Former Member
0 Likes
2,081

give field name in caps

regards

shiba dutta

Read only

0 Likes
2,081

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = 1.

<b>LS_FIELDCAT-FIELDNAME = 'SLNO'.</b>--->caps

LS_FIELDCAT-SELTEXT_M = 'Serial No'.

APPEND LS_FIELDCAT TO RT_FIELDCAT.

CLEAR LS_FIELDCAT

kishan negi

Read only

Former Member
0 Likes
2,081

ADD A SEPERATE FIELD IN INTERNAL TABLE , COUNTER FIELD.