How to read row values in customer exit
I need a report with the Exch Rate to MXN for a specific month (0P_PER3). This is one of the variables where I will filter the report (including year, version, etc).
I can obtain the value of the month and the other required variables with the following code:
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = '0P_PER3'.
month = LOC_VAR_RANGE-LOW.
SELECT SINGLE * FROM TCURR
WHERE KURST = RATE_TYPE
AND FCURR = ????
AND TCURR = 'MXN'
AND GDATU = l_date.
IF SY-SUBRC eq 0.
ZTC_1001 = TCURR-UKURS.
L_S_RANGE-LOW = TCURR-UKURS.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
However I dont know how to specify the FCURR (This currency may be different for each row).
Is there a way to read the current value of the current row, or is it limited to variables?
Just in case you were wondering why I dont use the class conversion, the reason is the following:
I need the cummulated value (balance) to a specific month in local currency and in MXN (Mexican pesos).
If I use the class conversion it applies a different exch rate for each month, wether I just want to apply the total to the actual exch rate. Even if the posting period is not included (internally it does the the following calculus)
let me clarify:
Jun______ 518,184.24 BRL_____6.407_____3,319,902.79 MXN
Jul_______-8,235.48 BRL______6.442_____-53,049.67 MXN
Ago______-509,948.76 BRL____6.254_____-3,189,066.56 MXN
Balance AGO___0.00 BRL______________77,786.56 MXN (nonsense!)
Expected 0.00 BRL = 0.00 MXN
I tried using another column with constant selection for the current month and dividing MXN by LC to obtain the same exc rate for all the months and then use a formula to multiply. IT worked, however if the last month had value 0, then the exc. rate would not be obtained, thus not for the cummulated.
Any ideas, help or creative work around to solve this issue will be rewarded.