Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Code correction

Former Member
0 Likes
400

In the below code, the loop passes for three times.

MOVE SY-INDEX TO LV_INDEX.

why sy-index is not getting value three here.

LOOP AT GT_FINAL ASSIGNING <GT_FINAL>

WHERE DAY = '1'.

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

WRITE <GT_FINAL>-MATNR TO WA_BPSTAB-MONDAY.

WRITE <GT_FINAL>-QUANTITY RIGHT-JUSTIFIED TO WA_BPSTAB2-MONDAY.

APPEND WA_BPSTAB TO GT_BPSTAB.

  • DESCRIBE TABLE GT_BPSTAB LINES LV_INDEX.

APPEND WA_BPSTAB2 TO GT_BPSTAB.

LS_SUM_MON = LS_SUM_MON + <GT_FINAL>-QUANTITY.

MOVE SY-INDEX TO LV_INDEX.

ENDLOOP.

3 REPLIES 3
Read only

Former Member
0 Likes
380

John,

use Sy-tabix instead of sy-index.

-Anu

Read only

Former Member
0 Likes
380

Try SY-TABIX, inside loop - endloop sy-index does not have any value.

Read only

Former Member
0 Likes
380

use use Sy-tabix