on 2022 Apr 11 7:24 AM
Hello,
I need to display Quote TotalNetPrice in Words in the CPQ Document. Is there a CTX tag that shows the price/amount in words in accordance with the currency?
Thank you,
Vaibhav Jadhav
Request clarification before answering.
Hi vrjadhav
hope below code will solve your question .. can you vote, accept this solution and close this thread.
netprice = Quote.Total.TotalAmount
def convert(num):
units = ("", "one ", "two ", "three ", "four ","five ", "six ", "seven ","eight ", "nine ", "ten ", "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ","sixteen ", "seventeen ", "eighteen ", "nineteen ")
tens =("", "", "twenty ", "thirty ", "forty ", "fifty ","sixty ","seventy ","eighty ","ninety ")
if num < 0:
return "minus "+convert(-num)
if num<20:
return units[num]
if num<100:
return tens[num // 10] +units[int(num % 10)]
if num<1000:
return units[num // 100] +"hundred " +convert(int(num % 100))
if num<1000000:
return convert(num // 1000) + "thousand " + convert(int(num % 1000))
if num < 1000000000:
return convert(num // 1000000) + "million " + convert(int(num % 1000000))
return convert(num // 1000000000)+ "billion "+ convert(int(num % 1000000000))
inwords= (convert(int(netprice)))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yoganandamuthaiah , thank you. I was primarily seeking for a CTX tag that I could utilize directly on the Document level without having to write any code. Now I've discovered that there isn't a special CTX tag for this. It might be a future SAP Team upgrade. Once again, thank you for your speedy response.
Hi Vaibhav
You should use this Tag:
<Q_TAG(<*CTX( Quote.Total.TotalNetPrice.DefaultDisplay)*>)>
Also, you can involve any CTX tag in the form of the Q Tag. More info, you can find here:
Q Tag is part of the Document Generation Tags.
Regards
Stevica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<*CTX( Number(<*CTX( Quote.Total.TotalNetPrice.DefaultDisplay)*>).ToWords )*>
User | Count |
---|---|
6 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.