How to define types and data objects
REPORT CHAP0101.
* Elementary type character, length 20
DATA CUSTOMER_NAME(25) TYPE C.
* Non-elementary type
TYPES T_NAME(25) TYPE C.
DATA NEW_CUSTOMER_NAME TYPE T_NAME.
* Reference to a data object
DATA VENDOR_NAME LIKE CUSTOMER_NAME.
* Record
DATA: BEGIN OF BOOKING,
ID(4) TYPE C,
FLIGHT_DATE TYPE D,
NAME LIKE CUSTOMER_NAME,
END OF BOOKING.
* Internal table
DATA BOOKING_TABLE LIKE BOOKING OCCURS 100.
———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com
If you like this post, you may as well like these too:
- ABAP Source Code: Three approaches to define data objects REPORT ZSOURCE0401.* 1. Elementary typesDATA: CUSTOMER_NAME_1(25) TYPE C, VENDOR_NAME_1(25) TYPE C. * 2. Reference to an existing fieldDATA: CUSTOMER_NAME_2(25) TYPE C, VENDOR_NAME_2 LIKE CUSTOMER_NAME_2. * 3. Reference to a...
- ABAP Programs: Complex Non-Elementary Types and Data Objects REPORT ZSOURCE0408. * Nested recordsTYPES: BEGIN OF ADDRESS, CITY(25), STREET(30), END OF ADDRESS, BEGIN OF PERSON, NAME(25), ADDRESS TYPE ADDRESS, END OF PERSON.DATA RECEIVER TYPE PERSON.RECEIVER-NAME = ‘Smith’.RECEIVER-ADDRESS-CITY =...
- ABAP Source Code: Types, data, constants REPORT ZSOURCE0402.* Type flag defines an abstract typeTYPES FLAG TYPE C. * Field address_flag will allocate space in main memory at runtimeDATA ADDRESS_FLAG TYPE FLAG VALUE ‘X’.* Constants are...
- DEFINE : ABAP Keyword a day DEFINE Basic formDEFINE macro.EffectDefines a program component (macro) under the name macro . It must consist only of ABAP/4 statements and is expanded at compilation time.A macro should always...
- ABAP Source Code: Character types REPORT ZSOURCE0403. * Type c is the default type when no type is specified.* Initial value is space, if it is not specified explicitly.DATA: NAME(25) TYPE C, CITY(25), FLAG,...

















Leave a Reply