‎2007 Aug 07 9:43 AM
Hi to all experts.
I have some data in itfinal table.
While printing this table data I want to add serial no at first column.
How can do this.
Plase give me sample code.
Thanks in advance an d reward also
Regard : deep
‎2007 Aug 07 9:45 AM
hI..
Loop at it_final into Wa_final.
WRITE:/ SY-TABIX,
WA_FINAL-FIELD1,
WA_FINAL-FIELD2.
endloop.
SY-tabix Stores the current loop pass in LOOP ENDLOOP
so you use it to display Serial no.
<b>Reward if Helpful</b>
‎2007 Aug 07 9:49 AM
In the internal table that is being listed out, have a field at the beginning and call it as serial.
loop at itab.
itab-serial = sy-tabix .
modify itab.
clear itab.
endloop.
Regards
‎2007 Aug 07 10:59 AM
Hi,
refer to the following code:
report ztx1104.
data: begin of it occurs 3,
f1(1),
f2(2),
end of it.
it-f1 = 'A'.
it-f2 = 'XX'.
append it to it. "appends header line IT to body IT
it-f1 = 'B'.
it-f2 = 'YY'.
append it. "same as line 8
it-f1 = 'C'.
append it. "the internal table now contains three rows.
sy-tabix = sy-subrc = 99.
loop at it. "same as: loop at it into it
write: / sy-tabix, it-f1, it-f2.
endloop.
write: / 'done. sy-tabix =', sy-tabix,
/ ' sy-subrc =', sy-subrc.
The code above produces this output:
1 A XX
2 B YY
3 C YY
done. sy-tabix = 99
sy-subrc = 0
Hope this hellps.
Reward if helpful.
regards,
Sipra
‎2007 Aug 07 11:01 AM
loop at itab.
write: /10 sy-tabix,
20 itab-field1,
30 itab-field2...
endloop.
Regards,
Pavan