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: 

Modify table

Former Member
0 Kudos

Hi,

I have a internal table that I want to clean up a little bit.

Inside i_purchase I have a field name MATNR.

i_purchase-MATNR now is 100727

I want it to be '00000000000100727' (orginal form).

Is this possible without using a loop ?

//MA

Message was edited by: Martin Andersson

1 ACCEPTED SOLUTION

Vinod_Chandran
Active Contributor
0 Kudos

Hi Martin,

Use the function module CONVERSION_EXIT_ALPHA_INPUT.

Give i_purchase-MATNR in the parameter INPUT and

give another variable of length 17 in the parameter OUTPUT.

Kindly reward points if this is helpful.

Thanks

Vinod

11 REPLIES 11

Vinod_Chandran
Active Contributor
0 Kudos

Hi Martin,

Use the function module CONVERSION_EXIT_ALPHA_INPUT.

Give i_purchase-MATNR in the parameter INPUT and

give another variable of length 17 in the parameter OUTPUT.

Kindly reward points if this is helpful.

Thanks

Vinod

0 Kudos

Hi,

Hmmm... there are 100000 items in the table... I want to update them all at the same time wihtout using a loop..

0 Kudos

You can use the command UNPACK

Former Member
0 Kudos

Hi,

Try this:

i_purchase-MATNR = '00000000000100727'.

MODIFY i_purchase TRANSPORTING MATNR WHERE MATNR = '100727'.

Svetlin

0 Kudos

just convert this(i_purchase-MATNR) field type to NUMC with 18 characters long.

if you move 100727 to i_purchase-MATNR it will be automatically padded with 12 0s in the front.

Regards

Raja

0 Kudos

Hi,

Let me explan a little more...

If u use standard SQL the statement would be something like this:

Update MYTABLE set MATNR = '00000000000' + MATNR

How would this look like when having a internal table ?

//MA

0 Kudos

hmmm not clear.

the leading zeros are padded by the conversion routine at the domain level.

to have it in you internal table if the field is define like mara-matnr then you have to use the function module mentioned earlier. the same can be achieved as i said. (changing the data type to NUMC with lenth 18(as this is the length of matnr in mara))

the only problem with my approach would be that if you matnr is a alpha numberic one , you cannot use the approach i have explained.

Regards

Raja

0 Kudos

Hi,

Hmm...I got the i_purhcase from another FM.

This anothern FM has deleted all the leading '0'.

And now I want It back

//MA

0 Kudos

copy it to your internal table where the matnr field has to be of typ n with lenth 18. thats all you need. it will automatically be padded with leading zeros.

Regards

Raja

0 Kudos

if you find the answers helpful, reward them and if the question is answered, please mark it as answered and close the thread.

Regards

Raja

0 Kudos

Did you check this "another FM" to see if there is a setting not to convert the material number to output format? MATNR in your i_purchase should be defined as NUMC(18).

Srinivas