cancel
Showing results for 
Search instead for 
Did you mean: 

How to read row values in customer exit

Former Member
0 Kudos

Hi guys,

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:

Ex:

WHEN 'ZEXC_RATE'.

IF I_STEP = 2.

...

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = '0P_PER3'.

month = LOC_VAR_RANGE-LOW.

ENDLOOP.

...

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.

EXIT.

ENDIF.

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:

Month____LC________________Exc Rate__MXN

-


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.

Thanks,

David Guerra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It does not help but a variable customer exit will only influence other variables and not each row in the report.

You could change using an enhanced version of the table class to modify each row of a query as long as it is a WT 3.x (not 7.0).

Former Member
0 Kudos

Thank you, unfortunately we are using version 7.0.

Anyone else?

Former Member
0 Kudos

Have you considered using a Virtual Char/KF for this purpose...

Former Member
0 Kudos

Can you expand?

I know a virtual key figure is calculated at runtime via apap code, is it right? can you show a code where the key figure is calculated according to the Variables input and the characteristic row values (in this case currency type, which I still dont know how to obtain :S)

Former Member
0 Kudos

This is a very good example to begin with..

Please go through this and let me know if you need any help...

http://www.biportal.org/Default.aspx?pageId=90410&mode=PostView&bmi=32429

Ashish..

Former Member
0 Kudos

Thanks for all your help.

I solved it another way. I created another conversion type in RSCUR.

-> In time Ref: Fixed Time Reference

-> Time Reference from Variable: 0DAT Current Calendar Day (SAP Exit)

I used this conversion instead of the original and it uses the last conversion defined before todays date for all the posting periods.

Answers (0)