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

Partial field selection in SELECT

Former Member
0 Likes
3,998

Can we do a partial field selection in ABAP SELECT like

For example -

select department first 3 characters < DEPT+0(3)>

from emp_table

where employee first name start with 'A' < EMP_NAME+0(1) = 'A'>

for listing dept first 3 char for Emp name starting with 'A' . How we can implement in ABAP ?

Can we do this without putting in to an internal table ( that is in a single select statement ) ?

Thanks

Mano

5 REPLIES 5
Read only

former_member156446
Active Contributor
0 Likes
1,591
select * from table 
      into itab
      where emp+(3) like 'ABC'  "<< employe starting with ABC.
        and  id+(2)  like '12'.     "<< id number starting with 12.

or you can create a range and use that..

         where emp in ra_emp and
                   id in ra_id.

is it right Rob?

Read only

0 Likes
1,591

Thank you of the answer .. if I want to select only the first 3 character of department , what will be the selection look like ?

Read only

0 Likes
1,591

Use LIKE in the WHERE.

Rob

Read only

0 Likes
1,591

you cant get only first three characters of the department... you can select the data based on the first three characters (using offset as per my previous post).. as Rob suggested we need to use LIKE in the where Clause..

thanks Rob.

Read only

Former Member
0 Likes
1,591

OK - do you mean any department that has 'A' anywhere in the first three characters?

Rob