Skip to Content
0
Former Member
Jul 01, 2011 at 10:29 AM

Is an assigned value to an variable in the domain of the data element

110 Views

Hi

how can I check if the value, which I want to assign to an variable is in the domain of the data element of that variable.

Example:

I defined a data element myDataElement. The Elementary Type of myDataElement is the Domain myDomain.

myDomain has the Format: Char with Length 1 and the fixed values 'A' and 'B'.

The following code works, but IMHO should not:

DATA testVar TYPE myDomain.
testVar = 'Foo'.

The value of testVar is now: 'F' .

As 'F' is not in the fixed values, this is a behaviour which I don't want. How can I prevent this from not happening (without using a bunch of IFs)?

In such a case, it were nice if an exception were raised.

Regards

Gilles