Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

string field selection

Former Member
0 Likes
820

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)

3 REPLIES 3
Read only

Former Member
0 Likes
659

Hi,

Check the below code..

SELECT SINGLE * FROM <TABLE> INTO <WA> WHERE FIELD1 LIKE '00005*'.

Rgds,

Bujji

Read only

Former Member
0 Likes
659

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.

Read only

Former Member
0 Likes
659

DATA : itab LIKE STANDARD TABLE OF vbap WITH HEADER LINE.

SELECT  * INTO TABLE itab
          FROM vbap
          WHERE vbeln LIKE '00005%'.