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

Function Module to put leading zero

Former Member
0 Likes
5,354

Hi,

Function that puts leading zeros. I am getting a text file which has got cost center as 1234, but i need to put leading zero in order to check the availability of the value in the table csks.

I want a function module which puts leading zero.

5 REPLIES 5
Read only

gopi_narendra
Active Contributor
0 Likes
1,633

CONVERSION_EXIT_ALPHA_INPUT for getting leading zeros

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT = IBSIS-ZUONR

IMPORTING

OUTPUT = IBSIS-ZUONR

EXCEPTIONS

OTHERS = 1.

Regards

- Gopi

Read only

0 Likes
1,633
data : l_val type lifnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_val
IMPORTING
OUTPUT = l_val.

write : l_val
Read only

anversha_s
Active Contributor
0 Likes
1,633

Hi,

chk this one.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = in_value

IMPORTING

output = out_value.

rgds

Anver

pls mark helpful answers

Read only

Former Member
0 Likes
1,633

Hi,

Use the function module

<b>CONVERSION_EXIT_ALPHA_INPUT</b>

converts any number into a string fill with zeroes, with the number at the extreme right

Example:

input = 123

output = 0000000000000...000000000000123

Read only

Former Member
0 Likes
1,633

hi,

Use FM <b>'CONVERSION_EXIT_ALPHA_INPUT'</b>

<b>FU CONVERSION_EXIT_ALPHA_INPUT</b>

____________________________________________________

Text

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.

Parameters

INPUT

OUTPUT

Exceptions

Function Group

ALFA

Regards,

Santosh