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: 

Question on write statement

Former Member
0 Kudos

Hi,

Why does write statement behave as below when we write 4 single quotes together.

write '''' .

Outputs ' (Single Quote)

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

>

> write '''' .

>

> Outputs ' (Single Quote)

This is a FAQ.

SAP interprets an apostrophe as a special character. So to print it you have to use an escape character i.e., before every apostrophe to be displayed you have to add an escape character before it.

Ironically escape character for an apostrophe is an apostrophe itself !!! So for 4 quotes you have specified SAP interprets it as a single apostrophe with an escape character in the beginning.

Alternatively you can use back quotes `'`. This looks good

3 REPLIES 3

Former Member
0 Kudos

HI,

According to ABAP syntax two single quotes ('') interpret as one single qoute in write

statement. So if you write four single qoutes ('''') the middle two single qoutes treated as

literal. so thats why it prints one single qoute.

Example

write:/ 'AA'.

will output AA

Same way Write:/ ''''.

Will result in single qoute.

Regards and Best wishes.

SuhaSaha
Advisor
Advisor
0 Kudos

>

> write '''' .

>

> Outputs ' (Single Quote)

This is a FAQ.

SAP interprets an apostrophe as a special character. So to print it you have to use an escape character i.e., before every apostrophe to be displayed you have to add an escape character before it.

Ironically escape character for an apostrophe is an apostrophe itself !!! So for 4 quotes you have specified SAP interprets it as a single apostrophe with an escape character in the beginning.

Alternatively you can use back quotes `'`. This looks good

0 Kudos

Thanks Suhas , didnt know about the use of Back Quotes .