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

delete rows from internal table using where condition for select option

Former Member
0 Likes
6,637

Hi,

I want to delete rows from internal table using where condition for select option .

I tried : 

   delete itab where vbeln < p_saldoc-low OR vbeln > p_saldoc-high.

But it gave  an error.

then I tried:

   delete itab where vbeln < p_saldoc-low.
   delete itab where vbeln > p_saldoc-high.

Now im getting error:    Field specification missing.

Pls Help with the best approach or possible solution........

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
2,498

You could also use the IN-operator, this is standard ABAP syntax, check the help files. There must be some other cause for the errors, please list the full and exact messages and also post the code, not just this small snippet.

Thomas

8 REPLIES 8
Read only

ThomasZloch
Active Contributor
0 Likes
2,499

You could also use the IN-operator, this is standard ABAP syntax, check the help files. There must be some other cause for the errors, please list the full and exact messages and also post the code, not just this small snippet.

Thomas

Read only

0 Likes
2,498

Hi Thomas,

tried using IN  but now im getting the error -  p_saldoc is not an internal table.

Read only

0 Likes
2,498

hey thomas ....ur suggestion worked ..

thanks

Read only

0 Likes
2,498

Worked just fine ...thanks

Read only

0 Likes
2,498

could you please tell how you resolved the error " p_saldoc is not an internal table."

Read only

Former Member
0 Likes
2,498

Faiz,

Some times, it might not work correctly. But I would prefer the below if the size of the p_saldoc-low/high is small. take a temporary internal table 'itab1'.

loop at p_saldoc-low.

read table itab into wa with key vbeln = p_saldoc-low.

if sy-subrc ne 0.

continue.

else.

append wa to itab1.

endif.

endloop.

Do the same for p_saldoc-high as well. This will work correctly.

If you are fetching the data from a table into itab, then use the stmt like this

select....from dbtab into itab where vbeln in p_saldoc. I dont know your requirement though..

Regards,

Guru.

Read only

former_member189779
Active Contributor
0 Likes
2,498

HI

delete itab where vbeln in p_saldoc should work. Make sure your table is sorted on vbeln.

Read only

Former Member
0 Likes
2,498

Hi,

we can use IN operator to fix the error like

delete itab where vbeln in  p_saldoc.

Please share your requirement so that we can guide you in that way.

Hope this will helps you.

Many Thanks,

Kiran