11-05-2007 7:01 PM
Any idea why the following code prints "SAPInc" on my system? I was expecting "SAP Inc".
Thanks for any help.
REPORT zz_temp.
DATA: l_v_char2(30) TYPE c VALUE 'SAP,Inc'.
REPLACE FIRST OCCURRENCE OF ',' in l_v_char2 with space.
WRITE: / l_v_char2.
11-05-2007 7:22 PM
Jerry,
Use this
REPORT zz_temp.
DATA: l_v_char2(30) TYPE c VALUE 'SAP,Inc'.
TRANSLATE l_v_char2 USING ', '.
WRITE: / l_v_char2.
Cheers
Aneesh.
11-05-2007 7:20 PM
There should be a space after comma.
DATA: l_v_char2(30) TYPE c VALUE 'SAP, Inc'.
Thanks,
Srinivas
11-05-2007 7:22 PM
Jerry,
Use this
REPORT zz_temp.
DATA: l_v_char2(30) TYPE c VALUE 'SAP,Inc'.
TRANSLATE l_v_char2 USING ', '.
WRITE: / l_v_char2.
Cheers
Aneesh.
11-05-2007 7:27 PM
Hi,
Can you try with LENGTH len addition
REPLACE FIRST OCCURRENCE OF ',' in l_v_char2 with space LENGTH 1.
As per SAP REPLACE is Obsolete in laltest version
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33cc358411d1829f0000e829fbfe/content.htm
Regards,
Atish
11-05-2007 7:49 PM
Hi,
Just use TRANSLATE statement instead.
DATA: L_V_CHAR2(30) TYPE C VALUE 'SAP,Inc'.
TRANSLATE L_V_CHAR2 USING ', '.
WRITE: / L_V_CHAR2.
Regards,
Ferry Lianto
11-05-2007 7:54 PM
Thanks to all. It just bugs me that it seems like it should work since it is syntactically correct.
11-05-2007 7:59 PM
If that bothers you, try:
REPLACE ALL OCCURRENCES OF ' ' IN l_v_char2 WITH ','.
ABAP doesn't seem to handle spaces well.
Rob
11-05-2007 8:06 PM
11-05-2007 8:18 PM
11-05-2007 7:52 PM
Check below code. it is printing as you need.
REPORT zz_temp.
DATA: l_v_char2(30) TYPE c VALUE 'SAP,Inc'.
replace ',' with space into l_v_char2.
WRITE: / l_v_char2.