ABAP Programs: Complex Non-Elementary Types and Data Objects
REPORT ZSOURCE0408.
* Nested records
TYPES: 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 = ‘Big City’.
RECEIVER-ADDRESS-STREET = ‘Main street’.
* Nested internal tables
TYPES: BEGIN OF PHONE_FAX_NUMBERS,
COUNTRY_CODE(3) TYPE N,
AREA_CODE(3) TYPE N,
NUMBER(10) TYPE N,
END OF PHONE_FAX_NUMBERS,
BEGIN OF EMPLOYEE,
NAME(25),
PHONE TYPE PHONE_FAX_NUMBERS OCCURS 10,
FAX TYPE PHONE_FAX_NUMBERS OCCURS 5,
END OF EMPLOYEE.
DATA EMPLOYEES TYPE EMPLOYEE OCCURS 100.
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info
If you like this post, you may as well like these too:
- How to define types and data objects REPORT CHAP0101. * Elementary type character, length 20DATA CUSTOMER_NAME(25) TYPE C. * Non-elementary typeTYPES T_NAME(25) TYPE C.DATA NEW_CUSTOMER_NAME TYPE T_NAME.* Reference to a data objectDATA VENDOR_NAME LIKE CUSTOMER_NAME. * RecordDATA:...
- Different types of ABAP Programs There are nine types of ABAP Programs in SAP: 1 Executable Programs (ABAP Reports) I INCLUDE Program M Module Pool/Dialogue programs S Sub-Routine Pool J Interface Pool K Class Pool...
- 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 defined...
- ABAP Programs: Form parameters with generic types REPORT ZSOURCE1009.* Variable for later useDATA: SHORT_STRING(3) VALUE ‘AB’, SHORT_NUMBER(3) TYPE N VALUE ’0′, ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100.* Calling forms with different actual parameters* Correct call (actual paramter is...
- ABAP Programs: Copying structured objects * Using move-corresponding to copy fields with the same nameDATA: BEGIN OF MY_CUSTOMER, ID(8) TYPE N, NAME(25), CITY(25), END OF MY_CUSTOMER, BEGIN OF CITY_OF_CUSTOMER, CITY LIKE MY_CUSTOMER-CITY, TEXT(30), ID LIKE...
- 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 non-elementary...
- ABAP Programs: Hexadecimal (or binary) data REPORT CHAP0406. * Hexadecimal (or binary) data is stored in fields of type x.* A type x field of length n contains 2n digits* and its output length is also...
- ABAP Programs: Transferring data to a file Here is a little program, which will teach you to transfer the data to a file. REPORT ZSOURCE2601. * Data declarations for later use PARAMETERS FILENAME(128) DEFAULT '/usr/tmp/testfile.dat' LOWER CASE....
- ABAP Programs: Local data in a form REPORT ZSOURCE1002. * Global field of the programDATA FLAG VALUE ‘G’.* Displaying the global fieldWRITE FLAG.* Calling a formPERFORM WRITE_FLAG.* Displaying the global field againWRITE FLAG.* Defining a form with...
- ABAP Programs: Obtaining data with nested select loops REPORT ZSOURCE1111.* Work areasTABLES: CUSTOMERS, BOOKINGS.* Reading entries from both database tableSELECT * FROM CUSTOMERS. SELECT * FROM BOOKINGS WHERE CUSTOMID = CUSTOMERS-ID AND ORDER_DATE = ’19990101′. WRITE: / CUSTOMERS-NAME,...
- ABAP Programs:Reading data from a file (presentation server) REPORT ZSOURCE2604. * Data declarations for later use PARAMETERS FILENAME(128) DEFAULT 'c:usersdefaulttestfile.dat' LOWER CASE. TABLES CUSTOMERS. DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE. CALL FUNCTION 'WS_UPLOAD' EXPORTING FILENAME...
- ABAP Objects: Components of Class in ABAP Objects Components of Class in ABAP Objects DATA – for instance attributes METHODS – for instance methods EVENTS – for instance events Static components: CLASS-DATA – for static attributes CLASS-METHODS –...
- ABAP Objects – Class and objects Why do you need ABAP Objects? ABAP Objects oriented programming lets you to be at par with the others as this is better methodology. To understand the recent concept of...
- Difference Between Elementary and Collective Search Help An Elementary Search help defines the flow of a standard input help. It is composed of a selection method that defines where to get the data that will make up...
- 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, SINGLE_CHARACTER...



















Leave a Reply