cancel
Showing results for 
Search instead for 
Did you mean: 

Currency Conversion

Former Member
0 Kudos

Hello,

I need some help with currency conversions. I am working on a workflow process. One of the steps in the workflow is conditional, based on whether the total value is greater that a certain amount. The ranges are maintained in USD, so I need to convert from the document currency to USD.

Here is what I have tried so far.

fromCcyBean=doc.getCurrency();
toCcyBean=IBeanHomeLocator.lookup(session, CurrencyIBeanHomeIfc.sHOME_NAME).findUnique("USD");

convSRFCost=IBeanHomeLocator.lookup(session, CurrencyConversionIBeanHomeIfc.sHOME_NAME).findUnique(fromCcyBean,toCcyBean);

the findUnique method of CurrencyConversionIBeanHomeIfc takes SimpleObjectReferenceIfc as the input

findUnique(SimpleObjectReferenceIfc from, SimpleObjectReferenceIfc to)

so the error I am getting is

reflection error: bsh.ReflectError: Method findUnique( com.sap.odp.common.db.LocalizedObjectReference, com.sap.odp.api.doccommon.masterdata.CurrencyIBeanImpl ) not found in class'com.sap.odp.api.doccommon.masterdata.CurrencyConversionIBeanHomeImpl'

I tried using getObjectReference() but that did not work either.

Can anyone please advise me on how to get the CurrencyConversionBean, so I can get the conversion rates.

Please let me know if I my approach is incorrect.

Thanks,

MP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

getObjectReference() is working fine for me. try the below code

fromCcyBeandoc=doc.getCurrency();

fromCcyBeanHome=IBeanHomeLocator.lookup(session, com.frictionless.api.doccommon.masterdata.CurrencyIBeanHomeIfc.sHOME_NAME

);

fromCcyBean = fromCcyBeanHome.find(fromCcyBeandoc);

fromCcyBeanName = fromCcyBean.getObjectReference();

toCcyBeanHome=IBeanHomeLocator.lookup(session, com.frictionless.api.doccommon.masterdata.CurrencyIBeanHomeIfc.sHOME_NAME

);

toCcyBean = toCcyBeanHome.findUnique("USD");

toCcyBeanName = toCcyBean.getObjectReference();

convSRFCost=IBeanHomeLocator.lookup(session, com.frictionless.api.doccommon.masterdata.CurrencyConversionIBeanHomeIfc.sHOME_NAME).findUnique(fromCcyBeanName,toCcyBeanName);

CurrencyRate = convSRFCost.getRate();

Regards

Mudit Saini

Former Member
0 Kudos

Thank you Mudit, this solved the problem.

I think the problem was because I did not lookup the document currency in the currency home.

Appreciate your help.

Thanks,

MP

Answers (0)