Create RANGEs in DDIC without getting all wound up
I am using RANGEs more and more. I use them at breakfast, lunch, and dinner and outside meal times. It’s like soy sauce. A few spoonfuls and everything is instantly tastier.
But their declaration has always given me some work. For example, I need a ZS_RANGE_ABC structure (with the OPTION, SIGN, LOW, HIGH fields) if I want to use a range of a ZABC field, and then I need an ZT_RANGE_ABC table type that has ZS_ABC as its “row type”. Doing all this manually is quite annoying.
I recently found out that DDIC has a feature that simplifies this process. This simplification consists of automatically maintaining the “row type”. It works like this:
-
Let’s take it for granted that you have the ZABC data element;
-
In SE11, insert the name of the RANGE data type at “Data type”: ZT_RANGE_ABC;
-
Press F5 to create it and select the “table type” option;
-
Give it a description or else you cannot advance;
-
(now here comes the trick!!)
-
In the “Process” menu select the “Define as range table type” option;
-
(Kaboom! The screen has changed!)
-
Add ZABC as the “data element”;
-
Add ZS_RANGE_ABC as the “structured row type” (don’t press “create” yet);
-
Save;
-
Have you saved it? Now press “create”;
-
(the DDIC automatically creates a structure that already has SIGN, OPTION, LOW and HIGH!)
-
Save and activate the structure as you would with any other structure and go back;
-
Activate the table type and voilà: you now have a ZT_RANGE_ABC table type that is a RANGE of type ZABC.
Very interesting, wouldn’t you say?
Thank you José Faria for showing me this very handy feature.
Greetings from Abapinho.