How do I use substring in OpenSQL ABAP WHERE clause?

允我心安 提交于 2019-12-11 16:47:22

问题


My expression in OpenSQL is:

SELECT * FROM  J_1BNFLIN  AS B
  WHERE SUBSTRING(REFKEY , 1 , 10 )

The substring portion of the where clause is not working. What am I doing wrong?


回答1:


You can use LIKE in the WHERE condition. For example:

DATA: gv_refkey TYPE j_1bnflin-refkey.
gv_refkey = '123%'.
SELECT *
       INTO TABLE ...
       FROM j_1bnflin
       WHERE refkey LIKE gv_refkey.

This will select all entries where the field refkey starts with '123' (pls. note a % is used as wildcard)



来源:https://stackoverflow.com/questions/47885655/how-do-i-use-substring-in-opensql-abap-where-clause

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!