loop at td_table1 into th_table1.
at first.
write:/ ‘AT First’.
write:/ sy-tabix.
write:/ th_table1-MATNR,
th_table1-SPRAS.
endat.
at new matnr.
write:/ ‘at new matnr’.
write:/ sy-tabix.
write:/ th_table1-MATNR,
th_table1-SPRAS.
endat.
at end of matnr.
write:/ ‘at end of matnr’.
write:/ sy-tabix.
write:/ th_table1-MATNR,
th_table1-SPRAS.
endat.
at last.
write:/ ‘at last’.
write:/ sy-tabix.
write:/ th_table1-MATNR,
th_table1-SPRAS.
endat.
endloop.
write:/ ‘OK’.
使用测试数据:测试结果
测试小结At first :仅内表的第一行.
AT last:仅内表的最后一行.
AT new <field>:以该field为标记,加上前面的字段,如果是新的记录,则进行;
AT end of <field>:以该field为标记,加上前面的字段,如果它的下一行是新的记录,则进行.
http://scnblogs.techweb.com.cn/tcsapbw/archives/386.html