2014 May 27 12:45 PM
HI,
I want to delete leading zeroes only if the local variable having numeric field.
suppose the local variable is alpha-numeric means i want to display the full digit.
EX.
if lo_dcno = '0000000000052' i want 52 only otherwards
lo_dcno = '0000000sesese1' i want to display whole digits.
anyone give idea to solve this.
2014 May 27 12:57 PM
Hi Anitha,
This might be helpful for you.
IF NOT lo_dcno CA 'abcdefghijklmnopqrstuvwxyz'.
SHIFT lo_dcno LEFT DELETING LEADING '0'.
ENDIF.
Regards,
Anubhab
2014 May 27 12:50 PM
2014 May 27 12:52 PM
Hi Anitha,
1. Use these Function Module
CONVERSION_EXIT_ALPHA_INPUT
2. Use 'No-zero' Component
WRITE lo_dcno no-zero.
Example:
REPORT zc_convvert.
DATA : v1(10) TYPE n.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = '000AAA112'
IMPORTING
output = v1.
WRITE :v1 NO-ZERO.
OUTPUT: AAA112
Regards,
Thrimu
2014 May 27 12:53 PM
Hi,
conversion_exit .. is a good idea
you could code this with something like this
do.
if lv_value+sy-tabix(1) ne '0'.
lv_len = strlen( lv_value ) - sy-tabix.
lv_value = lv_value+sy-tabix(lv_len).
exit.
endif.
enddo.
2014 May 27 12:57 PM
Hi,
you can try this:
I don't know how you declar DOCNO. You can use string or char.
Regards, Dieter
2014 May 27 12:57 PM
Hi Anitha,
This might be helpful for you.
IF NOT lo_dcno CA 'abcdefghijklmnopqrstuvwxyz'.
SHIFT lo_dcno LEFT DELETING LEADING '0'.
ENDIF.
Regards,
Anubhab
2014 May 27 1:00 PM
Hi,
Use the below code to check for number presence in the variable.
IF lo_dcno CO '0123456789'.
SHIFT lo_dcno LEFT DELETING LEADING '0'.
ENDIF.
2014 May 27 1:12 PM
2014 May 27 1:39 PM
Just use in fieldcatalog
LS_FCAT-CONVEXIT = 'ALPHA'.
Regards,
Vadamalai A
2014 May 27 1:49 PM
Try using:
IF lo_dcno CO '0123456789 '.
PACK lo_dcno TO lo_dcno. CONDENSE lo_dcno.
ELSE.
"Do nothing
ENDIF.
Regards,
Óscar