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

error loop and work area

Former Member
0 Likes
1,539

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,060

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

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,060

Is it an error or warning?    

Read only

Former Member
0 Likes
1,060

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'.

Read only

0 Likes
1,060

If you are looping an itab, automatically index handling of that itab will be taken care off.

No need to mention INDEX sy-tabix inside the loop.

Also if you use the statement delete itab inside the loop, that particular record from itab will be deleted.

Read only

Former Member
0 Likes
1,060

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