02-12-2007 5:14 PM
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
02-12-2007 5:16 PM
Hi,
Try this..
LOOP AT ITAB1.
CONCATENATE V-MAKTX ITAB1-DESC INTO V_MAKTX
SEPARATED BY ', '.
ENDLOOP.
Thanks,
Naren
02-12-2007 5:16 PM
Hi,
Try this..
LOOP AT ITAB1.
CONCATENATE V-MAKTX ITAB1-DESC INTO V_MAKTX
SEPARATED BY ', '.
ENDLOOP.
Thanks,
Naren
02-12-2007 5:18 PM
Hi,
I tried this example also..It worked fine..
DATA: STR TYPE STRING.
CONCATENATE 'TEST' 'ASSF' INTO STR SEPARATED BY ', '.
WRITE: / STR.
Thanks,
Naren
02-12-2007 5:24 PM
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
02-12-2007 5:43 PM
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
02-12-2007 7:41 PM
Hi Sivaram,
Use:
CONCATENATE V-MAKTX ITAB1-DESC INTO V_MAKTX
SEPARATED BY ', '.
Reward Point if helpfull...........................
02-12-2007 9:16 PM
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
02-12-2007 9:17 PM
Hi Chauhan,
Thank you very much, I have rewarded the points for you.
Thanks & Regards,
Sivaram K