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

Pass class methods with returning parameter in Select query where condition.

Former Member
0 Likes
3,776

I am trying to directly call the method which has a returning parameter in the select query where condition . but this does't work. Gives an error. However this works for an IF condition.

if zclass->get_attribute( ) = 1. "this works

endif.

select a from ztable into table @data(lt_table)

where

b = zclass->get_attribute( ). "doesn't work

Does anyone have any idea about it? I am trying to avoid having local variables for all the getter methods and then passing them in the select query as there's quite a few of them and these values are required in multiple methods.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

former_member1716
Active Contributor
2,239

kaundinya,

Try the below Code and let us know if it works,

select a from ztable into table @data(lt_table)
where
b =  @( zclass->get_attribute( ) ) . 

Regards!

4 REPLIES 4
Read only

former_member1716
Active Contributor
2,240

kaundinya,

Try the below Code and let us know if it works,

select a from ztable into table @data(lt_table)
where
b =  @( zclass->get_attribute( ) ) . 

Regards!

Read only

2,239

This works. Thanks!

Just a little change. The into table @data(lt_table) will come at the end like this.

select a from ztable where
b =@( zclass->get_attribute( ) )
into table @data(lt_table).
Read only

2,239

For information, the following part of the above code is named a host expression and exists since ABAP 7.50:

@( zclass->get_attribute( ) )
Read only

2,239
select a from ztable where
b = @( zclass->get_attribute())intotable@data(lt_table).