SAP Message 28040 - Language element &1 only allowed in procedures

Diagnosis
The syntax check found that you have probably entered an expressionthat is only used in procedures.
For example, the expressions $SUM_PARTS and $COUNT_PARTS are used inprocedures only.

System Response
The cursor shows where the error occurs. If this is not the cause ofthe error, display the other possible causes of error.

Procedure
Check your entries and make the relevant correction. Please note alsoany other possible causes of error (messages).