Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Delete leading zeros

Former Member
0 Likes
89,406

hi,

I have suppose 0010000073 No.

I want to pass this value to other table for with value as 10000073.

which statement i should use for deleting the zeros

hi,

I have suppose 0010000073 No.

I want to pass this value to other table for with value as 10000073.

which statement i should use for deleting the zeros

8 REPLIES 8
Read only

Former Member
22,984

data: w_vbeln type vbak-vbeln,

w_char(10).

w_vbeln = '000012345'.

write w_vbeln to w_char no-zero.

Read only

Former Member
22,984

Hi,

You can use the fm CONVERSION_EXIT_ALPHA_OUTPUT

or you can use the SHIFT.

SHIFT <yourField> LEFT DELETING LEADING '0'.

Regards,

Omkar.

Read only

Former Member
22,984

Hi,

Use the statement as below:

SHIFT C LEFT DELETING LEADING '0'.

Read only

Former Member
0 Likes
22,984

data: lv_swap type c length 10.

write your_variable to lv_swap no-zero.

Read only

Former Member
0 Likes
22,984

U can even make use of the function module

CONVERSION_EXIT_ALPHA_OUTPUT

Read only

Former Member
0 Likes
22,984

ch = '0010000073'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = ch

IMPORTING

OUTPUT = ch.

Read only

Former Member
0 Likes
22,984

The function Module 'CONVERSION_EXIT_ALPHA_OUTPUT' is used to remove the leading zeros in a field.

the following is a sample code which i have used for 'Commitment item' in my report. replace the field with your required field.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT = IT_FMIT1-RFIPEX

IMPORTING

OUTPUT = IT_FMIT1-RFIPEX.

Rewards if useful.

Read only

Former Member
0 Likes
22,984

Conversion exit ALPHA, external->internal

ALPHA conversion is used especially with account numbers. During conversion from the external to the internal format, the system checks to see if input in the INPUT field is purely numeric, that is, if this input consists only of numbers, possibly with spaces before and after them. If this is the case, then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.

Example:

(Input field and output field are both eight characters in length)

1. '1234 ' --> '00001234'

2. 'ABCD ' --> 'ABCD '

3. ' 1234 ' --> '00001234'

Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) is undertaken in exactly the opposite manner.