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

sequence number the internal table

Former Member
0 Likes
2,511

How can i get my internal table numbered sequentially.

6 REPLIES 6
Read only

Former Member
0 Likes
1,207

loop at itab.

write:/ sy-tabix.

endloop.

Read only

Former Member
0 Likes
1,207
1. Add one more field to ur final internal table
     data : begin of itab occurs 0,
                  seq_no like sy-tabix,
                   ........
              end of itab.

2. loop at itab into wa_itab.
        itab-seq_no = sy-tabix.
        modify itab from wa_itab.
    endloop.
Read only

0 Likes
1,207

my itab is without a header line

Read only

Former Member
0 Likes
1,207

data : begin of itab occurs 0,

slno type i,

colma(5) typec,

colmb(5) type c,

end of itab.

after fetching all the data in itab.

loop at itab.

itab-slno = sy-tabix.

modify itab.

endloop.

now your itab sl no contains 1 a b, 2 b c like that.

ifyou want to write that.

after fetching all the data in your itab

loop at itab.

write : / sy-tabix, itab-colma,itab-colmb.

endloop.

here you dont need to declare the slno in itab.

regards

shiba dutta

Read only

Former Member
0 Likes
1,207

Hi khan,

<b>check this code</b>

data : begin of itab occurs 0,

sno like sy-tabix,

vbeln like likp-vbeln,

netwr like likp-netwr,

end of itab.

itab-vbeln = '0005002035'.

itab-netwr = '5.78'.

append itab.

clear itab.

itab-vbeln = '0005002035'.

itab-netwr = '-3.25'.

append itab.

clear itab.

itab-vbeln = '0005002035'.

itab-netwr = '-8.47'.

append itab.

clear itab.

itab-vbeln = '0005002035'.

itab-netwr = '1.98'.

append itab.

clear itab.

loop at itab.

itab-sno = sy-tabix.

modify itab index sy-tabix.

endloop.

loop at itab.

write : / itab-sno , itab-vbeln , itab-netwr .

endloop.

Read only

Former Member
0 Likes
1,207

loop at itab.

itab-sqno = sy-tabix.

modify itab index sy-tabix.

endloop.