‎2008 Jul 11 7:00 AM
Hi Experts,
i want to convert - sign to + sign. is there any function module. and if its + it should be +.
Correct answers will be rewarded.
Regards,
Sunita.
‎2008 Jul 11 7:02 AM
Hi,
Why are you looking for function module, you can write simple logic.
IF variable < 0.
variable = variable * -1.
ENDIF.
‎2008 Jul 11 7:02 AM
Hi,
Why are you looking for function module, you can write simple logic.
IF variable < 0.
variable = variable * -1.
ENDIF.
‎2008 Jul 11 7:04 AM
HI,
TRY LIKE THIS..
REPLACE ALL OCCURRENCES OF '-' IN <STRING NAME> WITH '+'.
for EG try this..
data : hi(12) type c.
HI = '-asdas'.
WRITE HI.
REPLACE ALL OCCURreNCES OF '-' IN hi WITH '+'.
WRITE HI.
Regards,
Sai
Edited by: Saikumar on Jul 11, 2008 11:39 AM
Edited by: Saikumar on Jul 11, 2008 11:40 AM
‎2008 Jul 11 7:08 AM
hi,
You can use ABS (var). It will give you all the positive values.
Concatenate all with '+' symbol.
I hope this will help.
Regards
Sumit Agarwal
‎2008 Jul 11 7:09 AM
Hi,
Move that field to a variable type of string then replace '-' with statment of Replace.
‎2008 Jul 11 7:10 AM
Hi,
there is no need to have functionmodule
have a look.
REPLACE ALL OCCURRENCES OF '-' IN <variable name>
WITH '+'.
regards.
sriram.
‎2008 Jul 11 7:25 AM
Hi try this code...
FORM change_sign CHANGING var TYPE c.
IF var LT 0.
SHIFT var RIGHT DELETING TRAILING '-'.
SHIFT var LEFT DELETING LEADING ' '.
CONCATENATE '-' var INTO var.
ELSE.
SHIFT var LEFT DELETING LEADING ' '.
ENDIF.
ENDFORM.