on 10-10-2007 2:04 AM
Hi,
I'm using ATRV function for getting functional area from cost center. Cost Center has a compounded with controlling area. I'm not able to derive the functional area based on the ATRV function. This is in Integrated Planning. Pls let me know your suggestions. This is the code below.
irrespective of the functional area, I'm getting L_FLAG = y from the code below. If i go to debug, its is not passing any value to the L_FUNCAREA...
FOREACH L_COSTELEMENT.
IF L_COSTELEMENT <> '#'.
L_ACCOUNT = L_COSTELEMENT.
FOREACH L_COSTCENTER,L_CONAREA.
IF L_COSTCENTER <> '#'.
L_FUNCAREA = ATRV ( 0FUNC_AREA , L_COSTCENTER,L_CONAREA ).
IF L_FUNCAREA <> 1000 .
L_FLAG = 'Y'.
ELSEIF L_FUNCAREA = '1000'.
L_FLAG = 'N'.
ENDIF.
BREAK-POINT.
TEMP = TEMP + { 0AMOUNT, L_COSTCENTER,L_COSTELEMENT,1000,#,#, ZCO_T01,#} .
ENDIF.
ENDFOR.
GET THE TOTALS.
{ 0AMOUNT,#,#,1000,#,L_ACCOUNT, ZPCA_T01,L_FLAG} = TEMP.
TEMP =0.
ENDIF.
ENDFOR.
full code..
DATA L_COSTCENTER TYPE 0COSTCENTER.
DATA L_ACCOUNT TYPE 0GL_ACCOUNT.
DATA L_COSTELEMENT TYPE 0COSTELMNT.
DATA L_INFOPROVIDER TYPE 0INFOPROV.
DATA L_CONAREA TYPE 0CO_AREA.
DATA L_FUNCAREA TYPE 0FUNC_AREA.
DATA L_FLAG TYPE ZCH_REVF.
DATA L_FYP TYPE 0FISCPER3.
DATA L_FACTOR TYPE F.
DATA TEMP TYPE I.
DATA TEMP1 TYPE I.
TEMP = 0.
FOREACH L_COSTELEMENT.
IF L_COSTELEMENT <> '#'.
L_ACCOUNT = L_COSTELEMENT.
FOREACH L_COSTCENTER,L_CONAREA.
IF L_COSTCENTER <> '#'.
L_FUNCAREA = ATRV ( 0FUNC_AREA , L_COSTCENTER,L_CONAREA ).
IF L_FUNCAREA <> 1000 .
L_FLAG = 'Y'.
ELSEIF L_FUNCAREA = '1000'.
L_FLAG = 'N'.
ENDIF.
BREAK-POINT.
TEMP = TEMP + { 0AMOUNT, L_COSTCENTER,L_COSTELEMENT,1000,#,#, ZCO_T01,#} .
ENDIF.
ENDFOR.
GET THE TOTALS.
{ 0AMOUNT,#,#,1000,#,L_ACCOUNT, ZPCA_T01,L_FLAG} = TEMP.
TEMP =0.
ENDIF.
ENDFOR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I noticed for example for one particular cost center and Con Area 1000,
if i go and look at the master data, I'm getting two records with two different validity dates. Will this cause the problem in reading the master data..? Validity From is not a compounded object, however i see some thing like this..
For Example
Cost Center CoAr Validity From Validity To Fun Area
D70001 1000 01/01/1000 1000
D70001 1000 12/31/2007 1000
Hi regarding the validity dates. A cost center in R/3 has a valid from and to date. when the master data is being changed, one can create a new time interval in order to be able to see the situation before and after. One just has to make sure the cost center is always valid (so in case of multiple time intervals together it should cover all periods ...) also the valid to date best should be set to indefinite. From your example I don't see any valid to dates ...
Could you test with a cost center which has proper master data (so a non-interupting time interval which is valid till 31.12.9999
D
Hi Sriram,
Yes, Cost center is time dependent here. How do i pass Date to the ATRVT argument. I do not have any cal month or cal day or fiscal year month in the feilds to be changed. If i look at the master data value for the cost center, I see VALIDFROM ,VALIDTO fields. I'm not sure the syntax for defining & passing the date and if so how and what date I need to pass. I appreciate any inputs.
Regards,
Veeru
Hi Veeru,
try this:
DATA L_DATE TYPE D.
L_DATE = '99991231'.
L_FUNCAREA = ATRVT ( 0FUNC_AREA , L_COSTCENTER,L_DATE ).
But the problem is the Controlling area. Is not possible to set using ATRVT function.
You can also create a exit function to call inside the FOX. The purpose of this new function is to read the attributes of Cost Center.
I have already developed a function like that for my projects.
If you need it contact me.
Jorge
Hi Jorge,
I tried the following ways. It gives syntax errors in both the ways.
1) L_FUNCAREA = ATRVT(0FUNC_AREA, L_COSTCENTER,L_DATE).
A comma and other arguments were expected instead of )
This message occured reason being that we have controlling area as a
compounded object with cost center .
2) L_FUNCAREA =
ATRVT('0FUNC_AREA',L_COSTCENTER,L_CONAREA,L_DATE).
Formula error: Variable must be type D
Jorge,
I would like to try the exit function in fox that you mentioned above as this seems to be an issue.. Please let me know how i can get a sample code.. appreciate your inputs.
thanks & regards
veeru
Hi Veeru,
I'm sending you a simple solution for you to solve your case.
Create the following function in SE37:
FUNCTION Z_FOX_GET_DM_ATTRIB.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(I_ATTRIB) TYPE C DEFAULT 'COMP_CODE'
*" REFERENCE(I_COAREA) TYPE /BI0/OICO_AREA
*" REFERENCE(I_COSTC) TYPE /BI0/OICOSTCENTER
*" REFERENCE(I_DATE) TYPE D
*" EXPORTING
*" VALUE(E_VALUE) TYPE C
*" EXCEPTIONS
*" NOTTING_FOUND
*"----
*
select single (I_ATTRIB) into e_value
from /BI0/MCOSTCENTER
where CO_AREA = i_coarea
and COSTCENTER = i_costc
and OBJVERS = 'A'
and DATETO = i_date. "'99991231'.
if sy-subrc ne 0.
raise notting_found.
endif.
ENDFUNCTION.
Go to SM30, enter RSPLF_FDIR table and insert the function there.
Go to BPS0 in your FOX formula:
(My example is for resp_pers, adapt to yours)
DATA L_RESP TYPE 0RESP_PERS.
DATA L_VALUE TYPE STRING.
CALL FUNCTION Z_FOX_GET_DM_ATTRIB
EXPORTING
I_ATTRIB = 'RESP_PERS'
I_COAREA = '1000'
I_COSTC = 'ANGOLA'
I_DATE = L_DATE
IMPORTING
E_VALUE = L_VALUE.
L_RESP = L_VALUE.
MESSAGE I000(ZACPLAN) WITH 'RESP:' L_RESP.
*************
the i_attrib parameter can be any attribute of Costcenter Object.
I hope this can help you.
Jorge
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.