cancel
Showing results for 
Search instead for 
Did you mean: 

Can we do calculation during Quote Document Generation via Templates

jain_adesh
Discoverer
0 Kudos
448

In SAP CPQ, can we do simple calculation during Quote document generation, if yes then which Tags we can use.

For example, i have two custom fields in Quote (A = 2, B=3). In Quotes "Document Generation Template", when i am generating the document for Customer, i want to show the value as A*B, i.e. 6 should be shown. So are there any Tags (Q Tags, C Tags etc...) available for us to use in Documents ?

Other workaround is to create a new Quote Custom Field (C) and using Iron Python script (on certain event), we can calculate the value of C = A*B and save it. Then later use this C field in Documents via tag "<<Q_TAG(<*CTX( Quote.CustomField(C) )*>)>>". We want to avoid creating unnecessary custom fields, if possible.

Accepted Solutions (1)

Accepted Solutions (1)

nikhilwalsetwar
Contributor
0 Kudos

Hi jain_adesh

For this scenario you can use Eval tag in the document generation template, so it will do the calculations on the fly while document is getting generated.

For example it will be like -

<* Eval(<*CTX( Quote.CustomField(A) )*> * <*CTX( Quote.CustomField(B) )*> ) *>

Hope this helps,

Nikhil

jain_adesh
Discoverer
0 Kudos

Hi Nikhil,

Thanks for your response.

EVAL tags are working only in the Quote context but i could not figure out on how to call this under the Q_TAG during Document generation. As per the SAP Help Portal, they have mentioned various tags we can use in Documents

https://help.sap.com/viewer/884885f05e6b4c8082254d4d9d63f19b/2011/en-US/37fa369968d748cc848b1785c65c...

I tried using EVAL directly in the Quote documents, it doesn't work. Even tried using EVAL inside <<Q_TAG()>>, it doesn't work either.

OnHelp site its mentioned to use CTX inside the Q_TAG, but not sure how to use EVAL inside the CTX directly.

jain_adesh
Discoverer
0 Kudos

Hi Nikhil,

Its actually working, i used the following Tag in documents, it works

<<Q_TAG(<* Eval(<*CTX( Quote.CustomField(A) )*> * <*CTX( Quote.CustomField(B) )*>) *>)>>

I was trying to fit this somehow in CTX Tag, may be confused myself further. thanks for your help though.

Regards

Adesh

nikhilwalsetwar
Contributor
0 Kudos

Hi jain_adesh

You can use it in the below format, I just tested and it worked perfectly fine for me.

<<Q_TAG( <* Eval(<*CTX( Quote.CustomField(A) )*> * <*CTX( Quote.CustomField(B) )*> ) *>)>>

Please make sure your field type is free form and contains the integer/float values.

Hope this helps,

Nikhil

Answers (0)