Application Development 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: 

How to remove Leading zeros from MATNR "at Database Level"

Former Member
0 Kudos

Hi,

When we create a material in MM01 , we can either create material as Internal Material No. or External Material No. (By Explicitly entering a material No.)

Our requirement is that: When we create an Internal Material , there should NOT be any Leading Zeros in MATNR.

and for External Material No. , Leading Zeros Should be there. (In Database)

1) Now , we can create the No. Range for material in such a way that it will allow only AlphaNumeric entries for Internal Material , and Only Numeric Entries for External Material No.

This should slove the Purpose.

But According to the Client's requirement , Material No can be Numeric OR Alphanumeric for Internal As well as External Material No.

2) We can Add or Remove leading zeros from MATNR at application level. i.e. we can find some BADI / Enhancement where we will Use the Conversion FM (CONVERSION_EXIT_MATN1_OUTPUT or CONVERSION_EXIT_ALPHA_OUTPUT) and remove Leading Zeros from MATNR. But these changes will NOT reflect at Database Level , Because in MATNR Domain , there is a conversion Routine , That will Add Leading Zeros in MATNR While saving in the Database.

3) While Displaying the Material In SE11 , we can also set the "Display Format" as With leading Zeros OR Without Leading Zeros.

But we dont want to Just "Display" material with OR Without Leading Zeros. we want to actually create materials in that way.

What can we do , so that at Database Level our changes are Reflected.

Thanks and Regards,

Anand Gore

Edited by: anandgore on May 18, 2011 3:47 PM

3 REPLIES 3

brad_bohn
Active Contributor
0 Kudos

That will Add Leading Zeros in MATNR While saving in the Database.

That is because you have it configured that way. You can configure the storage as you desire. The default is the behavior you are describing. You, or your functional analyst, need to review the documentation on the MM config settings for material master number storage.

Never use CONVERSION_EXIT_ALPHA_OUTPUT for material conversion. Also keep in mind that the MATN1 functions have their own BADI for extended formatting...

eduardo_hinojosa
Active Contributor

Hi

As Brad tells you, you can do the customizing with tcode OMSL. One suggestion. If you delete the zeros in the left, ie, lexicographic order, 1001 is less than 9. So, the sorting in lists could be ugly for the endusers.

Regards

Eduardo

prakash_parikh
Participant
0 Kudos

Thank you very much Eduardo Hinojosa With Tcode OMSL I removed check box "Leading Zero" so no ABAP help is required. Great observation.