I'm trying to display table in alv from an internal table where rows are added form a table stored in the database. Without a where condition I see rows displayed in alv but with a where condition in the select statement no rows are returned.
Here is the code:
REPORT ZSAM.
DATA: IT_1 TYPE STANDARD TABLE OF VBAK.
select vbeln audat netwr waerk vkorg vtweg
from VBAK
into corresponding fields of Table IT_1
where vbeln > 4500
and vbeln < 6000.
Run Code Online (Sandbox Code Playgroud)
Any idea why using where condition makes it not return any rows and how to fix?
vbeln是一个具有十个位置的字段,并使用ALPHA转换例程(请参见数据元素后面的域)。这意味着该值将填充前导零(只要它仅包含数字)。由于这是字符类型字段,因此还必须使用撇号进行比较。因此,WHERE条件必须是这样的:
WHERE vbeln GT '0000004500'
AND vbeln LT '0000006000'
Run Code Online (Sandbox Code Playgroud)