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: 

How can I use the WHERE clause along with 'IN' and 'select-option'?

Former Member
0 Kudos

Hello,

I am having trouble using the WHERE clause with 'IN' and 'select-option'.
I have a select-option with intervals, but when I executed the program it says that the operator is followed neither by an internal table nor by a value list.

Here's what I have:

SELECT-OPTIONS f_number FOR SFLIGHT-CONNID.

SELECT * INTO i_tab FROM SFLIGHT

     WHERE CONNID IN f_number.

Thank you in advance.

9 REPLIES 9

Former Member
0 Kudos

Hi

You need to have the select option interval declared locally and the easiest way to do this would be to use the tables statement i.e.

TABLES sflight.

SELECT-OPTIONS f_number FOR sflight-connid.

That should then stop the syntax error...

If your i_tab is an internal table then you'd need to alter your select statement to:

SELECT * INTO TABLE i_tab FROM sflight

WHERE connid IN f_number.

0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Rafael,

This error occurred as you are fetching multiple rows in your select query, thus you are passing table I_ITAB but you are not supporting it with TABLE keyword. Please change the select query INTO clause to ''INTO TABLE ITAB''.

This should solve your problem.

Please revert if still any issue.

Regards,

DN.

Former Member
0 Kudos

Hi,

SELECT-OPTIONS f_number FOR SFLIGHT-CONNID.

SELECT * INTO i_tab FROM SFLIGHT

     WHERE CONNID IN f_number.

The answered has been mentioned above that 'INTO' should be replaced with 'INTO TABLE' but I would like to add a point to it.

Please check the line of error. When you try to execute, it will give the error in the second line and you have asked query on the third line.

Regards

Purnand

satyabrata_sahoo3
Contributor
0 Kudos

This has already been answered above. However, the below code will resolve your issue.

--------------------------------------------------------

TABLES: sflight.

DATA: i_tab TYPE STANDARD TABLE OF sflight.

SELECT-OPTIONS f_number FOR sflight-connid.

SELECT * INTO TABLE i_tab FROM sflight

      WHERE connid IN f_number.

--------------------------------------------------------


-Satya

uppu_narayan
Active Participant
0 Kudos

Hi Rafael,

     Keyword INTO TABLE is missing.......make the changes and it will work fine.........

regards,

narayan

Former Member
0 Kudos

This message was moderated.

former_member209119
Active Participant
0 Kudos

Hi,

Change your select query as below:

SELECT * INTO TABLE i_tab FROM SFLIGHT

     WHERE CONNID IN f_number.

Former Member
0 Kudos

Hey, everyone!

Thanks a lot for all the help.
It works now