Skip to Content
0
Former Member
Jan 19, 2006 at 05:45 PM

What does AT END OF do in a loop

764 Views

Hi all, can you please tell me what is the meaning of AT END of in this loop. I know it is calculating summation of a values in the structure XTAB4, but I am not able to understand why is CHARG specified.

Can anyone please help me.

LOOP AT XTAB4.

TEMP_MATNR = XTAB4-MATNR.

TEMP_WERKS = XTAB4-WERKS.

TEMP_LGORT = XTAB4-LGORT.

TEMP_CHARG = XTAB4-CHARG.

AT END OF CHARG.

SUM.

SCHD_STOCK = XTAB4-VBMNJ.

READ TABLE MCHB_INVT_BAL

WITH KEY MATNR = XTAB4-MATNR

WERKS = XTAB4-WERKS

LGORT = XTAB4-LGORT

CHARG = XTAB4-CHARG.

IF SY-SUBRC = 0.

MCHB_INVT_BAL-SDLVY = SCHD_STOCK.

MODIFY MCHB_INVT_BAL INDEX SY-TABIX.

CLEAR MCHB_INVT_BAL.

ENDIF.

ENDAT.

ENDLOOP.

the structure of

DATA : BEGIN OF XTAB4 OCCURS 0,

MATNR LIKE VBBE-MATNR,

WERKS LIKE VBBE-WERKS,

LGORT LIKE VBBE-LGORT,

CHARG LIKE VBBE-CHARG,

VBMNA LIKE VBBE-OMENG,

VBMNB LIKE VBBE-OMENG,

VBMNC LIKE VBBE-OMENG,

VBMNE LIKE VBBE-OMENG,

VBMNG LIKE VBBE-OMENG,

VBMNI LIKE VBBE-OMENG,

VBMNJ LIKE VBBE-OMENG,

VRKME LIKE VBEP-VRKME,

WMENG LIKE VBEP-WMENG,

END OF XTAB4.

thanks,

Sabrina.