Skip to Content
author's profile photo Former Member
Former Member

how to add a column in alv grid report to show the serial no.

i need to add column to show the row no. of the report say as :

1

2

3

...

this has to be the first column

how to maintain a variable for this and how to use it??

please help

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 05:54 AM

    one simple way is in your final itab declare a slno type i field

    data : begin of itab occurs 0,

    slno type i,

    <other fields>

    end of itab.

    after filling the data in itab.

    loop at itab.

    itab-slno = sy-tabix.

    modify itab.

    endloop.

    in fieldcatalog also you have to define that slno field as the first column.

    but it will change its order if you are sorting the output or filtering the output.

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      i think in fieldcatalog of the alv you dint define the seltext_l

      just define the fieldcatalog like this

      fieldcat-fieldname = 'SLNO'.

      fieldcat-col_pos = 1.

      fieldcat-outputlen = 5.

      fieldcat-seltext_l = 'S.No.'.

      append fieldcat to ifieldcat

      regards

      shiba dutta

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 06:02 PM

    HI,

    Declare a variable of type i as the first variable in your internal table .. and while populating the records into ur internalt able increment the counter an put that value in this first field.

    Thanks

    Mahesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 06:06 PM

    Hi,

    In your final internal table, while processing the data increment the counter.

    And fill this field in the field catalog and display using ALV.

    Thanks,

    Sri.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.