cancel
Showing results for 
Search instead for 
Did you mean: 

DATA TYPES

While declaring a variable( suppose that it is CHARACTER datatype) in the database level, we use 'CHAR', but, in the programming level,we use 'C'.May I know the reason?

michael_piesche
Active Contributor
0 Kudos

swissfizz, please follow up on your open question.

  • comment answers or your question if there are still open issues.
  • otherwise mark an answer as accepted if it helped you solve your problem
  • or post an answer of yourself and accept it if you found another useful solution yourself
  • or redirect your question to another question that is related and was useful to solve your problem
  • in the end, close your question

Accepted Solutions (1)

Accepted Solutions (1)

michael_piesche
Active Contributor

For a common understanding:

For database field definitions in ABAP DDIC as well as for variables in ABAP coding, there are data elements that have an assigned domain which have an assigned data type that has an underlying ABAP type. Custom Data elements and domains can be created, whereas data types and ABAP types are predefined. Data elements, domains and data types are part of the DDIC whereas ABAP types are used by the runtime environment.

Your question:

Why is it, that for database fields one either chooses a data element, or a data type, whereas in ABAP coding, one either choses the data element or the internal ABAP type. And more specific: Why can one not choose the internal ABAP type for database fields or why can one not choose the data type in ABAP coding? You could even go further and ask, why can one not choose the domain in either?

For database field definitions, I would assume, that since the available data types in the DB system are different to those in ABAP, there needs to be a mapping anyway, and it made more sense, especially with regards to initial values, to have this mapping based on the data types instead of the ABAP types.

For ABAP programs, the 'help' just states the following:

  • "ABAP Dictionary has its own set of predefined (data) types, which are used to define global data types but which cannot be addressed directly in ABAP programs."

Here I would assume, that for simplicity reasons, you can either choose a ABAP type, or, if you want to have the 'full power' of the DDIC capabilities, you should go directly to the data element and not have anything in between and not know what capabilities will be available or not, since they come from the combination of all three: data element (e.g. descriptions), domain (e.g. value help), data type (e.g. initial value).

BiberM
Active Participant
0 Kudos

I fully agree. And I want to add another point: ABAP was designed to be a DB agnostic layer above any DB. So an own set of types was neeeded which could be translated into the DB specifiy data type during runtime.

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor

DDIC (ABAP Dictionary) types are richer than ABAP. In DDIC, you may have types "CHAR", "CLNT", "CUKY", "UNIT" (etc.) which are all characters from ABAP point of view but have special meanings in DDIC.