10-24-2011 3:15 PM
Hello,
Could you please help me to understand how calculate correctly, in a query, the net value of billing in the system currency?
I've created the custom field Local-Net Value = VBRP-NETWR * VBRK-KURRF.
But, when i executed the query i had the following situations:
- The correct value when the exchange rate is from EUR to another currency.
- The value incorrectly when the exchange rate is from another currency to EUR, (the exchange rate, VBRK-KURRF, is expressed as a dividend).
Thank you in advance.
Best regards.
Antonio
10-25-2011 9:53 AM
10-25-2011 12:44 PM
Hi Pranav,
thanks for your help.
I'm not an expert of ABAP. What's the code that can i use to convert the values from other currency to EUR? Where i can insert this code in the infoset (SQ02)?
Thanks.
Best regards.
Antonio
10-25-2011 5:57 PM
Hi Antonio ,
DATA: V_LA type vbrk-netwr,
V_FA type vbrk-netwr,
rate type vbrk-kurrf.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = SY-DATUM
foreign_amount = V_FA " Foreign Amount
foreign_currency = 'USD' " Foreign Currency Key
local_currency = 'EUR' " Local Currency Key
RATE = Rate " Exchange Rate
IMPORTING
LOCAL_AMOUNT = V_LA " Local Amount
IF sy-subrc = 0.
*Map this V_LA value to your final field .
ENDIF.
Regards,
Maruthi
Edited by: maruthi kona on Oct 25, 2011 10:27 PM
Edited by: maruthi kona on Oct 25, 2011 10:28 PM
10-26-2011 10:01 AM
Hi Maruthi,
i've added the code in the infoset (SQ02), but i can't generate the infoset because there's the error "SY-SUBRC" is not expected.
Thanks.
Antonio
10-26-2011 5:54 PM
HI ,
Remove the below Lines and check .
IF SY-SUBRC = 0.
ENDIF.
Regards ,
Maruthi
10-27-2011 1:32 PM
Hi,
i've removed the two lines in the infoset (SQ02) and all is ok.
But when i tried to add the additional field V_LA (SQ02), SAP shown me "The DATA coding already contains a field with that name".
So, i've:
- modified the code:
DATA: V_FA type vbrk-netwr,
rate type vbrk-kurrf.
- add the field V_LA (Extras) and assigned it to a group, so the log advised me that "No code exists for additional field V_LA".
Now how can i add the LOCAL AMOUNT to my query?
Thanks.
Antonio
Edited by: Antonio Bruno on Oct 27, 2011 2:41 PM
10-28-2011 10:42 AM
Hi Antonio,
Please go through the below link you will get some idea about query writing .
http://jelajahsap.files.wordpress.com/2008/01/abap-query.pdf
Regards,
Maruthi
10-28-2011 1:10 PM
Hi,
now the infoset has no inconsitencies. I've add the code directly in "CodingForAddition" (Extras) in relation to the new field V_LA.
But when i executed the query, the local amounts (V_LA) are always equal to 0?
Thanks.
Antonio
11-02-2011 9:58 AM
I've tried another solution, i've used the billing date as data. Now with thw following code:
DATA: V_DA type vbrk-fkdat,
V_FA type vbrk-netwr,
V_FC type vbrk-waerk,
rate type vbrk-kurrf.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = V_DA
foreign_amount = V_FA
foreign_currency = 'USD'
local_currency = 'EUR'
RATE = rate
IMPORTING
local_amount = V_LA.
When i executed the query, SAP shown me Message no. SG105 - the Enter rate USD / EUR rate type M for 00.00.0000 in the system settings.
The currency in the billing came from the table TCURR:
KURST - FCURR - TCURR - GDATU - UKURS - FFACT - TFACT
EURX - USD - EUR - 07.06.2010 - /1,15000 - 0 - 0
How can i fix the code?
Thank you.
Antonio
10-26-2011 1:01 PM
Hi Antonio,
I suggest to see these notes:
SAP Note 155012 - Further subtotal fields in pricing
SAP Note 1022966 - FAQ for the 'Subto' column (KZWIW) in the pricing procedure
I think that perhaps they could suggest other way to solve it.
I hope this helps you
Regards
Eduardo
PD: Sorry, I understood it wrongly. Write
IF sy-subrc = 0.
ENDIF. "you don't have this line
Edited by: E_Hinojosa on Oct 26, 2011 3:07 PM
12-07-2011 8:08 AM
Hi,
i've solved with the following code (options of field V_LA):
DATA: v_da TYPE vbrk-fkdat,
v_fa TYPE vbrk-netwr,
v_fc TYPE vbrk-waerk,
rate TYPE vbrk-kurrf.
CLEAR: v_fa, v_fc, v_la.
v_da = vbrk-fkdat.
v_fa = vbrp-netwr.
v_fc = vbrk-waerk.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = v_da
foreign_amount = v_fa
foreign_currency = v_fc
local_currency = v_lc
RATE = rate
TYPE_OF_RATE = 'EURX'
IMPORTING
local_amount = v_la.
and the following delimitation of the field V_LC (obligatory parameter) = VBRK-WAERK.
Best regards.
Antonio