*WHEN / *ENDWHEN 
See also *REC.
A WHEN / ENDWHEN structure works in the same way as the SELECTCASE / ENDSELECT structure, with *REC( ) statements that generate new records. The syntax is:
*WHEN {criteria}
*IS [=]{value1}[,{value2},…] | <>{value}
*REC(FACTOR={Real number}|EXPRESSION={Expression}[,{dim1}={member},{dim2}=…])
[ *REC(FACTOR={Real number}|EXPRESSION={Expression}[,{dim1}={member},{dim2}=…])]
[*ELSE]
*ENDWHEN
where
{criteria} is what to test. Typically, this is a property of the current member of a dimension. The syntax is DimensionName.Property | DimensionName, such as *WHEN ACCOUNT.RATETYPE.
If Property is not specified, the ID property is assumed. For example, *WHEN ACCOUNT equals to *WHEN ACCOUNT.ID.
{ValidCondition} is one or more values that meet the criteria. You can enclose them in double quotes to treat them as strings. Omit the quotes if they represent numeric values. For example:
*IS "AVG","END"
*IS 10,20,30
If no operator is specified, the *IS clause assumes the presence of an equal sign (*IS = "AVG", "END").
The {value} must be literals only, not variables. Therefore, the following sample is not supported:
*IS dimension.property
Note
There should be no space between the two characters of the unequal sign operator (<>). You can insert one or more blanks between the operators and the value.
If an unequal sign (<>) is used, you can pass only one value. Therefore, the syntax *IS <> 2,3,4 is invalid.
Other relational operators like AND, OR and NOT are not currently supported.
Nesting of WHEN / ENDWHEN
WHEN / ENDWHEN structures can be nested by as many levels as desired and in any sequence, as shown in the following sample:
*WHEN xxx
*IS "A"
*REC(…)
*REC(…)
*IS "B"
*REC(…)
*WHEN yyy
*IS "C","D","E"
*REC(…)
*ELSE
*REC(…)
*ENDWHEN
*ENDWHEN
Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or by its gross negligence.