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

Problem in concatenating

Former Member
0 Likes
1,440

Hi Friends..

I want to give three fields as a input of read_text function module.

three fields are matnr, werks and charg.

for example matnr = gowri10000

werks = 1000

charg = welcome12

after concatenating it shows like gowri100001000welcome12

But I need an output like = gowri10000 1000welcome12

I need output with spaces from matnr field.

plz give some solution

Thanks

Gowrishankar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,408

HI,

data: v_text1 type string,

v_text2 type string.

concatenate werks charg into v_text2.

concatenate matnr v_text2 into v_text1 separated by space.

Regards,

Kumar Bandanadham

15 REPLIES 15
Read only

Former Member
0 Likes
1,409

HI,

data: v_text1 type string,

v_text2 type string.

concatenate werks charg into v_text2.

concatenate matnr v_text2 into v_text1 separated by space.

Regards,

Kumar Bandanadham

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,408

Hello,

It is simple:

DATA:
V_STR TYPE STRING,
V_STR1 TYPE STRING.

CONCATENATE WERKS CHARG INTO V_STR1.

CONCATENATE MATNR V_STR1 INTO V_STR SEPARATED BY SPACE.

BR,

Suhas

Read only

Former Member
0 Likes
1,408

HI,

You can do it by using the concatenate statement twice.

first concatenate matnr and werks into one field using separated by space or respecting blanks then concatenate charg to the field with out spaces

go for F1 help on concatenate for more reference

Regards

Sarves

Read only

Former Member
0 Likes
1,408

If you want to concatenate all the fields seperated by space :

Follow this code :


Concatenate wa_matnr wa_werks wa_charg into wa_final seperated by space.

As you mentioned in your query go through this

gowri10000 1000welcome12


Concatenate wa_matnr  space wa_werks wa_charg into wa_final .

Hope it helps

Read only

0 Likes
1,408

Hi Thanks to everyone..

But no one got my point.

I want output like this.

for example total length of matnr =18, but matnr field having only 10 digit value.

I want output matnr 8space werks charg

like this..

Edited by: gowrishankar p on Jun 22, 2009 12:23 PM

Read only

0 Likes
1,408

Hi,

As suggested earlier the following code will give your output.

DATA : MATNR TYPE MATNR,
       WERKS TYPE wERKS_D,
       CHARG TYPE CHARG_D.
 
DATA : STRING TYPE CHAR32.
 
MATNR = 'abc'.
WERKS = '0010'.
CHARG = 'abc'.
 
CONCATENATE MATNR WERKS CHARG INTO STRING RESPECTING BLANKS.

The addition respecting blanks adds the spaces after ABC for the MATNR.

Your type of the field should be same as MATNR.

Regards,

Ankur Parab

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,408

Hello Ankur,

I am using Release 640 & your code does not syntax check :-((

Can you please let me know which release are you in?

BR,

Suhas

Read only

0 Likes
1,408

Hi,

I am in SAP ECC 6.0 release 700.

Regards,

Ankur Parab

Read only

0 Likes
1,408

hi,

try this :-

DATA: i_matnr TYPE mara-matnr,

i_werks TYPE marc-werks,

i_charg TYPE mchb-charg,

i_text TYPE string.

i_matnr = '18'.

i_werks = '10'.

i_charg = '100'.

CONCATENATE i_matnr i_werks i_charg INTO i_text RESPECTING BLANKS.

Hope this solves your issue.

Read only

Former Member
0 Likes
1,408

Hi

Try like below:


data: lv_con(30),
        lv_field(50).
Concatenate matnr werks into lv_con separated by space.
concatenate lv_con charg into lv_field.

lv_field will ahve your desired output.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,408

Hi,

Do as follows:-

DATA : MATNR TYPE MATNR,
       WERKS TYPE wERKS_D,
       CHARG TYPE CHARG_D.

DATA : STRING TYPE CHAR32.

MATNR = 'abc'.
WERKS = '0010'.
CHARG = 'abc'.

CONCATENATE MATNR WERKS CHARG INTO STRING RESPECTING BLANKS.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
1,408

This message was moderated.

Read only

Former Member
0 Likes
1,408

Hi,

go through the following piece of code .... i hope u will get help..

constants: c_matnr(10) type c value 'gowri10000',

c_werks(4) type c value '1000',

c_charg(9) type c value 'welcome12'.

data:v_string type string.

concatenate c_matnr c_werks into v_string separated by space.

concatenate v_string c_charg into v_string.

write: / v_string.

out put is :

gowri10000 1000welcome12 the way u want...

thanks & Regards

Ashu SIngh

Read only

Former Member
0 Likes
1,408

Hi,

try this.

CONCATENATE '  ' f1 f2 INTO f3 SEPARATED BY SPACE.

Read only

Former Member
0 Likes
1,408

Hi Gowrishankar,

Here is the solution:

data: str1 type string,
        str2 type string.

conmcatenate werks charg into str1.

concatenate matnr str1 into str2 separated by space.