cancel
Showing results for 
Search instead for 
Did you mean: 

Function OBJV( ) error

Former Member
0 Kudos

Hi,

I try to call a FM from integrated planning. I get the following error message:

Formula error: Type 0COSTELMNT is not allowed for the function

Syntax error in row 7, column 13


DATA COSTELMNT TYPE 0COSTELMNT.
DATA RATE TYPE F.
DATA AMOUNT TYPE KEYFIGURE_NAME.

FOREACH COSTELMNT, AMOUNT .

COSTELMNT = OBJV( ).

CALL FUNCTION Z_PLANNING_CALC_VALUES
          EXPORTING 
                CALYEAR
                AMOUNT
          IMPORTING
                E_RATE = RATE.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Objv() function is used for the characteristic that is not selected as fields to be changed. Your code reads the value of the costelement from variable COSTELMNT in the foreach statement and also from objv() . I think you should remove the line COSTELMNT = OBJV( ) in order to run the code with no syntax errors.

Answers (1)

Answers (1)

Former Member
0 Kudos

Check if costelement is in fields to be changed.. If not, keep it in that.

Former Member
0 Kudos

Thanks for your answer. The costelement is even defined as field to be changed.

Former Member
0 Kudos

If only one cost element is coming into fox code, use the OBJV statement before foreach and remove costelement from foreach.

Else

If multiple costelements are there, when you give costelement in foreach, no need to use objv() again. The value of costelement comes in the variable used in foreach automatically.