Hi Expert,
Something that I have found out which is quite interesting. Which is about AT statement in the nested loops. Take the following code as the sample.
TABLES: VBUK,
VBUP.
DATA: itab_vbuk TYPE TABLE OF VBUK WITH HEADER LINE,
itab_vbup TYPE TABLE OF VBUP WITH HEADER LINE.
DATA: counter TYPE i.
START-OF-SELCTION.
SELECT * FROM VBUK INTO TABLE itab_vbuk.
SELECT * FROM VBUP INTO TABLE itab_vbup.
LOOP AT itab_vbuk.
LOOP AT itab_vbup WHERE VBELN = itab_vbuk-vbeln
IF itab_vbup-wbsta = 'C' .
counter = counter + 1.
ENDIF.
AT LAST.
WRITE counter.
CLEAR counter.
ENDAT.
ENDLOOP.
ENDLOOP.
From the sence of logic of this program AT LAST which is correponding to the inner loop, but what I found out is that 'AT LAST' is respond to the outer loop. So are there anyone else have similar case as mine, how would you do if inner loop was about to be the last?