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

Where's the syntax error exist?

Former Member
0 Likes
666

Hi,Everyone

The following statement exists an error:

DELETE ITAB_YMIT00100 WHERE SOBKZ IN (' ','K').

Error Message:

Comma without preceding colon(after DELETE?)

About the above error, I do not know why?

So I have to change the statement and pass debug.

DELETE ITAB_YMIT00100 WHERE SOBKZ = ' ' OR SOBKZ = 'K'.

Could anyone help me?

5 REPLIES 5
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
631

Hi,

In DELETE statement's WHERE you cannot use this form of IN.

What you need to do is create RANGE object, similar to select-options. Then you can use it in .

DATA: range_sobkz type tange of sobkz.

range_sobkz-low = ' '.

append range_sobkz.

range-sobkz-low = 'K'.

append range_sobkz.

now use

DELETE ITAB_YMIT00100 WHERE SOBKZ IN range_sobkz.

Regards,

Sesh

Read only

Former Member
0 Likes
631

Hi,

Basically SAP doesnt support first syntax.

Basic syntax for delete is

DELETE TABLE <itab> FROM <wa>.

or

DELETE TABLE <itab> WITH TABLE KEY <k1> = <f 1> ... <k n> = <f n>.

you can write 'IN' in select statement like,

select * from ... where a in (...)

Reward if useful!

Read only

Former Member
0 Likes
631

DELETE ITAB_YMIT00100 WHERE <b>SOBKZ = ' ' OR SOBKZ = 'K'</b>.

This statement is correct and only thing is you should give space in between them then you will get tha desired result .

It usefull .

if it is usefull reward pionts.

khalid.

Read only

Former Member
0 Likes
631

Thanks very much.

Read only

Former Member
0 Likes
631

hi,

check whether ur internal table is with or with out heder line. if it is with out header line then ur syntax is wrong.

n try like this

DELETE TABLE <itab> WITH TABLE KEY <k1> = <f 1> ... <k n> = <f n>.

ex:DELETE ITAB_YMIT00100 FROM [WORKAREA] WITH KEY SOBKZ IN (' ','K').

when it is with header line then,

ex:DELETE ITAB_YMIT00100 WITH KEY SOBKZ IN (' ','K').

IF HELPFUL REWARD SOME POINTS.

WITH REGARDS,

suresh aluri.