Hello guys,
( I am new to the forums. If i posted my concerns on the wrong section, kindly move it to the correct one)
I would like to ask assistance on calculation of the average exchange rate on a tcurr table per month on below keys:
KURST,FCURR,TCURR and TCURR
Normally, tcurr table only contains monthend data but there are some scenarios that there are entries on the middle of the month.
The main requirement was to store the tcur data on a DSO and add a key fig for the average data. We create a datasource using table view.
Also, the GDATU is on number format so i need to convert it first to calday format ( i did not use the FM)
So first, i determined the available months on the start routine:
N= 1.
LOOP AT SOURCE_PACKAGE
ASSIGNING <SOURCE_FIELDS>.
W_DIFF = '99999999' - <SOURCE_FIELDS>-GDATU.
TRANSLATE W_DIFF(5) USING ' 0'.
CONDENSE W_DIFF NO-GAPS. "YYYYMMDD
W_OUT = W_DIFF.
W_MONTH = W_OUT(6).
READ TABLE T_MONTH
INTO E_MONTH
INDEX N.
MOVE W_MONTH TO E_MONTH-CALMONTH.
APPEND E_MONTH TO T_MONTH.
N = N + 1.
ENDLOOP.
i now have the list of available months on table t_month
the next thing i can think of is to get all of the entries on the source package per month, setup a counter, add all of the exchange rate then divide by the counter. But i am having a hard time coding this.
Also, i think i should put some codes on the end routine to populate the average key fig on the dso.
Any help would be appreciated.
Thanks!
Gervy