‎2008 Aug 28 8:54 AM
Hi,
i have a simle VAR1 (CHAR255) which contains text
like 'test1morelines' or 'contain1moretext'' as example.
I will only use the text before 1.
i split at like this: split VAR1 at '1' into VAR1 dummy.
It works OK, but i have to use the seconc VAR dummy.
Is there any statement that deletes all char starting at vaue 1?
thanks,
regards, Dieter
‎2008 Aug 28 9:04 AM
hiii
first use FIND statement for finding '1' in variable then use sy-fdpos to get that position and then you can replace all value by 'SPACE' using offset (following abap statement)
REPLACE SECTION [OFFSET off] [LENGTH len] OF dobj WITH new
[IN {BYTE|CHARACTER} MODE].
regards
twinkal
‎2008 Aug 28 8:57 AM
hmmm Dieter i dont really get the problem, why dont you just delete dummy?
‎2008 Aug 28 9:03 AM
Hi,
Instead of
split VAR1 at '1' into VAR1 dummy., you can use
split VAR1 at '1' into VAR1 .Luck,
Bhumika
‎2008 Aug 28 9:04 AM
hiii
first use FIND statement for finding '1' in variable then use sy-fdpos to get that position and then you can replace all value by 'SPACE' using offset (following abap statement)
REPLACE SECTION [OFFSET off] [LENGTH len] OF dobj WITH new
[IN {BYTE|CHARACTER} MODE].
regards
twinkal
‎2008 Aug 28 9:10 AM
hi,
Instead of Using SPLIT you can find the position of the '1' in the String.
Search '1' in <String>.
Sy-FDPOS contains the position os the '1'.
Extract the String using Offset.
string2 = string1+0(sy-fd-pos).
Regards
Sumit Agarwal
‎2008 Aug 28 9:11 AM
the dummy is necessary to take the "garbage"; it cant be just thrown away.
Another way is to use the FIND command to the position of "1", checking if evrything is ok, then calcualting the len of desired string from the position (obvious minus 1) and then use s substring command like var1+ü(len).
To be honest, its not shorter or more beautiful..
‎2008 Aug 28 9:42 AM
Hi,
thanks to all. I think there is no better statement. I will use split with dummy.
Bhumika: split VAR1 at '1' into VAR1 .
gives an syntaxerror (ECC6).
i close the thread. Thanks again.
Regards, Dieter
‎2008 Aug 28 10:32 AM
Use this syntax
SPLIT var1 AT '1' INTO: TABLE itab.
This table would be of single column type string and will have
test
morelines' or
contain
moretext''
Hope this helps!