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

Leading Zero's

Former Member
0 Likes
1,118

Hi All,

   I am facing the problem with leading zeros.I am getting the  value for the field ZZMATNR is '00000000000000000000000000000000000000000000000000358934'.But user is expecting the value '0358934'.

I used the function module 'CONVERSION_EXIT_ALPHA_OUTPUT'.

I am getting the value is '358934'.But user expecting the value is '0358934'.

In the table itself the value is '0358934'.

Please help me how to code this.

Regards,

sujan

Hi All,

   I am facing the problem with leading zeros.I am getting the  value for the field ZZMATNR is '00000000000000000000000000000000000000000000000000358934'.But user is expecting the value '0358934'.

I used the function module 'CONVERSION_EXIT_ALPHA_OUTPUT'.

I am getting the value is '358934'.But user expecting the value is '0358934'.

In the table itself the value is '0358934'.

Please help me how to code this.

Regards,

sujan

8 REPLIES 8
Read only

Florian
SAP Champion
SAP Champion
0 Likes
1,036

Hi sujan,

where is you problem, code a conversation_exit.

Here is the docu to it. If you face some problems, use the search.

SAP Library - Domains

If it is a specific problem and not suitable for the whole system, you also can use the write_statement explained here

SAP Library - ABAP Programming (BC-ABA)

In case it is in a Form, Sapscript or Smartforms, you use the wrong space and there, you got other options to solve the problem.

Regards

Florian

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,036

Check the actual conversion exit, if any, associated to your customer field ZZMATNR (thru its domain definition) is this actually ALPHA ?

I doubt it, an ALPHA conversion-exit would not allow an internal value of '0358934' except if length of domain is 7 or if "someone" updated the database with OPEN-SQL statement forgetting the conversion-exit (CONVERSION_EXIT_XXXX_INPUT) and generating records that can no longer be selected on this field value when executed in correct program

Regards,

Raymond

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,036

Hi

Can't we use

SHIFT MATNR DELETING ADJACANT DELETING ZERO.

Try this out.

Thanks,

Sreeram

Read only

Former Member
0 Likes
1,036

as Raymond said, you will have to use a different conversion exit (once there is one). I suppose your ZZMATNR is the same type as MATNR (but for a different purpose). The conversion exit there is MATN1, which will decide on how many leading zeros are to be set.

so use CONVERSION_EXIT_MATN1_OUTPUT instead (if this is your case)

Read only

ThangaPrakash
Active Contributor
0 Likes
1,036

Hello Sujan,

What is the data element associated to field ZZMATNR and check the domain of the data element, does it has a conversion routine assigned.



* Create a data element say Type : CHAR and ;length 7 and assign this data element to ZZMATNR.

Regards,

TP

Read only

Former Member
0 Likes
1,036

Hi Sujan T,

Does the user always expects a leading zero even if the value has 7 digits?

If so, then after you use the FM 'CONVERSION_EXIT_ALPHA_OUTPUT',

use the following:

                           CONCATENATE '0'  '358934' into new_value.





Read only

0 Likes
1,036

those are really business-orientated solutions

Read only

Former Member
0 Likes
1,036

Hi Sujan T,

check the domain output characteristics for MATNR it is having conversion routine "MATN1"

so u can use "CONVERSION_EXIT_MATN1_OUTPUT" .

here you can avoid all leading zeros..

but if u want 'ONE' leading zero then u need to concatenate it after conversion .. as john suggested .

Regards,

Nitin