cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading the attribute value for compounder object ATRV

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi,

Do you get any error when you do check formula? Can you try the below statement and see if it works?

L_FUNCAREA = ATRV ( 0FUNC_AREA, L_CONAREA, L_COSTCENTER ).

Former Member
0 Kudos

Hi Mayank

My Code is error free though.. if i try the way you mentioned, I'm getting the error message. formula expected..

Any Suggestions..

Veeru

Former Member
0 Kudos

Hi,

check in your plancube how the data looks like. Sometimes one has to add leading zero's. For example an account number with 10 digits should have format 0620200000 instead of 620200000.

D

Former Member
0 Kudos

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

Former Member
0 Kudos

What should I look for in the cube for Plan data..

Former Member
0 Kudos

Hi,

What I meant was your statement

IF L_FUNCAREA <> 1000

Perhaps it should be L_FUNCAREA <>'001000'.

To check this display your data in the actuals (or plan) via RSA1 -> display data

D

Former Member
0 Kudos

Hi,

I Looked at the data.. The Functional Area is of the same lengh as 1000.

Former Member
0 Kudos

Hi,

then I would suggest to debug your FOX. Add "break-point" in your FOX formula, create a plannng sequence and create a selection variant. Then run SE38 and program RSPLS_PLSEQ_EXECUTE. By doing so you can debug and find out what goes wrong.

D

Former Member
0 Kudos

Hi Dries..

I did the same way and went into debug mode.. its passing the values.. for cost center, cost element and at the ATRV statement, it is not passing any value for functional area..

Former Member
0 Kudos

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

Former Member
0 Kudos

I changed the master data for a specific cost center, activated it and ran the function.. no change..

Former Member
0 Kudos

I developed the same code in BPS. ATRV is passing the values for functional area in BPS . The same code is not working in IP.. Can anybody suggest what to do..?

Former Member
0 Kudos

Veeru - You know that if there is time-dependency attached to the attribute, the ATRVT function needs to be used instead.

Cheers!

Former Member
0 Kudos

For characteristics that are time dependent, use the function ATRVT and not ATRV

Regards

Sriram

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

syntax must be like that;

L_FUNCAREA = ATRVT('0FUNC_AREA',L_COSTCENTER,L_DATE,L_CONAREA).