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

Retrieve Records From a table based on condition .....!

Former Member
0 Likes
836

Objective :

How To Retrieve Records from a Table Depending on Condition

Description :

Suppose I have Z EMPLOYEE table in that i have ENO, ENAME, DEPTNO fields.

I want the records of employees whose name starts with 'A' .

Please any one provide solution for my query

Thanks

Prasad

1 ACCEPTED SOLUTION
Read only

prasanth_kasturi
Active Contributor
0 Likes
802

hi

use the where condition

Suppose I have Z EMPLOYEE table in that i have ENO, ENAME, DEPTNO fields.

I want the records of employees whose name starts with 'A'

select * from zemployee into table itab where ename like 'A%'.

reward if helpful

prasanth

Objective :

How To Retrieve Records from a Table Depending on Condition

Description :

Suppose I have Z EMPLOYEE table in that i have ENO, ENAME, DEPTNO fields.

I want the records of employees whose name starts with 'A' .

Please any one provide solution for my query

Thanks

Prasad

5 REPLIES 5
Read only

prasanth_kasturi
Active Contributor
0 Likes
803

hi

use the where condition

Suppose I have Z EMPLOYEE table in that i have ENO, ENAME, DEPTNO fields.

I want the records of employees whose name starts with 'A'

select * from zemployee into table itab where ename like 'A%'.

reward if helpful

prasanth

Read only

Former Member
0 Likes
802

hi,

do this way ..


select ENO ENAME DEPTNO from ZEMPLOYEE into table itab where ENAME like 'A%'.
if sy-subrc = 0.

endif.

Read only

Former Member
0 Likes
802

use the code

select eno ename dept no from ZEMPLOYEE into table itab where ename like 'a%'.

or select * from ZEMPLOYEE into table itab where ename like 'a%'.

means can fetch data as per condition

if you shoud start from A

its gonna surely help

Reward points if useful

Thanks

Edited by: Richa Khosla on May 28, 2008 7:20 AM

Edited by: Richa Khosla on May 28, 2008 7:20 AM

Read only

Former Member
0 Likes
802

Accurate Answer

Read only

Former Member
0 Likes
802

Hi,

Simply use a select statement.

select eno ename departno

from tablename

into table int_tab

where condition(eg- ename like A%)

To explain why we using A% is that this would fetch all those names from the field ename,where the name starts with A.

If u use select * -then this will fetch all he records of people whose name start with A,if u want only specific ones,mention the field names.

Thanks

Reward points if useful

Edited by: Malvika Sharma on May 28, 2008 7:24 AM