Is your requirement for this as a material code ?
How you differentiate the format in system ?
Are you using different material type for the different format ?
Like as you have enter the number 123456789 in MM01 screen,
The as per material type system will change the material number 123-456-789 and 12-34-56-78-9 etc etc...
Or you can elaborate..