cancel
Showing results for 
Search instead for 
Did you mean: 

Formula error: Variable name was expected

Former Member
0 Kudos

Hi All,

After SP Upgrade the following section of code is throwing the error "Formula error: Variable name was expected" which code is checked for sysntax errors.

Fox code sections throwing error is:

FOREACH REFDATA AC, SPU.

ATR = ATRV ('GBRIDTYPE', AC , CHA).

IF ATR = 'NOISE'.

SUM1= SUM1 +

{QUC,YEC,BPGR,VS,VTC,AC,#,#,SPU,SUBC,#}.

SUM2= SUM2 +

{QUP,YEP,BPGR,VSP,VTP,AC,#,#,SPU,SUBP,#}.

ELSEIF ATR = 'URCOP'.

SUM3= SUM3 +

{QUC,YEC,BPGR,VS,VTC,AC,#,#,SPU,SUBC,#}.

SUM4= SUM4 +

{QUP,YEP,BPGR,VSP,VTP,AC,#,#,SPU,SUBP,#}.

ENDIF.

ENDFOR.

When we comment out 'FOREACH REFDATA AC, SPU.' and 'ENDFOR.', code is showing no errors. This indicates that there is no syntax error in the parts of code below FOREACH...

Can anyone throw some light on it?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

The correct syntex for Foreach is :

FOREACH <variable1>,<variable2> IN REFDATA.

ENDFOR.

Regards,

Vishal.

Former Member
0 Kudos

Hi.


FOREACH AC, SPU IN REFDATA .

Regards.

former_member5472
Active Contributor
0 Kudos

Hi,

I think you are missing IN keyword in foreach loop ..


FOREACH REFDATA IN AC, SPU.

Check the syntax for foreach refdata..

thanks

Pratyush