09-12-2007 4:23 PM
hi guys ,
how can i increase the index value..this is my logic..everytime i loop is processing the sy-index = 0..its not changing anything wrong with the code..
LOOP AT lt_bomitem WHERE item_categ = 'N'.
IF sy-index GT 2.
DELETE lt_bomitem.
ENDIF.
ENDLOOP.
regards
09-12-2007 4:26 PM
09-12-2007 4:26 PM
Hi,
Can you explain whats the requirement? if you want to delete the record of more than 2 existing record, then try this.
data: l_index type sy-index.
LOOP AT lt_bomitem WHERE item_categ = 'N'.
l_index = l_index + 1.
IF l_index GT 2.
DELETE lt_bomitem.
ENDIF.
ENDLOOP.
Regards,
Niyaz
09-12-2007 4:26 PM
It should be like this...
DATA: GS_TABIX TYPE SY-TABIX.
LOOP AT lt_bomitem WHERE item_categ = 'N'.
GS_TABIX = SY-TABIX.
IF GS_TABIX GT 2.
DELETE lt_bomitem.
ENDIF.
ENDLOOP.
Greetings,
Blag.
09-12-2007 4:26 PM
LOOP AT lt_bomitem WHERE item_categ = 'N'.
IF sy-tabix GT 2.
DELETE lt_bomitem.
ENDIF.
ENDLOOP.
09-12-2007 4:28 PM
09-12-2007 4:30 PM
Do not use sy-index in loop of the internal table
sy-index - mainly for do loops
sy-tabix for internal table loops.
Thanks
Seshu