简体   繁体   中英

Delete internal table lines whose one column contains the character "+"

I want to delete entries from an internal table, which has not a "+" in one column. Now, if I want to delete it like this:

DELETE internal_table where field1 <> '+'.

it doesn't work. This means, it takes the "+" as a regex and just selects any character with length 1.

Now I've tried several things:

DELETE internal_table where field1 <> '\+'.
DELETE internal_table where field1 <> |\+|.
DELETE internal_table where field1 <> `\+`.

Nothing of this works. With the String template |\\+| I get the error "Unmasked symbol '\\' in string template.

Field 1 is a character field with length 1. How can I escape the "+" that only the lines, which have a "+" in field1?

You can do it without regex:

DELETE internal_table 
       WHERE field CA '+'.

CA stands for contains any and it will delete all lines where the field contains a '+' character (independent of the lenght of the field or what other characters are in). You can add more characters if you wish, for example CA '+-' which means the string contains a '+' or a '-' etc.

If you want to delete a line, which does NOT contain a '+' you can use:

DELETE internal_table
       WHERE field NA '+'.

Here is a link to the direct SAPHelp: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenlogexp_op.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM