Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Definition of constant structures with TYPE

Former Member

On help.sap.com, there is an example for defining a complex constant:

CONSTANTS: BEGIN OF myaddress,
           name(20)    TYPE c  VALUE 'Fred Flintstone',
           street(20)  TYPE c  VALUE 'Cave Avenue',
           number      TYPE p  VALUE  11,
           postcode(5) TYPE n  VALUE  98765,
           city(20)    TYPE c  VALUE  'Bedrock',
           END OF myaddress.

In this statement, the structure itself (which fields exist, what is their type) is defined in the CONSTANTS statement. I would like to use a structured defined in the data dictionary (LVC_S_COLO in my case) and simply define the values of each field in the CONSTANTS statement.

Is it possible to define a constant based on a dictionary structure type and just define the values of the fields in the CONSTANTS statement, or do you always have to define the structure type manually when you create a constant structure?

1 REPLY 1

JozsefSzikszai
Active Contributor
0 Kudos

The problem is here that structures don't hold any data. This simply means, that you always have to fill up your structure with data in the program. An other option would be to create a DB table and store the required data there, but in this case you'll still need a select in each program.