01-16-2008 6:38 AM
I want to replace leading zeroes with space.
e.g. if input is "000020" output should be " 20" and not "20".
01-16-2008 6:52 AM
HI,
Try this
data: C(10) type n value '000020',
offest type i value 1.
WHILE c(offest) = '0'.
REPLACE '0' WITH SPACE INTO C.
ADD 1 TO offest.
ENDWHILE.
Regards
01-16-2008 6:57 AM
Hi Priti...
Refer below piece of code for solution:
NUMBER = '000020'
SHIFT NUMBER LEFT DELETING LEADING '0'.
CONCATENATE SPACE NUMBER INTO NUMBER.
Regards,
Piyush
Edited by: Piyush Mathur on Jan 16, 2008 7:57 AM
01-16-2008 7:04 AM
Hi Priti,
EXECUTE BELOW CODE THIS WILL WORKS FINE 4 UR PROBLEM CHECK IT ONCE..
data: str type string value '000100',
str1 type c value space.
shift str left deleting leading '0'.
concatenate str1 str into str.
write:/ str.
Reward points if helpful.
Kiran Kumar.G.A
Have a Nice Day..
01-16-2008 7:49 AM
Hello Priti,
Try this and it will certainly work for all conditions.
data: str type string value '000200'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = str
IMPORTING
OUTPUT = str
.
write:/ str.
Happy Coding.
Cheers,
Tej.
OOOPS!!! , I need to modify the code to work as per your requirement. May I know what field are you trying to modify as per your requirement. I need to know the maximum length of the field to work the way you want it to.
Edited by: Shree Tejus on Jan 16, 2008 8:52 AM