‎2008 Mar 10 1:47 PM
I have a database table 'TABLE' with field 'FIELD1' whose length is 10 with a value for eg. '0000542342'. I need to select this record from the table using the value '00005'. How can I build a select statement to select this record?
I tried using,
SELECT SINGLE * FROM TABLE WHERE FIELD1+0(5) = '00005'.
But I am getting a syntax error on this statement. Is there any way to specifically select only a part of the field from the table?
(we are on version 45B)
‎2008 Mar 10 1:50 PM
Hi,
Check the below code..
SELECT SINGLE * FROM <TABLE> INTO <WA> WHERE FIELD1 LIKE '00005*'.
Rgds,
Bujji
‎2008 Mar 10 1:53 PM
U cannot use offset condition while selecting data from a table ..
After getting data .. filter according to your condition ...
select * from table into itab ....
loop at itab where FIELD1+0(5) = '00005'.
endloop.
‎2008 Mar 10 1:56 PM
DATA : itab LIKE STANDARD TABLE OF vbap WITH HEADER LINE.
SELECT * INTO TABLE itab
FROM vbap
WHERE vbeln LIKE '00005%'.