javascript 的 SAP 云 SDK 直接附加过滤器:导致后端 "Expression can not converted into ABAP select options"
SAP cloud sdk for javascript multiple and filters are directly appended: leads to "Expression can not converted into ABAP select options" on backend
我有一个对 ByDesign 系统的读取请求,并按以下方式创建:
const readRequest = QueryResults.requestBuilder()
.getAll()
.select(
QueryResults.COFFMAT,
QueryResults.CMATERIAL
)
.filter(
and(and(
QueryResults.PARA_FISCYEARPER.greaterOrEqual(new BigNumber('0010000')),
QueryResults.PARA_FISCYEARPER.lessOrEqual(new BigNumber('0129999'))),
and(
QueryResults.CACCPSTDAT.greaterOrEqual(moment(validFrom)),
QueryResults.CACCPSTDAT.lessOrEqual(moment(validTo)),
QueryResults.CPERMEST.equals(PermanentEstablishmentID),
QueryResults.CACCBTT.equals(Constants.code.IssueForProduction)
))
);
并且请求按照以下URL编码生成:
\QueryResults?$format=json&$select=COFFMAT,CMATERIAL&$filter=(PARA_FISCYEARPER%20ge%2010000L%20and%20PARA_FISCYEARPER%20le%20129999L%20and%20CACCPSTDAT%20ge%20datetime%272017-12-31T23:00:00.000%27%20and%20CACCPSTDAT%20le%20datetime%272020-12-31T23:00:00.000%27%20and%20CPERMEST%20eq%20%27P1100%27%20and%20CACCBTT%20eq%20%27344%27)
这里所有的 和 过滤器都被附加在彼此之后,这导致从后端抛出错误
Expression can not converted into ABAP select options
工作过滤器 url 以及我希望生成的 URL 编码是什么(注意括号)
\QueryResults?$format=json&$select=COFFMAT,CMATERIAL&$filter=((PARA_FISCYEARPER%20ge%2010000L%20and%20PARA_FISCYEARPER%20le%20129999L)%20and%20(CACCPSTDAT%20ge%20datetime%272017-12-31T23:00:00.000%27%20and%20CACCPSTDAT%20le%20datetime%272020-12-31T23:00:00.000%27%20and%20CPERMEST%20eq%20%27P1100%27%20and%20CACCBTT%20eq%20%27344%27))
第二种情况能否以某种方式实现,因为在 or 过滤器的情况下,括号正在正确生成,只有在 并且它们不起作用。
最近发布了1.28.1版本。它应该生成 url 以及您需要的更多括号。请参阅发行说明 here。
我有一个对 ByDesign 系统的读取请求,并按以下方式创建:
const readRequest = QueryResults.requestBuilder()
.getAll()
.select(
QueryResults.COFFMAT,
QueryResults.CMATERIAL
)
.filter(
and(and(
QueryResults.PARA_FISCYEARPER.greaterOrEqual(new BigNumber('0010000')),
QueryResults.PARA_FISCYEARPER.lessOrEqual(new BigNumber('0129999'))),
and(
QueryResults.CACCPSTDAT.greaterOrEqual(moment(validFrom)),
QueryResults.CACCPSTDAT.lessOrEqual(moment(validTo)),
QueryResults.CPERMEST.equals(PermanentEstablishmentID),
QueryResults.CACCBTT.equals(Constants.code.IssueForProduction)
))
);
并且请求按照以下URL编码生成:
\QueryResults?$format=json&$select=COFFMAT,CMATERIAL&$filter=(PARA_FISCYEARPER%20ge%2010000L%20and%20PARA_FISCYEARPER%20le%20129999L%20and%20CACCPSTDAT%20ge%20datetime%272017-12-31T23:00:00.000%27%20and%20CACCPSTDAT%20le%20datetime%272020-12-31T23:00:00.000%27%20and%20CPERMEST%20eq%20%27P1100%27%20and%20CACCBTT%20eq%20%27344%27)
这里所有的 和 过滤器都被附加在彼此之后,这导致从后端抛出错误
Expression can not converted into ABAP select options
工作过滤器 url 以及我希望生成的 URL 编码是什么(注意括号)
\QueryResults?$format=json&$select=COFFMAT,CMATERIAL&$filter=((PARA_FISCYEARPER%20ge%2010000L%20and%20PARA_FISCYEARPER%20le%20129999L)%20and%20(CACCPSTDAT%20ge%20datetime%272017-12-31T23:00:00.000%27%20and%20CACCPSTDAT%20le%20datetime%272020-12-31T23:00:00.000%27%20and%20CPERMEST%20eq%20%27P1100%27%20and%20CACCBTT%20eq%20%27344%27))
第二种情况能否以某种方式实现,因为在 or 过滤器的情况下,括号正在正确生成,只有在 并且它们不起作用。
最近发布了1.28.1版本。它应该生成 url 以及您需要的更多括号。请参阅发行说明 here。