2008 Aug 11 9:38 AM
Hello Gurus, i need to calculate the material price, i have tried to divide the total price (MSEG-EXBWR type) with the quantity (MSEG-ERFMG type) but it`s not working.
Please help.
2008 Aug 11 10:23 AM
Sorry for not being clear enought. I have tried to divide the total price (MSEG-EXBWR type) with the quantity (MSEG-ERFMG type) but it`s not working; this is the code:
MODULE GET_PREIS INPUT.
data: preist like mseg-EXBWR,
quant like mseg-ERFMG,
preis type mseg-EXBWR,
preis_text type char20.
preist = mseg-EXBWR.
quant = mseg-ERFMG.
preis = preist / quant. "0.01 = 12.36 / 2.000 (the result is not good)
preis_text = preis.
CONDENSE preis_text.
set PARAMETER ID 'ZPR' field preis_text.
ENDMODULE.
I have also tried to convert the values to p type (with o without the number of decimals equal: preis type p decimals 3 and quant type p decimals 3), but still no luck.
Please help.
2008 Aug 11 9:48 AM
2008 Aug 11 9:51 AM
Hi,
Please be clear in what you want to tell us.
Try to use a packed decimal variable and see. this might work for you.
Please close , if solved
2008 Aug 11 10:23 AM
Sorry for not being clear enought. I have tried to divide the total price (MSEG-EXBWR type) with the quantity (MSEG-ERFMG type) but it`s not working; this is the code:
MODULE GET_PREIS INPUT.
data: preist like mseg-EXBWR,
quant like mseg-ERFMG,
preis type mseg-EXBWR,
preis_text type char20.
preist = mseg-EXBWR.
quant = mseg-ERFMG.
preis = preist / quant. "0.01 = 12.36 / 2.000 (the result is not good)
preis_text = preis.
CONDENSE preis_text.
set PARAMETER ID 'ZPR' field preis_text.
ENDMODULE.
I have also tried to convert the values to p type (with o without the number of decimals equal: preis type p decimals 3 and quant type p decimals 3), but still no luck.
Please help.
2008 Aug 11 11:20 AM
2008 Aug 11 1:30 PM
Have you got fixed point arithmetic set on the attributes of the program?
matt
2008 Aug 11 1:43 PM
It is a SAP transaction that i have to modify, transaction "MB1C", program SAPMM07M. And no, fixed point arithmetic is not checked.
Edited by: Ioan Constantin on Aug 11, 2008 4:11 PM
2008 Aug 12 1:51 PM
Posting the same question multiple times is contrary to forum rules. It fragments answers, and make it less likely for you to get consistent answers.
It's a standard SAP program, so you shouldn't change that flag. Instead, put the division coding into a function module/subroutine pool/class or the like, in your customer name space, and make sure that has the flag set.
matt
2008 Aug 12 2:07 PM
Thank you for the answer.
Regarding the multiple posted question, i didn`t know how to move it.
I apologize.
2008 Aug 13 12:16 AM
It's not moved. It's deleted.
Please read [the other rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] as well, incase you are not aware of them.
Cheers,
Julius
2008 Aug 13 4:14 PM
>
> Thank you for the answer.
> Regarding the multiple posted question, i didn`t know how to move it.
> I apologize.
No worries, we're all learning.