Skip to Content
0
Former Member
Nov 09, 2006 at 09:36 AM

Sy-tabix

44 Views

At the end of first loop sy-tabix carries value 3.

why its not get cleared when second loop starts.

In the second loop value starts from 3+

  • Monday

CLEAR: WA_BPSTAB, WA_BPSTAB2 .

LOOP AT GT_FINAL ASSIGNING <GT_FINAL>

WHERE DAY = '1'.

<b> MOVE SY-TABIX TO LV_INDEX_MON.</b>

clear sy-tabix.

  • MOVE <GT_FINAL>-MATNR TO WA_BPSTAB-MONDAY.

WRITE <GT_FINAL>-MATNR TO WA_BPSTAB-MONDAY.

MOVE <GT_FINAL>-QUANTITY TO WA_BPSTAB2-MONDAY.

APPEND WA_BPSTAB TO GT_BPSTAB.

APPEND WA_BPSTAB2 TO GT_BPSTAB.

LS_SUM_MON = LS_SUM_MON + <GT_FINAL>-QUANTITY.

ENDLOOP.

*WRITE <GT_FINAL>-QUANTITY RIGHT-JUSTIFIED TO LV_DUMMY.

*Tuesday

LV_COUNTER = 13 .

LOOP AT GT_FINAL ASSIGNING <GT_FINAL>

WHERE DAY = '2'.

<b>MOVE SY-TABIX TO LV_INDEX_TUE.</b>

READ TABLE GT_BPSTAB ASSIGNING <GT_BPSTAB>

INDEX LV_COUNTER.

IF SY-SUBRC = 0 .

WRITE <GT_FINAL>-MATNR TO <GT_BPSTAB>-TUESDAY.

ADD 1 TO LV_COUNTER .

READ TABLE GT_BPSTAB ASSIGNING <GT_BPSTAB>

INDEX LV_COUNTER.

IF SY-SUBRC = 0 .

MOVE <GT_FINAL>-QUANTITY TO <GT_BPSTAB>-TUESDAY.

ADD 1 TO LV_COUNTER .

ENDIF.