1、日期和时间是两个字段,比如要查询 2020/10/28 08:40:00到 2020/10/28 17:02:00的数据
DATA: lt_data TYPE TABLE OF cdhdr. SELECT * FROM cdhdr WHERE CAST( concat( udate,utime ) AS NUMC( 14 ) ) > '20201028084000' AND CAST( concat( udate,utime ) AS NUMC( 14 ) ) < '20201028170200' INTO TABLE @lt_data.
2、多表关联,只要1个表的全部字段数据
DATA: lt_plpo TYPE TABLE OF plpo, l_werks TYPE werks_d VALUE '2000'. SELECT plpo~* INTO CORRESPONDING FIELDS OF TABLE @lt_plpo FROM plpo INNER JOIN mapl ON mapl~plnnr = plpo~plnnr INNER JOIN plko ON plko~plnnr = plpo~plnnr INNER JOIN plas ON plas~plnnr = plpo~plnnr AND plpo~plnkn = plas~plnkn AND plpo~zaehl = plas~zaehl WHERE mapl~werks = @l_werks AND mapl~loekz = '' AND mapl~plnty = 'N' AND plko~loekz = '' AND plko~verwe = '1' AND plas~loekz NE 'X' AND plas~plnty = 'N'.