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

Syntax error while writing a select query.

Former Member
0 Likes
664

Hi all,

I have a requirement where I have to pick a value if the text for that value is

MYCARu2019S Lovliest Car.

And so I wrote a query that


SELECT	RUECK INTO XRUECK FROM AFVC WHERE ltxa1 = ' MYCARu2019S Lovliest Car'.
                ENDSELECT.

But it gives me a syntax error saying

u201CLiterals taking up more than one line not permittedu201D.

Can some one tell me what is wrong. I need to select RUECK value from AFVC table if

ltxa1 value is ' MYCARu2019S Lovliest Car'.

Kindly help what is going wrong...

Regards,

Jessica Sam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
619

Hi,

Give two single quotes..

SELECT  rueck INTO xrueck FROM afvc WHERE ltxa1 = ' MYCAR''S Lovliest Car'.
ENDSELECT.

Thanks

Naren

5 REPLIES 5
Read only

Former Member
0 Likes
620

Hi,

Give two single quotes..

SELECT  rueck INTO xrueck FROM afvc WHERE ltxa1 = ' MYCAR''S Lovliest Car'.
ENDSELECT.

Thanks

Naren

Read only

Former Member
0 Likes
619

Try the below code in the where condition.

' MYCARu2019'S Lovliest Car'.

Mathews

Read only

0 Likes
619

Thanks Mathew and Narendar.

Solved with your suggestion.

Regards,

Jessica Sam

Read only

Former Member
0 Likes
619

To add to what Naren has pointed out: the ABAP syntax checker always looks for an even number of quotes in code and if it finds an odd number, it assumes that the last one was never closed and goes over multiple lines. The double quotes is a trick that goes back quite a while to fool the syntax checker.

Rob

Read only

faisalatsap
Active Contributor
0 Likes
619

Hi,

Narendran is right use two single quotes.

also careful wile comparing string. i think as you write ltxa1 value is ' MYCARu2019S Lovliest Car'.

so while comparing you must not use space just before staring use the following

SELECT  rueck INTO xrueck FROM afvc WHERE ltxa1 = 'MYCAR''S Lovliest Car'. " Not use Space before M
ENDSELECT.

Hope will help you.

Kind Regards,

Faisal