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

REPLACE Value with Single Quote

Former Member
0 Likes
908

Hi All,

I want to have a value with single code using REPLACE command into a variable.

Say for eg:

REPLACE LV_VKORG WITH '1000' INTO GV_VKORG.

Result: GV_VKORG contains 1000 but I want 1000 with Single Quotes appended on either side of 1000.

Could someone tell me how to achieve this.

Thanks & Regards,

JR.

9 REPLIES 9
Read only

Former Member
0 Likes
866

REPLACE LV_VKORG WITH '''1000''' INTO GV_VKORG.

Try the above

Regards

Anurag

Read only

0 Likes
866

Hi

If it is like this

REPLACE 'SY-DATUM' WITH SY-DATUM INTO LV_DATUM.

nOW LV_DATUM should have a value with Single Quotes on either side.

Thanks & Regards,

JR.

Read only

0 Likes
866

In that case you would need to concatenate in the next step.

basically

concatenate '''' lv_datum '''' into lv_datum.

Regards

Anurag

Message was edited by: Anurag Bankley

Read only

0 Likes
866

for this purpose,its advisable to use CONCANTENATE .

DATA : LV_DATUM(10) TYPE C.

CONCATENATE ''''

SY-DATUM

''''

INTO LV_DATUM.

Regards

srikanth

Read only

0 Likes
866

You just need 4 quotes for every one. Check this.



report zrich_0001.

data: lv_datum(10) type c.


concatenate '''' sy-datum '''' into lv_datum.

write:/ lv_datum.


Regards,

Rich Heilman

Read only

Former Member
0 Likes
866

then use CONCATENATE instead of REPLACE.

concatenate ''''

lv_vkorg

''''

into lv_vkorg.

now lv_vkorg will have leading & training single quote

regards

srikanth

Read only

Former Member
0 Likes
866

Hi abaper,

1. simple

2.

REPLACE LV_VKORG WITH '''1000''' INTO lV_VKORG.

(use 3 quotes to mean it as a single quote)

regards,

amit m.

Read only

Former Member
0 Likes
866

data: lv_vkorg like knvv-vkorg,

gv_vkorg(6).

REPLACE LV_VKORG WITH '''1000''' INTO GV_VKORG.

write: / GV_VKORG.

Read only

Former Member
0 Likes
866
REPORT ABC LINE-SIZE 255.

data : x(50) value 'peter'.

REPLACE 't' WITH '''1000''' INTO x.

write : x.