SAP Database - The Unofficial SAP Knowledge Base

Free Business and Tech Magazines and eBooks

ABAP Programs: Records and internal tables

Print This Post Email This Post Written by admin on Nov 5th, 2007 | Filed under: ABAP Programs

REPORT ZSOURCE0407.

* Records (or structures) consist of a fixed number of components
DATA: BEGIN OF CUSTOMER,
ID(8) TYPE N,
NAME(25),
TELEPHONE(12),
END OF CUSTOMER.

* Working with the different components and the structure itself
DATA VENDOR LIKE CUSTOMER.
CUSTOMER-ID = ‘87654321′.
CUSTOMER-NAME = ‘Edison’.
CUSTOMER-TELEPHONE = ‘111-111-1111′.
MOVE CUSTOMER TO VENDOR.
WRITE / VENDOR-NAME.

* Defining an internal table each entry having the structure of
* the record customer
DATA ALL_CUSTOMERS LIKE CUSTOMER OCCURS 100.

* Using a reference to a non-elementary type.
TYPES: BEGIN OF PERSONAL_DATA,
NAME(25),
CITY(25),
STREET(30),
END OF PERSONAL_DATA.
DATA PEOPLE TYPE PERSONAL_DATA OCCURS 300.

* Internal table with a header line, which is used as a default record
* to hold the record currently being added to the table
DATA NEW_CUSTOMERS LIKE CUSTOMER OCCURS 100
WITH HEADER LINE.

———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com

If you like this post, you may as well like these too:

  1. ABAP Programs: Using internal tables as snapshots of database tables REPORT ZSOURCE1103.* Work area for a database tableTABLES CUSTOMERS.* Internal tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Filling the internal table with all entries of the database tableSELECT...
  2. ABAP Programs: Using Internal Tables for Selection Criteria REPORT ZSOURCE1112.* Work areasTABLES: CUSTOMERS, BOOKINGS.* Internal tablesDATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 500 [...]...
  3. ABAP Programs: Internal tables with header lines REPORT ZSOURCE1202.* Work area for a database tableTABLES CUSTOMERS.* Defining an internal table with header lineDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Reading all entries of the database...
  4. Source Code: Working with database tables and internal tables REPORT ZSOURCE0103. * Declaration of a work area for a Dictionary tableTABLES CUSTOMERS. * Internal table used as snapshot of the database tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER...
  5. ABAP Tips on Data Dictionary and Internal tables Data Dictionary Maintenance Views Lock Objects Internal Tables Free text search in a field in a internal table Types of Internal Tables Working with Internal Tables ...



This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

  • Subscribe to RSS

  • Free Ebooks