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: 

SELECT-OPTIONS in WHERE condition

Former Member
0 Kudos

Hi All,



SELECT-OPTIONS : S_TCODE FOR TSTCT-TCODE.

START-OF-SELECTION.
  SELECT * FROM TSTCT INTO TABLE IT_TSTCT
           WHERE TCODE = S_TCODE.
  ...

The same code results in SYNTAX ERROR in 4.7c.

In ECC 6.0, no such error resulted, but SUBRC is 4.

Why is it like this in ECC 6.0?

Regards,

R.Nagarajan.

6 REPLIES 6

Former Member
0 Kudos

I think you should write the select this way:



  SELECT * FROM TSTCT INTO TABLE IT_TSTCT
           WHERE TCODE IN S_TCODE.

0 Kudos

Hi Aparna Shekhar,

Yes. That is the correct way of using SELECT-OPTION.

But if you use '=' instead of 'IN', it should pop up ERROR.

I want to know why no error resulted while checking in ECC 6.0?

Regards,

R.Nagarajan.

Former Member
0 Kudos

Hi Nag,

When ever you are using select-options then you should use "IN" keyword in the select statement.

If you are using parameter then "=" .

Cheers!!

Former Member
0 Kudos

No relevent hint or reason.

Anyway thanks.

0 Kudos

Nagarajan,

Really I can't think of any logical reason for such behaviour. This sounds more like a bug. Please let me know if you find some logical reason behind this.

Regards,

Gajendra

0 Kudos

hi,

You are right in ECC 6 this will not give any error as long as you are referencing to the work area of the Select-option, but will start giving error as soon as you refer to the table using the [] command beside the select-option the it will give you a syntax error in ECC 6.0 also.

The reason might be the unicode enabling started in ECC 6.0

Hope That Helps

Anirban M.