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

Problem in Retaining leading zero!!!

Former Member
0 Likes
4,615

hi experts....

i have done a report where i have to upload data from

excel,(done using gui_upload) now my problem is when entering the

outbound delivery number as (e.g)800104 from tcode and enter

manually its accepting,

whereas when uploaded from excel i need to add two zero in

front (e.g) 00800104 for outbound delivery no to convert to SAP format

but excel does not allow adding zero in front

so my temp solution is converting to text and add two zero manually.

To overcome i included the Function module

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = likp-VBELN

IMPORTING

OUTPUT = likp-VBEL

but NO EFFECT...

Can you pls Suggest wat can be done .

Thanx in advance

Regards

Rachel

1 ACCEPTED SOLUTION
Read only

GauthamV
Active Contributor
0 Likes
2,497

hi,

'CONVERSION_EXIT_ALPHA_INPUT' fm is used to get leading zeros in sap.

if u want leading zeros in EXCEL right click on left side top of excel sheet ,select format cells and select text.

now u can have leading zeros in excel.

hi experts....

i have done a report where i have to upload data from

excel,(done using gui_upload) now my problem is when entering the

outbound delivery number as (e.g)800104 from tcode and enter

manually its accepting,

whereas when uploaded from excel i need to add two zero in

front (e.g) 00800104 for outbound delivery no to convert to SAP format

but excel does not allow adding zero in front

so my temp solution is converting to text and add two zero manually.

To overcome i included the Function module

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = likp-VBELN

IMPORTING

OUTPUT = likp-VBEL

but NO EFFECT...

Can you pls Suggest wat can be done .

Thanx in advance

Regards

Rachel

9 REPLIES 9
Read only

GauthamV
Active Contributor
0 Likes
2,498

hi,

'CONVERSION_EXIT_ALPHA_INPUT' fm is used to get leading zeros in sap.

if u want leading zeros in EXCEL right click on left side top of excel sheet ,select format cells and select text.

now u can have leading zeros in excel.

Read only

Former Member
0 Likes
2,497

thank u so much. problem solved

Regards

Rachel

Read only

Former Member
0 Likes
2,497

Hi,

1.It is well documented.

Check this:

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.

Usage:

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = v_input

importing

output = v_output

exceptions

others = 1.

2.If failed these FM's ,then use concatenate key word for adding two zero's infront to that number.

Regards,

Shiva Kumar

Read only

Former Member
0 Likes
2,497

Hi,

to overcome this problem all you need to do is,

when you read the Exel sheet data into the internal table

just loop thru it and add 2 zeroes to all the values.

OR

put a single quote in the excel file before the zeroes

' 00893..

Regards,

Samson Rodrigues.

Read only

Former Member
0 Likes
2,497

hi arun

In EXCEL select that column A ( for eg if delivery no is A column) then right click FORMAT CELLS -> TEXT instead of General catorgy

Regards

Deva

Read only

0 Likes
2,497

thanks prob solved

Read only

Former Member
0 Likes
2,497

if you cant change the excel file cell formatting then you can use command 'CONCATENATE' to add leading zeros

Read only

anversha_s
Active Contributor
0 Likes
2,497

Hi,

This is a common issue.

You can solve this by below method.

data: l_text1(10) type c value '`',
        l_out(20)   type c.

  concatenate l_text1 l_your_variable into l_out.

Download l_out in excel sheet.

Regards,

Anversha

Read only

0 Likes
2,497

hi anversha ,

i really appreciate ur reply, thanx and i have tried that,

can u pls tell me what do u mean by download l_out

wat values to be passed in l_out

can u pls explain

thanx

Rachel