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

error loop and work area

hi all,

please help me in trouble, I get the error message is "you may not delete or overwrite table "t_bseg" within a loop over itself.-" AND the work area "t_bseg" has more fields than selected.

I created the following syntax

<removed the code snippet>

BR,

PH.

THX.

Moderator message - Please post only the relevant portion of the code

Message was edited by: Suhas Saha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2013 at 10:09 AM

    Hi Putra,

    the work area "t_bseg" has more fields than selected.

    This is because the work area has more than the fields that you are selecting.

    Ex: If work area has 5 fields and in the select statement if you are fetching less than 5 fields, then this error is raised.

    I didn't understand the first error. Provide the code that gives error message.

    Regards,

    Satish D R

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 25, 2013 at 10:11 AM

    Is it an error or warning?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2013 at 10:28 AM

    You can't delete a table whilst looping through it. If you want to delete an entire table do so outside the loop. If you want to delete a single row within the loop do so using INDEX.

    add a flag to tour table and

    LOOP AT T_BSEG.

    IF xxxxxx.

    T_BSEG-FLAG = 'X'.

    MODIFY T_BSEG INDEX SY-TABIX TRANSPORTING FLAG..

    ENDIF.

    ENDLOOP.

    DELETE T_BSEG WHERE FLAG = 'X'.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 25, 2013 at 11:49 AM

    Hi,

    You cannot delete an internal table while its in use.

    place the delete statement after your loop i.e after ENDLOOP statement.

    And second problem of table having more fields than selected is a warning, you can ignore it if you want or if you want it not to be raised every time you syntax check, create a local type with only the required fields and use it for declaration of your internal table.

    regards,

    Ashish Rawat

    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.