‎2008 Feb 16 12:50 PM
Hi,
If you could send me code for below scanerio that will be great.
in 46c i have string '/ABCD/te_12' now i want to replace the '/' with '+' and '_' with '|', can you tell me how to do this.
thanks,
john
‎2008 Feb 16 12:56 PM
hi check the replace statement... hit F1 on replace and make ur code..
Basic form
REPLACE f WITH g INTO h.
Addition
... LENGTH len (length specification for field f )
Effect
Replaces the first occurrence of the contents of field f in field h with the contents of field g . All fields are handled in their defined length; this means that closing blanks are not ignored.
The return code value indicates whether the string f was found in h and replaced by g :
SY-SUBRC = 0 String replaced.
SY_SUBRC = 4 String not replaced.
Example
DATA FIELD(10).
MOVE 'ABCB' TO FIELD.
REPLACE 'B' WITH 'string' INTO FIELD.
returns:
FIELD = 'AstringCB', SY-SUBRC = 0
Note
The fields f and g in the REPLACE statement should not overlap. Otherwise, the result is undefined.
Addition
... LENGTH len ... (length specification for field f )
Effect
Searches for the string f in the field h not in its (full) field length, but in the length len .
Example
DATA: PATTERN(5) VALUE 'ABC',
LEN TYPE I,
REPL_STRING(5) VALUE '12345',
FIELD(12) VALUE 'abcdeABCDE'.
REPLACE PATTERN WITH REPL_STRING
INTO FIELD.
does not change FIELD , since 'ABC ' does not occur in abcdeABCDE ' .
LEN = STRLEN( PATTERN ).
REPLACE PATTERN LENGTH LEN
WITH REPL_STRING
INTO FIELD.
‎2008 Feb 16 1:00 PM
data:data(13) value '/ABCD/te_12' .
data:output(13).
output0(1) = ''.
output1(7) = data1(7).
OUTPUT+8(1) = '/'.
OUTPUT9(3) = data9(3).
WRITE:/ OUTPUT.
HI CKECK IT ,
Regards,
pandu.
Edited by: pandu app on Feb 16, 2008 6:37 PM
Edited by: pandu app on Feb 16, 2008 6:45 PM
‎2008 Feb 17 7:43 AM
Hi Pandu,
thanks for reply but what if the slash come in any other place how that can be handle .
thanks,
John