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

concatenate string

Former Member
0 Likes
1,029

hello gurus,

seee this example

data : var1 type string,

var2 type string,

var3 tyype string.

var1 = 'lifnr'.

var2 = '1000'.

concatenate var1 var2 into var3 .

write : / var3.

output : lifnr = 1000.

but i want to display my output as lifnr = '1000'.

through concatenate string.

thanks

anji.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
993

Hello,

write the following statement:

concatenate var1 '=' '''' var2 '''' into var3.

Hope this helps.

Regards,

Himanshu

8 REPLIES 8
Read only

Former Member
0 Likes
994

Hello,

write the following statement:

concatenate var1 '=' '''' var2 '''' into var3.

Hope this helps.

Regards,

Himanshu

Read only

Former Member
0 Likes
993

data : var1 type string,

var2 type string,

var3 tyype string.

var1 = 'lifnr'.

var2 = '1000'.

concatenate var1 var2 into var3 .

write : / var3.

data char1 thpe c '''.

concatenate var1 space '=' space char1 var2 char1 into var3 .

char1

output : lifnr = 1000.

but i want to display my output as lifnr = '1000'.

through concatenate string.

thanks

Edited by: Karthikeyan Pandurangan on Sep 30, 2010 9:46 AM

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
993

use this : concatenate 'lifnr' '=' ''' var2 ''' into var3 .

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
993

Hello,

Check this:

DATA : var1 TYPE string,
var2 TYPE string,
var3 TYPE string.

var1 = `lifnr`.
var2 = `'1000'`. "Check the Backquotes

CONCATENATE var1 '=' var2 INTO var3 SEPARATED BY space.

WRITE : / var3.

BR,

Suhas

Read only

matt
Active Contributor
0 Likes
993

This was reported to the Moderators as a basic question. And it is. But the poster has put the effort in, it's not something he can search for, so in my view it can stand. To me this is an opportunity to show a beginner the way he should go.

(It's not that basic questions aren't permitted, it's just that they tend to be Frequently Asked Questions, and these are not training forums).

I wouldn't use concatenate in for this type of problem, I'd do something like

DATA: my_text TYPE string.
data : var2 type string,

my_text = 'lifnr = ''&LIFNR'''(001). " Defines text element text-001 as: lifnr = '&LIFNR'

var2 = '1000'.

REPLACE ALL OCCURENCES OF '&LIFNR' IN my_text WITH var2.

write : / my_text

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
993

Hi Matt,

Any specifics why you won't use CONCATENATE ?

BR,

Suhas

Read only

matt
Active Contributor
0 Likes
993

> Hi Matt,

>

> Any specifics why you won't use CONCATENATE ?

>

> BR,

> Suhas

I think my version is easier to read and understand, and also it is MUCH easier to do the translation in a multilingual system - especially if there's more than one variable. For example:

In English: "You must &1 instead of &2.". In German "Sie müssen anstatt zu &2 &1."

How would you do that using concatenation, without having some like IF language EQ 'DE'... ? OK, you can use a message class and number, but that's not always appropriate, or even possible.

Read only

0 Likes
993

Hey.. Pls have a look at this...:

data: var1 type string,

var3 type string.

parameters: var2 type string.

var1 = 'LIFNR'.

concatenate ''''var2'''' into var3.

concatenate var1 '=' var3 into var3 separated by ''.

write var3.