Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FM

hi,

some one please help me to understand the fm.

RSAR_CURRENCY_CONVERT.

CALL FUNCTION 'RSAR_CURRENCY_CONVERT'

EXPORTING

I_CURRENCY = S_DATAPAK-CURRENCY

CHANGING

C_AMOUNT = V_AMOUNT.

.

V_PRC = V_AMOUNT.

S_DATAPAK-/BIC/CPTPRI = V_PRC..

and also what is th meaning of

IF S_DATAPAK-/BIC/CPTPRI CO ' 0123456789

Thanks

Message was edited by:

Rob

Former Member replied

Hi Rob,

This FM RSAR_CURRENCY_CONVERT basically checks in TCURX table (table for Decimal Places in Currencies) and converts your amount based on that.

Here is the code.

DATA: shift TYPE i,

decimals TYPE i,

tmp TYPE p DECIMALS 2,

l_s_curx TYPE tcurx.

SELECT SINGLE * FROM tcurx INTO l_s_curx

WHERE currkey = i_currency.

IF sy-subrc = 0.

decimals = l_s_curx-currdec.

shift = 2 - l_s_curx-currdec.

ELSE.

  • if currency is not known, then use 2 decimals.

shift = 0.

ENDIF.

  • Number of decimals is given by table tcurc

  • too many decimals will simply be ignored

tmp = c_amount / 10 ** shift.

c_amount = tmp.

ENDFUNCTION.

Lets say your currency key (from source data is) USD.

Go to table TCURX and see number of decimal places for it.

Lets say it is 5.

C_Amount = 100 (on which this conversion is going to be applied)

so your decimal will become 5 and shift = -3

And then the tmp = 100/10 exp -3 (Double * is used for Exponential)

So tmp = C_Amount = 100000.00 (as tmp is of type decimal with 2 decimal points see declaration)

In your case you are passing the DATAPAK-Curreny and v_amount to this function module.And then changing

V_PRC = V_AMOUNT. and making your KF -/BIC/CPTPRI equal to V_PRC

S_DATAPAK-/BIC/CPTPRI = V_PRC

and also what is th meaning of

IF S_DATAPAK-/BIC/CPTPRI CO ' 0123456789

This means BIC/CPTPRI contains values like ' 0123456789'

You can check this by placing csor in ABAP code and press F1 (Function Key)

Hope it helps

Thanks

Chitrarth Kastwar

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question