‎2005 Sep 07 12:50 PM
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
‎2005 Sep 07 12:54 PM
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
‎2005 Sep 07 12:54 PM
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
‎2005 Sep 07 1:01 PM
Hi,
Hmmm... there are 100000 items in the table... I want to update them all at the same time wihtout using a loop..
‎2005 Sep 07 1:14 PM
‎2005 Sep 07 1:04 PM
Hi,
Try this:
i_purchase-MATNR = '00000000000100727'.
MODIFY i_purchase TRANSPORTING MATNR WHERE MATNR = '100727'.
Svetlin
‎2005 Sep 07 1:08 PM
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
‎2005 Sep 07 1:12 PM
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
‎2005 Sep 07 1:16 PM
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
‎2005 Sep 07 1:24 PM
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
‎2005 Sep 07 1:28 PM
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
‎2005 Sep 07 1:43 PM
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
‎2005 Sep 07 1:47 PM
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