简体   繁体   English

删除一列包含字符“+”的内部表行

[英]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.这意味着,它将“+”作为正则表达式,只选择长度为 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?字段 1 是长度为 1 的字符字段。如何转义字段 1 中只有“+”的行的“+”?

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). CA代表包含任何,它将删除字段包含“+”字符的所有行(与字段的长度或其他字符无关)。 You can add more characters if you wish, for example CA '+-' which means the string contains a '+' or a '-' etc.如果您愿意,您可以添加更多字符,例如CA '+-'这意味着字符串包含一个 '+' 或一个 '-' 等。

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这是直接 SAPHelp 的链接: https ://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenlogexp_op.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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