2007 Nov 05 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.
2007 Nov 05 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.
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
2007 Nov 05 7:20 PM
There should be a space after comma.
DATA: l_v_char2(30) TYPE c VALUE 'SAP, Inc'.
Thanks,
Srinivas
2007 Nov 05 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.
2007 Nov 05 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
2007 Nov 05 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
2007 Nov 05 7:54 PM
Thanks to all. It just bugs me that it seems like it should work since it is syntactically correct.
2007 Nov 05 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
2007 Nov 05 8:06 PM
2007 Nov 05 8:18 PM
2007 Nov 05 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.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |