简体   繁体   中英

IN operator in check statement

In SQ02 transaction, I want to use the check command. Can I replace the OR operator with another operator, which shorts the command? Is there an operator like IN , which exists in SQL? The check command is something like: CHECK SKB1-BUKRS EQ '1000' or CHECK SKB1-BUKRS EQ '2001' or CHECK SKB1-BUKRS EQ '5221' . Is there an operator like IN , which exists in SQL? CHECK SKB1-BUKRS in ('1000', '2001', '5221')

When I write in the Record Processing section: START-OF-SELECTION. CHECK skb1-bukrs IN gt_ranges.

段记录处理

then I receive ABAP error: 错误信息

I am not an expert when it comes to SQ02 I can see however that there are sections for DATA and INITIALIZATION so the example below should work. IN operator in ABAP (excluding OpenSQL of course) can only be used with ranges.

Example:

REPORT zzz.

DATA: gt_ranges TYPE RANGE OF bukrs.
TABLES: skb1.

INITIALIZATION.
  gt_ranges = VALUE #(
    ( sign = 'I' option = 'EQ' low = '1000' )
    ( sign = 'I' option = 'EQ' low = '2001' )
    ( sign = 'I' option = 'EQ' low = '5221' )
  ).

START-OF-SELECTION.
  CHECK skb1-bukrs IN gt_ranges.

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