‎2013 Jul 11 11:44 AM
Hi All,
I am trying to convert HUF amount(Hungarian Currency Format) to USD Amount.While doing this calculation exchange rate is taken when the document is created i.e.Doc creation Date..But i want the exchange rate to be exchange rate for today(Day when report is run).
Please Help ASAP.
Code for Currency Conversion which i used is following -
CLEAR wa_po_curr_usd .
REFRESH it_po_curr_usd .
wa_ekko-netpr = wa_ekko-rlwrt.
IF is_cdhdr-udate IS NOT INITIAL. .
DATA : lcurr LIKE tcurc-waers .
IF wa_ekko-waers NE c_usd.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
client = sy-mandt
date = is_cdhdr-udate
foreign_currency = c_usd
local_amount = wa_ekko-netpr
local_currency = wa_ekko-waers
type_of_rate = 'M'
read_tcurr = 'X'
IMPORTING
foreign_amount = wa_ekko-po_cur_usd.
ELSE.
wa_ekko-po_cur_usd = wa_ekko-rlwrt.
ENDIF.
ENDIF.
‎2013 Jul 16 5:17 AM
Hi,
Is your question resolved ?
If not, I might be able to work with you to resolve this. Before that, from a functional point of view, here are my assumptions:
If all of the assumptions are correct, we can discuss this further
Thanks.
‎2013 Jul 11 11:55 AM
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
client = sy-mandt
date = is_cdhdr-udate ===== Pass here sy-datum
foreign_currency = c_usd
local_amount = wa_ekko-netpr
local_currency = wa_ekko-waers
type_of_rate = 'M'
read_tcurr = 'X'
IMPORTING
foreign_amount = wa_ekko-po_cur_usd.
ELSE.
wa_ekko-po_cur_usd = wa_ekko-rlwrt.
ENDIF.
ENDIF.
‎2013 Jul 11 12:25 PM
Hi,
Thanks for quick reply.
But I want the date to be last approval date of PO.
‎2013 Jul 11 6:27 PM
Check "BAPI_PO_GETRELINFO" to get release related information of PO. You may find final approval date in its export parameters.
Regards
‎2013 Jul 12 7:32 AM
Hi Umesh,
Pass the PO number to this Table.
U will get release date and other release details also,Table : EREV and Field : FGDAT
‎2013 Jul 11 12:22 PM
Hi Umesh,
use below FM to covery to USD currency,I have used same in my program also.
pass sy-datum to date field.
DATA : LOCAL_AMOUNT TYPE KONV-KBETR.
IF KONV-WAERS <> 'USD'.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
DATE = G_GOHEAD-BUDAT
FOREIGN_AMOUNT = KONV-kbetr
FOREIGN_CURRENCY = KONV-WAERS
LOCAL_CURRENCY = 'USD'
* RATE = 0
TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
IMPORTING
* EXCHANGE_RATE =
* FOREIGN_FACTOR =
LOCAL_AMOUNT = LOCAL_AMOUNT
* LOCAL_FACTOR =
* EXCHANGE_RATEX =
* FIXED_RATE =
* DERIVED_RATE_TYPE =
* EXCEPTIONS
* NO_RATE_FOUND = 1
* OVERFLOW = 2
* NO_FACTORS_FOUND = 3
* NO_SPREAD_FOUND = 4
* DERIVED_2_TIMES = 5
* OTHERS = 6
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
‎2013 Jul 11 12:32 PM
Hi
One more thing,,,
type_of_rate = 'M'
M - Gives Average Rate
G - Gives Selling Rate
B - Gives buying rate
What is the value you are passing. If you Pass 'M' it will give you average rate.
‎2013 Jul 12 8:15 AM
Hi,
I am passing type_off_rate = M..
is that makes any difference to my USD value conversion.
Thanks in Advance.
‎2013 Jul 12 12:43 PM
‎2013 Jul 16 5:17 AM
Hi,
Is your question resolved ?
If not, I might be able to work with you to resolve this. Before that, from a functional point of view, here are my assumptions:
If all of the assumptions are correct, we can discuss this further
Thanks.
‎2013 Jul 16 7:50 AM
logic for calculating the exchange rate from PO currency to USD should be like this -
See below PO.
The PO 1st time got released on 12/19/2011 and Proc. State (PROCSTAT of EKKO) status changed from 03 to 05
Again the PO value has been changed and it got changed from 05 to 03 on 07/15/2013
Again the PO has been rejected and value changed from 03 to 08
And again the rejection has been cancelled and the value got changed to 3
So we have to put a logic that, we need to take the date of last 03 value and give the exchange rate of that day.
Please Help.
‎2013 Jul 16 10:10 PM
Hi,
So you are looking for the Purchase Order Scenarios and not Sales Order.
Your information should easily be accessed between these Tables :
EKKO - PO Header;
EKPO - PO Item
CDHDR - Change Document Header;
CDPOS - Change Document Item;
TCURR - Currency Table with Exchange Rate Type used by your company.
Thanks.
‎2013 Jul 17 8:27 AM
Hi,
My question is "How should i know/calculate the exchange rate for a specific date" i.e. in my case is last PO Updation date.
‎2013 Jul 17 4:48 PM
Hi,
I am not having the SAP System in front of me.
I will get back to you soon.
‎2013 Jul 18 5:19 AM
Hi,
One of the things I can think of is take the PO Change Date go to the Exchange Rate Table take the conversion factor, check the PO Rate and then do the math.
The Exchange Rate Type M would have it's period. It cannot be forever. Also you might check the table TCURF too for this.
Take the M Type Period and check the date on which you are running the report and use that rate which is relevant for the period.
Unfortunately, I do not have the SAP System in front of me so cannot give too many details, otherwise I would have given more details.
Hope this helps.
Thanks.
PS: One of the things I can say on this report is that it will not be accurate in comparison to the PO as the Exchange Rate Type is really the one which makes it how the rate fluctuations are captured in SAP. There is no way, that you can capture real time dynamic currency rates. This is a struggle in many projects/companies.
‎2013 Jul 18 7:51 AM
I am currently looking into TCURR table but not finding exact rate for specific date..
Please Help....