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

12 spaces

Former Member
0 Likes
1,534

Hi experts,

Iam trying to concatenate these things...

CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME SEPARATED BY SPACE.

Between of these two WA_DET-MATNR G_ORGDS i need <b>12 spaces</b>.How can i do this?

thanks

kaki

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
1,517

if you want to retain space in character/string variables use the ` sign (the key left of no.1 key in your key board)

for example.

CONCATENATE WA_DET-MATNR `            ` G_ORGDS INTO G_TDNAME .

Regards

Raja

Hi experts,

Iam trying to concatenate these things...

CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME SEPARATED BY SPACE.

Between of these two WA_DET-MATNR G_ORGDS i need <b>12 spaces</b>.How can i do this?

thanks

kaki

13 REPLIES 13
Read only

Former Member
0 Likes
1,517

gv_space = ' '.

give 12 space in gv_space.

CONCATENATE WA_DET-MATNR gv_space G_ORGDS INTO G_TDNAME .

Message was edited by: kishan negi

Read only

Former Member
0 Likes
1,517

Declare a variable of char 12

data: v_space(12).

CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME SEPARATED BY v_SPACE.

Sudha

Read only

Former Member
0 Likes
1,517

Hi kaki,

1. Concatenate does not work properly with spaces.

2. use two step logic like this:

(copy paste in new program)

it will give amit____________mittal

(where _ = space)

3.

REPORT abc.

DATA : m(50) TYPE c.

CONCATENATE 'amit' '? ?' 'mittal' INTO m .

WRITE 😕 m.

REPLACE ALL OCCURRENCES OF '?' IN m WITH '' .

WRITE 😕 m.

4. Note :

CONCATENATE 'amit' '? ?' 'mittal' INTO m .

Here between the two ? ?

there are twelve space in abap code.

(here it will show only once space due to html)

regards,

amit m.

Message was edited by: Amit Mittal

Read only

Former Member
0 Likes
1,517

Hello,

use following code.

data : lv_sep(12).

CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME SEPARATED BY lv_sep.

This will surely help.

Regards,

Shashank

Read only

athavanraja
Active Contributor
0 Likes
1,518

if you want to retain space in character/string variables use the ` sign (the key left of no.1 key in your key board)

for example.

CONCATENATE WA_DET-MATNR `            ` G_ORGDS INTO G_TDNAME .

Regards

Raja

Read only

0 Likes
1,517

Hi experts,

small change in my requirement....

CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME SEPARATED BY V_SPACE.

This space should come dynamically....

If i pass v_space = 6, should get 6 spces Or if i pass v_space = 10, 10 spaces should get....how can i do??

reward guaranteed

thanks

kaki

Read only

0 Likes
1,517

Hi kaki,

This will work as per your requirement..

<b>DATA v_space TYPE i VALUE 12. "Define value</b>

DATA len1 TYPE i.

DATA len2 TYPE i.

DESCRIBE FIELD wa_det-matnr LENGTH len1 IN CHARACTER MODE.

DESCRIBE FIELD g_orgds LENGTH len2 IN CHARACTER MODE.

g_tdname+0(len1) = wa_det-matnr.

<b>len1 = len1 + v_space.</b>

g_tdname+len1(len2) = g_orgds.

Read only

0 Likes
1,517

Hi again,

1. simple

2.

data : m(50) type c.

data : myspace(50) type c.

data : howmany type i.

*howmany = 6, 12 anything.

howmany = 25.

concatenate 'amit' 'mittal' into m separated by myspace(howmany).

write m.

regards,

amit m.

Read only

0 Likes
1,517

hi,

you can change the value

data : sp type string.
    If v_space = 6.
       sp = 'give 6 spaces'.
    elseif  v_space = 12.
       sp = 'give 12 spaces'.
   endif.
   
CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME SEPARATED BY sp.

regards

satesh

Read only

0 Likes
1,517
data: spa(1) value ` ` .
data: noofsapces(10) ,
      spas type string .

do noofspaces times.
concate spas spa into spa .
enddo .

CONCATENATE WA_DET-MATNR spas G_ORGDS INTO G_TDNAME .

Regards

Raja

Read only

0 Likes
1,517

Thanks amit,

Full points alloted..

cheers

kaki

Read only

Former Member
0 Likes
1,517

Hi Kaki,

try this..

data : sp(12).

CONCATENATE WA_DET-MATNR G_ORGDS INTO G_TDNAME

<b>seperated by sp</b>.

regards

satesh

Read only

Former Member
0 Likes
1,517

Hi Kaki,

You can use this...

<b>

DATA len1 TYPE i.
DATA len2 TYPE i.
DESCRIBE FIELD wa_det-matnr LENGTH len1.
DESCRIBE FIELD g_orgds LENGTH len2.

g_tdname+0(len1) = wa_det-matnr.
len1 = len1 + 12.
g_tdname+len1(len2) = g_orgds.

</b>

Now g_tdname will have 12 spaces in btw.