SAP RANG语法
Posted bruceking
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SAP RANG语法相关的知识,希望对你有一定的参考价值。
Range 和select-option 的变量是差不多的
sign = ‘I‘ 或 sign = ‘E‘ 是指INCLUED 和 EXCLUDE
OPTION = ‘EQ‘ 或其他操作符。。
LOW 是指最少值(操作符是范围的话)
HIGH ( 如果操作符是‘EQ’,该field没用)
EX.
REPORT YPMRP001.
TABLES MARA.
DATA: N TYPE I.
DATA: N1 TYPE I.
DATA: N2 TYPE I.
"用RANGE定义的内表
RANGES S_MATNR FOR MARA-MATNR OCCURS 0.
S_MATNR-SIGN = ‘I‘.
S_MATNR-OPTION = ‘BT‘.
S_MATNR-LOW = ‘000000004000000041‘.
S_MATNR-HIGH = ‘000000004000000100‘.
APPEND S_MATNR.
SELECT COUNT(*) INTO N FROM MARA
WHERE MATNR IN S_MATNR.
WRITE N.
"普通方法定义的内表
DATA: BEGIN OF S_MATNR1 OCCURS 0,
SIGN TYPE C,
OPTION(2) TYPE C,
LOW LIKE MARA-MATNR,
HIGH LIKE MARA-MATNR,
END OF S_MATNR1.
S_MATNR1-SIGN = ‘I‘.
S_MATNR1-OPTION = ‘BT‘.
S_MATNR1-LOW = ‘000000004000000041‘.
S_MATNR1-HIGH = ‘000000004000000100‘.
APPEND S_MATNR1.
SELECT COUNT(*) INTO N1 FROM MARA
WHERE MATNR IN S_MATNR1.
WRITE N1.
"用SELECT-OPTIONS
SELECT-OPTIONS:S_MATNR2 FOR MARA-MATNR
DEFAULT ‘000000004000000041‘ TO ‘000000004000000100‘ .
SELECT COUNT(*) INTO N2 FROM MARA
WHERE MATNR IN S_MATNR2.
WRITE N2.
输出结果如下:
以上是关于SAP RANG语法的主要内容,如果未能解决你的问题,请参考以下文章
在下面的代码片段中的剩余 ='passthrough' 处的代码中出现语法错误
从 SAP 获取数据时 MySQL 服务器版本中的 SQL 语法错误