2007 Sep 20 1:46 PM
i have range
158-156
i want
156-158
i tried string_reverse not work,any idea.
i get this in line with 151,152,158-156,160....
2007 Sep 20 1:51 PM
Hi
Check the Number range related Tcodes
<b>SNRO and SNUM</b> and the fun module
NUMBER_GET_NEXT
<b><REMOVED BY MODERATOR></b>
regards
Anji
Message was edited by:
Alvaro Tejada Galindo
2007 Sep 20 1:55 PM
friend i will clear myself
i have this line
151,152,158-156,160 in 1 parameter.
<b>
151,152,156-158,160</b> i want to get this.
2007 Sep 20 2:02 PM
again
temp = 151,152,158-156,160
after change
temp = 151,152,156-158,160
2007 Sep 20 2:02 PM
Oh my god... You'll have to create a DO loop. And split at the comma first into two variables.
Then try to split the first var again at '-'. If succesfull (the string is a range), check if the first var is greater. If so concatenate again but then in the opposirte order.
Do this until the complete string is processed.
Not nice, but anyway.
2007 Sep 20 2:13 PM
hi
i think better to divide 151 is a
152 is b
158-156 is d
then u will split it that num and
concatnate the total a b d in g.
ok
regards
kk
2007 Sep 20 1:52 PM
Assuming that 158-156 is a string and not a range:
Use SPLIT AT '-' to split the original_string into two help-variables (type N).
If the first is higher, concatenate <string2> '-' <string1> into the original_string, if not use the original_string...
2007 Sep 20 1:53 PM
hi richi,
IF range-low GT range-high.
value = range-low.
range-low = range-high.
range-high = value.
ENDIF.
of course value has to have the same type like range low (or range-high).
hope this help, come back if it does not
ec
2007 Sep 20 2:34 PM
The code below works, although it's not nice...
REPORT zbc_temp.
DATA: tp_in TYPE line VALUE '151,152,158-156,160'.
DATA: tp_out TYPE line.
DATA: var1 TYPE line. "Left: Split at comma
DATA: var2 TYPE line. "Right: Split at comma
DATA: var3 TYPE numc4. "Left: Split at dash
DATA: var4 TYPE numc4. "Right: Split at dash
WRITE: tp_in.
DO.
SPLIT tp_in AT ',' INTO var1 tp_in.
IF var1 <> ''.
IF var1 CS '-'.
SPLIT var1 AT '-' INTO var3 var4.
IF var3 > var4.
CONCATENATE var4 '-' var3 INTO var1.
ENDIF.
ENDIF.
CONCATENATE tp_out ',' var1 INTO tp_out.
ELSE.
SHIFT tp_out LEFT DELETING LEADING ','.
EXIT.
ENDIF.
ENDDO.
WRITE: tp_out.