2009 Sep 29 10:56 AM
Hi
I have a string whoose value is '00789567 but i want to modivy this value to 00789567 . Look for inverted comma. How i can do this in abap.
How i can replace a inverted comma as when i write this inverted comma as string it show error.
Thanks.
2009 Sep 29 11:03 AM
Hi,
In your case first place value is '. So, u can clear in this way....
For example...
The STR variable contains the value '00425879
Now in the above variable STR, first place i.e STR+0(1) contains the value '
WRITE '' TO STR+0(1).
Then it will replace ' as empty and now the variable STR contains the value 00425879
Regards,
Shankar.
Hi
check this
DATA str TYPE string VALUE '''00789567'.
write str.
REPLACE FIRST OCCURRENCE OF regex '''' in str with ' '.
write :/ str.cheers
shibu
2009 Sep 29 11:00 AM
REPLACE is an ABAP command. You have answered your own question.
2009 Sep 29 11:01 AM
Hi,
u can try like below:
DATA: text(20) TYPE C.
text = 'ABCDEF'.
REPLACE 'A' IN text WITH 'XXXX'.
modify it according to ur rqmnt.
Rgds,
Pavan
2009 Sep 29 11:01 AM
Hi,
Try like this,
data: c_quote(4) type c value ''''.
data: var type string.
REPLACE ALL OCCURRENCES OF c_quote WITH space INTO var.
Regards,
Vikranth
2009 Sep 29 11:03 AM
Hi,
In your case first place value is '. So, u can clear in this way....
For example...
The STR variable contains the value '00425879
Now in the above variable STR, first place i.e STR+0(1) contains the value '
WRITE '' TO STR+0(1).
Then it will replace ' as empty and now the variable STR contains the value 00425879
Regards,
Shankar.
2009 Sep 29 11:16 AM
Hi
The value is coming from internal table and, it is not sure that when will have this special character at begining .
then i can not go any of these solutions.
pls help
2009 Sep 29 11:22 AM
Hi,
Try like below. It will work in all cases.
DATA: str TYPE string.
str = '''123''3'.
REPLACE ALL OCCURRENCES OF '''' IN str WITH space.
Thanks,
2009 Sep 29 11:45 AM
Hi,
You only telling that it's coming from internal table right.
Go through this code....
REPORT ZSHAN_COMMA.
data: BEGIN OF itab occurs 0,
str(10) type c,
END OF itab.
data: wa_str LIKE itab.
MOVE '''10' TO itab-str.
APPEND itab.
MOVE '20' TO itab-str.
APPEND itab.
MOVE '30' TO itab-str.
APPEND itab.
MOVE '''40' TO itab-str.
APPEND itab.
LOOP AT itab INTO wa_str.
write:/ wa_str-str.
ENDLOOP.
LOOP AT itab INTO wa_str.
IF wa_str-str+0(1) EQ ''''.
WRITE '' TO wa_str-str+0(1).
MODIFY itab FROM wa_str INDEX SY-TABIX.
ENDIF.
ENDLOOP.
LOOP AT itab INTO wa_str.
write:/ wa_str-str.
ENDLOOP.
Regards,
Shankar.
2009 Sep 29 11:27 AM
Hi
check this
DATA str TYPE string VALUE '''00789567'.
write str.
REPLACE FIRST OCCURRENCE OF regex '''' in str with ' '.
write :/ str.cheers
shibu
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |