Application Development 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: 

delete rows from internal table using where condition for select option

former_member215563
Active Participant
0 Kudos

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

ThomasZloch
Active Contributor
0 Kudos

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

ThomasZloch
Active Contributor
0 Kudos

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

0 Kudos

Hi Thomas,

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

0 Kudos

hey thomas ....ur suggestion worked ..

thanks

0 Kudos

Worked just fine ...thanks

0 Kudos

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

Former Member
0 Kudos

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.

former_member189779
Active Contributor
0 Kudos

HI

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

Former Member
0 Kudos

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