Application Development 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: 

Concatenate String Issue

Former Member
0 Kudos

Dear SAP Gurus,

I have one question.Please find below the scenario.

This is related to Concatenate.

In my internal table there are 4 Descriptions, let's take the example.

Line 1 - SIVARAM

Line 2 - RAMU

Line 3 - MYIT

Line 4 - 2007

Now I want to see the output like this.

SIVARAM, RAMU, MYIT, 2007 (For Each description I have to separate the , and SPACE).

I have did all kind of Research on this issue, but unfortunately I will not get the SPACE on my final string.

LOOP AT ITAB1.

CONCATENATE V-MAKTX ITAB1-DESC ',' SPACE INTO V_MAKTX.

ENDLOOP.

LOOP AT ITAB1.

CONCATENATE V_MAKTX ITAB1-DESC ',' ' ' INTO V_MAKTX.

ENDLOOP.

DATA : V_SPACE TYPE C.

CLEAR V_SPACE.

LOOP AT ITAB1.

CONCATENATE V_MAKTX ITAB1-DESC ',' V_SPACE INTO V_MAKTX.

ENDLOOP.

It is printing the ',' (comma) but not inserting the SPACE. I want space also to be in my final string.

I have tried all the options but it is not including the SPACE. Please suggest me how to proceed further.

Thanks & Regards

Sivaram. K

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this..

LOOP AT ITAB1.

CONCATENATE V-MAKTX ITAB1-DESC INTO V_MAKTX

SEPARATED BY ', '.

ENDLOOP.

Thanks,

Naren

7 REPLIES 7

Former Member
0 Kudos

Hi,

Try this..

LOOP AT ITAB1.

CONCATENATE V-MAKTX ITAB1-DESC INTO V_MAKTX

SEPARATED BY ', '.

ENDLOOP.

Thanks,

Naren

Former Member
0 Kudos

Hi,

I tried this example also..It worked fine..

DATA: STR TYPE STRING.

CONCATENATE 'TEST' 'ASSF' INTO STR SEPARATED BY ', '.

WRITE: / STR.

Thanks,

Naren

Former Member
0 Kudos

Hi,

SEP(3) VALUE ','.

DATA: v_string(10) TYPE C.

LOOP AT ITAB1.

CONCATENATE V_STRING SEP ITAB1-DESC ',' SPACE INTO V_MAKTX separeted by SPACE.

ENDLOOP.

<b>Example:</b>

DATA: C1(10) VALUE 'Sum',

C2(3) VALUE 'mer',

C3(5) VALUE 'holi ',

C4(10) VALUE 'day',

C5(30),

SEP(3) VALUE ' - '.

<b>Output:</b>

Sum - mer - holi - day

Former Member
0 Kudos

hi

thy this code sample

data : begin of itab,

a1(6) value 'babu,',

b1(6) value 'ramu,',

c1(6) value 'ravi',

end of itab.

data : d1(22).

concatenate itab-a1 itab-b1 itab-c1 into d1 separated by '' .

write : d1.

thanks

sarath

Former Member
0 Kudos

Hi Sivaram,

Use:

CONCATENATE V-MAKTX ITAB1-DESC INTO V_MAKTX

SEPARATED BY ', '.

Reward Point if helpfull...........................

Former Member
0 Kudos

Hi Naren,

Thank you very much for your valuable input on this, it is solved and also I assigned the Reward points for you.

Thanks & Regards,

Sivaram K

Former Member
0 Kudos

Hi Chauhan,

Thank you very much, I have rewarded the points for you.

Thanks & Regards,

Sivaram K