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

Assigning single quotation to variable

Former Member
0 Likes
1,741

How to assign quotation to an character datatype variable? Give me an example statement..

3 REPLIES 3
Read only

Former Member
0 Likes
919

just add ' ' with variable if it is char type

______________________________________________________________________

IF you need to insert in the string veriable the special character '.

variable = '''.

Try as

data: L_COM VALUE ''''.

__________________________________________________________________

DATA A.

A = ''''.

WRITE:/ A.

___________________________________________________

1)Declare a variable and assign the special character to that variable.

2)Then use the CONCATENATE option to get the value in the string variable.

Just copy and execute this code.

REPORT zztest.

<b>DATA : temp(1) VALUE ''''.</b> Decalare your special character

DATA : variable TYPE string.

START-OF-SELECTION.

variable = 'SDNSAP'.

CONCATENATE temp variable temp INTO variable.

WRITE : / variable.

The output is

'SDNSAP'

Rewards if useful........

Minal Nampalliwar

null

null

Read only

Former Member
0 Likes
919

Hi

You can use concatenate statement and add quotations to your variable

CONCATENATE '"' v_kslnn'"'

INTO v_kslnn .

Reward if useful.

Regards

Shibin

Read only

former_member480923
Active Contributor
0 Likes
919

This might be helpful:

REPORT  ztest_prg5.

DATA: w_data TYPE char50.

DATA:  word1(15) TYPE c,
      c_comma       type c value ''''.


word1 = 'firstword'.

CONCATENATE c_comma word1 c_comma INTO w_data.

WRITE:/ w_data.

Hope That Helps

Anirban M.