Skip to Content
author's profile photo Former Member
Former Member

sy-index

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 03:26 PM

    use sy-tabix in this case.

    it shows current loop pass.

    Regards

    vasu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 12, 2007 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 03: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 03:26 PM

    LOOP AT lt_bomitem WHERE item_categ = 'N'.

    IF sy-tabix GT 2.

    DELETE lt_bomitem.

    ENDIF.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 12, 2007 at 03:28 PM

    Hi,

    Please use SY-TABIX instead of SY-INDEX.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.