Skip to Content

Serial number in table control

Hi All,

I am using a table control wizard in which i have 3 fields. 2 fields will be filled by the user. I have a field in which the serial number has to be shown.

How to get the serial number automatically in table control.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Sep 08, 2009 at 07:04 AM

    Hi,

    Lets say you are using itab as your internal table in PAI and PBO

    in PBO

    module update_itab.

    loop at itab with control tc

    endloop.

    in Program.

    module update_itab

    data : sr_no type i.

    clear sr_no.

    loop at itab.

    itab-sr_no = sr_no + 1.

    modify itab index sy-tabix. ---> this will update your itab with serial number

    endloop.

    endmodule

    Cheers

    Ram

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2009 at 07:08 AM

    Hi,

    I suppose serial number would be a number that you ahve to automatically generate based on the number of entries on the table control , it would nto be saved in database then try like below:

    PBO:

    For the entries that you already are displaying on the screen you need to assign values to this before the data is displayed first time so here i am supposing that the internal table from which you are displaying has a field for serial number, so just before diplaying loop on the data and assign the serial numbers like below:

    
    loop  on it_display.
     if not  it_display is initial.
     it_display-serialno = it_display-serialno + 1.
    modify it_display index sy-tabix transporting serialno.
    endif.
    endloop.
    

    PAI:

    For the new entries as soon as the entries are made you need to generate the entries so do like below:

    loop on it_dsplay.
    chain.
    field field1.
    field field2.
    .....
    field serialno module generate_serialno on input.
    endchain.
    endloop.
    

    module generate_serialno input.

    here put your logic to get the next serial number you might have to save the last used serial number in a global variable.

    REgards,

    Himanshu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 02:34 AM

    add a integer field in the table control.

    In pbo

    loop at itab with control tc.

    module display.

    endloop.

    module display output.

    move itab to tcfields.

    int-field = tc-current_line.

    endloop.

    No need to add a field in itab.

    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.