Skip to Content
avatar image
Former Member

Function OBJV( ) error

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 02, 2008 at 04:34 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 01, 2008 at 10:05 AM

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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.