Skip to Content
author's profile photo Former Member
Former Member

Question on write statement

Hi,

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

write '''' .

Outputs ' (Single Quote)

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on May 13, 2010 at 09:12 AM

    >

    > 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 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 13, 2010 at 09:03 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.