2008 Nov 09 12:13 PM
Hi All,
Please help me with a functional module to remove the leading zeros and replace them with spaces.
Eg: number : 000095
output needed : 95.
I tried with the search in the sdn but couldnt find.
Regards,
Srikanth.
2008 Nov 09 12:25 PM
Hi srik,
I think there is no function module for purpose,but have a look on the simple staatement
data:p(5) value '00044'.
write:/ p no-zero.
-
output:44
with Regards,
Jaheer.
2008 Nov 09 12:27 PM
2008 Nov 09 2:45 PM
Look at function module CONVERSION_EXIT_ALPHA_OUTPUT This will convert "000095" to '95'. If you need to get to '<4 spaces>95' then use the WRITE INTO command with the addition "RIGHT-JUSTIFIED".
Jaheer Hussein's suggestion should also work, with some modification.
data:p(5) value '00044',
v(5).
write p into v no-zero right justified.
matt
Edited by: Matt on Nov 9, 2008 3:45 PM
2008 Nov 09 5:17 PM
Hi Srikanth,
Check out the code for your requirement.
DATA: V_MATNR TYPE MARA-MATNR VALUE '00098'.
DATA: V_OUTPUT TYPE MARA-MATNR.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = V_MATNR
IMPORTING
OUTPUT = V_OUTPUT.
.
WRITE: / V_OUTPUT.
Thanks,
Chidanand
2008 Nov 10 2:10 AM
Hi,
Please use FM ''CONVERSION_EXIT_ALPHA_OUTPUT'' to have a try.
Regards,
Chris Gu
2008 Nov 10 8:03 AM
2008 Nov 10 9:53 AM
First move the value into a variable of type char(xx).
Then use
REPLACE ALL OCCURENCES OF '0' with SPACE.
This will help
2008 Nov 10 9:54 AM
Hi,
Try below code for your requirement.
DATA:p(10) VALUE '000095'.
WRITE: p NO-ZERO RIGHT-JUSTIFIED.
Best Regards,
Deepa Kulkarni
2008 Nov 10 9:54 AM
2008 Nov 10 9:57 AM
Hi,
Just use a SHIFT statement.
SHIFT number left deleting leading '0'.
Regards,
Suganya
2008 Nov 10 10:29 AM