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: 

create material number with leading Zero.

Former Member
0 Kudos

Hi Abpers,

I want to make material number field 40 char long. meand if material number is 10 char long then 30 0's are added in it.

e.g.

if matnr = 123456789

then i want to convert it like matnr = 0000000000000000000000000000000123456789.

if matnr = 12345678901234567890 then i want,

matnr = 0000000000000000000012345678901234567890.

pl help me in this

Reward if useful

regards,

Kapil Soni

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Kapil ,

Use the <b>UNPACK</b> command.

Here is a sample code which does the same

data : v_matnr(40) type c,
       v_mat type matnr.

v_mat = '123456789'.

       unpack v_mat to v_matnr.

write v_matnr.

Regards

Arun

8 REPLIES 8

Former Member
0 Kudos

Hi

Use condense

Former Member
0 Kudos

Hi Kapil,

Data: Mat_no(40)  type c.

Mat_no = matnr.  " material Number

Call Function 'CONVERSION_EXIT_ALPHA_INPUT'.
importing
  Field = MAT_NO
Exporting
  Field = MAT_NO.

Regards

Sudheer

Former Member
0 Kudos

Hi Kapil ,

Use the <b>UNPACK</b> command.

Here is a sample code which does the same

data : v_matnr(40) type c,
       v_mat type matnr.

v_mat = '123456789'.

       unpack v_mat to v_matnr.

write v_matnr.

Regards

Arun

anversha_s
Active Contributor
0 Kudos

hi,


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = wf_version
            IMPORTING
              output = wf_version.

Example:

input = 123

output = 0000000000000...000000000000123

Rgds

Anversha

Former Member
0 Kudos

Hi...very simple..

just take..

data: w_numc(40) type n.

w_numc = matnr.

write: w_numc.

Former Member
0 Kudos

try the following code:

shift matnr right deleting traling space.

overlay matnr with '0000000000000000000000000000000000000000'.

<b>P.S.</b>: The number of zero's in the overlay statement is 40.

Reward all useful answers.

Former Member
0 Kudos

hi

just keep the matnr of type n size 40 and check out, ur porb will be solved.

data: matnr(40) type n.

Former Member
0 Kudos

thanks experts