Skip to Content
0
Former Member
May 12, 2008 at 07:46 AM

AT NEW .. ENDAT

1164 Views

HI,

I was trying to use the Do.. Varying statement to get the 1st 3 amount in Databaste Table PA0008. However, when i tried to code the program as below and in debug mode, inside the AT New.. ENDAT the value is always zero. After the ENDAT statement, only the value for the amount appears. It's catching the PERNR correctly, but not the amount. Anyone can explain??

DATA: l_bet01 TYPE pa0008-bet01,

l_bet02 TYPE pa0008-bet01.

DATA: wa_0008 TYPE TABLE OF pa0008,

it_0008 LIKE LINE OF wa_0008.

LOOP AT wa_0008 INTO it_0008.

AT NEW pernr.

DO 3 TIMES VARYING l_bet01 FROM it_0008-bet01 NEXT it_0008-bet02.

l_bet02 = l_bet02 + l_bet01.

ENDDO.

MOVE it_0008-pernr TO it_tab-pernr.

MOVE l_bet02 TO it_tab-bet01.

APPEND it_tab TO wa_tab.

Clear it_tab.

ENDAT.

ENDLOOP.

Thanks,

Loo