Application Development 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: 

For All Entry with Like Operator

pappu_kumar2
Participant
0 Kudos
1,779

Hi All,

SELECT doknr objky from drad INTO TABLE lt_drad FOR ALL ENTRIES IN it_mchb

WHERE objky LIKE it_mchb-CHARG.

Error :

The addition "FOR ALL ENTRIES IN itab" cannot be used in the WHERE

condition BETWEEN, LIKE, and IN.

Error is ok.

but i want to know how to use this query without loop... i don't want to use select query within loop..

so please suggest me . how to do...

1 ACCEPTED SOLUTION

former_member206439
Contributor
0 Kudos
792

Hi Mehta,

SELECT doknr objky from drad INTO TABLE lt_drad FOR ALL ENTRIES IN it_mchb
WHERE objky = it_mchb-CHARG

If the OBJKY is different type than CHARG.

you can define a different structure same as your

it_mchb

but the OBJKY as CHARG type.

loop at your internal table and append the values to your new structure internal table and after that you can use select query on your for all entries on new structure internal table .

try this way.

when your refering a for all entries internal table it should be EQ sign.

Edited by: Naresh Nelapatla on Sep 16, 2011 3:32 PM

3 REPLIES 3

former_member206439
Contributor
0 Kudos
793

Hi Mehta,

SELECT doknr objky from drad INTO TABLE lt_drad FOR ALL ENTRIES IN it_mchb
WHERE objky = it_mchb-CHARG

If the OBJKY is different type than CHARG.

you can define a different structure same as your

it_mchb

but the OBJKY as CHARG type.

loop at your internal table and append the values to your new structure internal table and after that you can use select query on your for all entries on new structure internal table .

try this way.

when your refering a for all entries internal table it should be EQ sign.

Edited by: Naresh Nelapatla on Sep 16, 2011 3:32 PM

madhu_vadlamani
Active Contributor
0 Kudos
792

Hi Kumar,

It is very clear for all entries nothing but .In your first internal table you got some data it is header table.Now depending on this header we are getting entries from item table.That header may containd number of items at item level.The key words equal to will make a relation between the two tables and get all the records which have the same value in the both the tables.

Once you get your data into your final internal table then declare one more structure and append it

Regards,

Madhu.

Edited by: madhurao123 on Sep 17, 2011 7:38 AM

Former Member
0 Kudos
792

Hi,

Understand the concept of working with FOR ALL ENTRIES, what madhu had given.

in your case there is no linkage between tables DRAD and MCHB.

Regards,

Kiran