Skip to Content
0
Former Member
Aug 27, 2007 at 08:00 PM

Newbie Question: Validating Input on Class Attributes

44 Views

I created a Domain called "ZTRANSMISSION_LIST" that has two values "MAN" and "AUT". Next I created a Data Element called "ZTRANSMISSION_TYPE" of type "ZTRANSMISSION_LIST", my Domain.

So, I created a class called "ZVEHICLE" and create an attribute called "TRANSMISSION" of type "ZTRANSMISSION_TYPE" (my Data Element) thinking that if I did something like this in code:

DATA v TYPE REF TO zvehicle.

START-OF-SELECTION.

CREATE OBJECT v.

v->TRANSMISSION = 'XYZ'.

it would cause an exception because "XYZ" is not a valid entry in the ZTRANSMISSION_LIST domain but the program compiles fine and the code executes without a problem. What gives?

How should I implement this? I wanted to take advantage of the Domain but looks like I'm not going to be able to. Does this mean I'm going to have to hard-wire these codes into my program for validation?