‎2006 Nov 21 1:22 PM
Hi Frnzs,
Here is my issue..Plz go thru it..
I have a function module (YFSF_ICR_GET_EXCHG_RATE_ODS).
the function performs the current logic without any changes,
that is reading SPOT rates for actuals (the planning cycle is empty) or S rates
for forecasts based on the planning cycle. Nothing needs to be changed here
concultion : Based on flag I_ICR ni , we have to read new exchange rates ( From ODS)
the fucntion module code is here
FUNCTION yfsf_icr_get_exchg_rate_ods.
*"----
""Local interface:
*" IMPORTING
*" REFERENCE(I_PLANCYC) TYPE /BIC/OIYPLANCYC OPTIONAL
*" REFERENCE(I_SALESORG) TYPE /BI0/OISALESORG OPTIONAL
*" REFERENCE(I_IC) TYPE /BIC/OIYINVCURR
*" REFERENCE(I_RC) TYPE /BIC/OIYREPCURR
*" REFERENCE(I_FISCPER) TYPE /BI0/OIFISCPER
*" EXPORTING
*" REFERENCE(E_EXG) TYPE /BI0/OIEXCHG_RATE
*" EXCEPTIONS
*" NO_RATE_FOUND
*"----
DATA: l_s_exg TYPE /bic/ayfsfexg00,
l_t_exg TYPE /bic/ayfsfexg00 OCCURS 0,
l_year TYPE /bi0/oifiscyear.
IF i_plancyc IS INITIAL.
Actuals
FREE l_t_exg.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE l_t_exg
FROM /bic/ayfsfexg00
WHERE fiscper <= i_fiscper
AND fiscvarnt = 'JJ'
AND /bic/yrepcurr = i_rc
AND /bic/yinvcurr = i_ic
AND /bic/yplancyc = ''
AND /bic/yexchtype = 'SPOT'
ORDER BY fiscper DESCENDING.
IF sy-subrc <> 0.
RAISE no_rate_found.
ELSE.
READ TABLE l_t_exg INTO l_s_exg INDEX 1.
e_exg = l_s_exg-exchg_rate.
ENDIF.
ELSE.
Forecasts
l_year = i_fiscper+0(4).
SELECT SINGLE *
INTO l_s_exg
FROM /bic/ayfsfexg00
WHERE fiscvarnt = 'JJ'
AND fiscyear = l_year
AND salesorg = i_salesorg
AND /bic/yrepcurr = i_rc
AND /bic/yinvcurr = i_ic
AND /bic/yplancyc = i_plancyc
AND /bic/yplancyc = ''
AND /bic/yexchtype = 'S'
AND exchg_rate GE '0.0000001'.
IF sy-subrc <> 0.
RAISE no_rate_found.
ELSE.
e_exg = l_s_exg-exchg_rate.
ENDIF.
ENDIF.
ENDFUNCTION.
ok
now my requirement is that I need to enhance the Function module for reading exchange rates.
for this i got the following information:
- It requires an additional flag I_ICR for instance that can be empty or 'X'
for instance
- If the flag is empty, the function performs the current logic without any changes,
that is reading SPOT rates for actuals (the planning cycle is empty) or S rates
for forecasts based on the planning cycle. Nothing needs to be changed here
- If the flag is 'X', the function reads a new exchange rate type, let's call
it "ICR". As stated in the requirements and functional specs, these exchange rates
are the Reuter rates valid for a complete year. These are fixed rates so no planning
cycle. The users will enter records in the format (year, reporting currency, invoicing
currency, exchange rate). If the input flag I_ICR is X, the function determines
the year based on the input period, then, based on the year it selects on the same
table as for the other exchange rates with a restriction on exchange rate type "ICR",
year, from and to currency and return the exchange rate
Update rules. There are two:
- To the consolidation ODS. No changes are required there; the function has to
read either S or SPOT rates (I_ICR flag is empty)
- From the consolidation ODS to the cube. As stated in my previous email, the
from currency is the one available in the data package. The to currency is determined by reading the sales organization master data (reporting currency attribute) based on the inter-company sales organization (also available in the incoming record). It then calls the function module above with the parameter I_ICR set to 'X' so it reads the Reuter rates.
I guess i need to create another function module and can be used.
Observation
ODS table fields.
-
- FISCPER
- FISCVARNT JJ
- FISCYEAR 2006
- /BIC/YREPCURR EUR
- /BIC/YINVCURR JPY
- SALESORG 0010
- /BIC/YMRC 3090
- /BIC/YPLANCYC
- /BIC/YEXCHTYPE S
- - RECORDMODE
Thanx in advance..
‎2006 Nov 21 1:33 PM
Hi Badrinath,
Welcome to SDN,
If i guess right then you are asking the question that whether to include the new functionality in existing function module or not.
You can edit the same function module.
but prefrably u can create a new function module.
you have all the details with you u need to check the condition of I_ICR in calling program and then call the new FM or the old one.
creating new function module will also keep the modularisation and clean code.
Hope this helps
‎2006 Nov 21 1:33 PM
Hi Badrinath,
Welcome to SDN,
If i guess right then you are asking the question that whether to include the new functionality in existing function module or not.
You can edit the same function module.
but prefrably u can create a new function module.
you have all the details with you u need to check the condition of I_ICR in calling program and then call the new FM or the old one.
creating new function module will also keep the modularisation and clean code.
Hope this helps
‎2006 Nov 21 1:44 PM
instead of new FM...create a import parameter as flag. pass value to this flag.
when space...leave it and it executes...when 'X' copy the same code and also add ur code according to the requirement and use it.