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

Concatenation

Former Member
0 Likes
1,283

How do i use the ' sign in a concatenation seeing as it is a special character.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,262

Hello,

try this,


data: wrk_char type c.

Move '''' to wrk_char. "4 single quotes
concatenate  wrk_result wrk_char to wrk_reault.

<b>Reward all usefull answers.</b>

Regards,

Rakesh.

7 REPLIES 7
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,262

Hi,

DATA text type string.
CONCATENATE '''' 'hello' '''' into text.
write: text.

Single quote can be concatenated by typeing it twice.

Here '''' are required as you need to put a character between two quotes '' and to display ' you need to escape its special behaviour by typing it twice.

Regards,

Sesh

Read only

0 Likes
1,262

i desire to pass a date to function /SDF/CMO_DATETIME_DIFFERENCE and i have a date variable in the format 12102006 (t_datatabfinal-capitalisation) and i want to concatenate datatab in2 a format that will be accepted by the function, please assist

this is wat i have:

concatenate t_datatabfinal-capitalisation4(4) t_datatabfinal-capitalisation2(2) t_datatabfinal-capitalisation(2) into capitalisation.

break-point.

data: date_2 type p .

date_2 = capitalisation.

CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

EXPORTING

DATE1 = '20070630'

TIME1 = '000000'

DATE2 = date_2

TIME2 = '000000'

IMPORTING

DATEDIFF = days

  • TIMEDIFF =

  • EARLIEST =

EXCEPTIONS

INVALID_DATETIME = 1.

  • OTHERS = 2.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

Former Member
0 Likes
1,262

Hi tatenda,

1.<b> We can use tilde tilde ( the left most key, just besides left of 1)</b>

2. sample code (just copy paste)

3.

report abc.

data : a(15) type c.

<b>a = `ab'cd`.</b>

write a.

regards,

amit m.

Read only

Former Member
0 Likes
1,263

Hello,

try this,


data: wrk_char type c.

Move '''' to wrk_char. "4 single quotes
concatenate  wrk_result wrk_char to wrk_reault.

<b>Reward all usefull answers.</b>

Regards,

Rakesh.

Read only

Former Member
0 Likes
1,262

hi,

use TILDE character -> <b>`</b>

(just left to the '1' key)

`'mystring'`

<u>code</u>

data:
  l_text1(10) type c value '`',
  l_text2(10) type c value 'next',
  l_out(20)   type c.

  concatenate l_text1 l_text2 into l_out.


  write:/ l_out.

Rgds

Reshma

Read only

Former Member
0 Likes
1,262

Well for using a single quote in CONCATENATE statement type it 4 times as shown in example below:

DATA : TEXT1(10) TYPE C.

CONCATENATE '''' 'HELLO' '''' INTO TEXT1.

The output will be : 'HELLO'

NOTE : REWARD POINTS IF USEFUL.

Read only

Former Member
0 Likes
1,262

Use like..

data: t_str type string.

concatenate '''' 'prax' into t_str.

write:/ t_str.

It concatenates only single ' to the string

Regards

Prax