ERP Database - The Unofficial ERP Knowledge Base

Facebook Twitter del.icio.us Digg it
ERP Database contains a huge collection of articles related to ERP System and Software. Many of the articles are specifically related to SAP. All these ERP/SAP articles are freely available to everyone.

If you would like to submit an article or share any document related to ERP or any specific ERP software. Please mail it to support@erpdb.info. Please make sure that the documents are not copyrighted.
Social Bookmarks:

ABAP Programs: Using Internal Tables for Selection Criteria

Print This Post Email This Post Written by admin on Dec 3rd, 2007 | Filed under: ABAP Programs

REPORT ZSOURCE1112.
* Work areas
TABLES: CUSTOMERS, BOOKINGS.
* Internal tables
DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
WITH HEADER LINE,
ALL_BOOKINGS LIKE BOOKINGS OCCURS 500
WITH HEADER LINE.
* Reading entries from both database table
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.

SELECT * FROM BOOKINGS INTO TABLE ALL_BOOKINGS
FOR ALL ENTRIES IN ALL_CUSTOMERS
WHERE CUSTOMID = ALL_CUSTOMERS-ID
AND ORDER_DATE = ’19990101′.
* Displaying the result
LOOP AT ALL_CUSTOMERS.
LOOP AT ALL_BOOKINGS
WHERE CUSTOMID = ALL_CUSTOMERS-ID.
WRITE: / ALL_CUSTOMERS-NAME,
ALL_BOOKINGS-FLDATE.
ENDLOOP.
ENDLOOP.

———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info

Share

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

  1. ABAP Programs: Sample report with selection criteria REPORT ZSOURCE1801. TABLES: CUSTOMERS, BOOKINGS. PARAMETERS P_DATE TYPE D. SELECT-OPTIONS S_NAME FOR CUSTOMERS-NAME. SELECT * FROM CUSTOMERS WHERE NAME IN S_NAME. WRITE / CUSTOMERS-NAME. SELECT * FROM BOOKINGS WHERE ORDER_DATE...
  2. 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...
  3. ABAP Programs: Records and internal tables REPORT ZSOURCE0407. * Records (or structures) consist of a fixed number of componentsDATA: BEGIN OF CUSTOMER, ID(8) TYPE N, NAME(25), TELEPHONE(12), END OF CUSTOMER. * Working with the different components...
  4. 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...
  5. ABAP Programs : Using the events start-of-selection and end-of-selection REPORT ZSOURCE1503. * Work area TABLES BOOKINGS. * Initial processing START-OF-SELECTION. WRITE / ‘Start’. * Reading data GET BOOKINGS. WRITE: AT /3 BOOKINGS-FLDATE. * Final processing END-OF-SELECTION. WRITE / ‘Finished’....
  6. 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...
  7. 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...
  8. ABAP Programs: Dynamic sort command with several sort criteria REPORT ZSOURCE2302. * Parameters for the sort criterion, can be modified by the end user PARAMETERS: COLUMN1(10)          DEFAULT ‘NAME’, COLUMN2 LIKE COLUMN1 DEFAULT ‘ID’. * Declarations for later use TABLES...
  9. ABAP Programs: Selection screen events 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 REPORT ZSOURCE1603 MESSAGE-ID...
  10. ABAP Programs:Displaying the selection screen 1 2 3 4 5 6 7 8 9 10 REPORT ZSOURCE1803. * Work area TABLES CUSTOMERS. * Selection criteria SELECT-OPTIONS S_NAME FOR CUSTOMERS-NAME. * running chap1801 and displaying the...
  11. What are Internal Tables? Internal Tables are standard data type objects which exist only during the Runtime of an ABAP program. They are used to perform table calculations on subsets of database tables and...
  12. ABAP Programs: A simple internal table REPORT ZSOURCE1201.* Work area for a database tableTABLES CUSTOMERS.* Defining an internal tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100.* Reading all entries of the database table into the internal tableSELECT *...
  13. ABAP Programs: Working with tables from the Dictionary REPORT ZSOURCE0501. * Declaration of a work area for a Dictionary tableTABLES CUSTOMERS.* Reading all entries of the database table and displaying each entrySELECT * FROM CUSTOMERS. WRITE: / CUSTOMERS-NAME.ENDSELECT.———————ABAPer,...
  14. ABAP Programs: Internal flow of control (if, case, do, while) REPORT ZSOURCE0902. * Declarations for later useTABLES CUSTOMERS.DATA: COLOR(10) VALUE ‘yellow’, N(4) TYPE N VALUE ’123′, P TYPE P, C4(4) VALUE ’124′, C5(5) VALUE ’00124′, SQUARE_NUMBER TYPE I, X TYPE...
  15. ABAP Programs: Upload Excel to Internal table Here is a simple program which will upload the excel file to the internal table using the function module ‘TEXT_CONVERT_XLS_TO_SAP’. REPORT Z_EXCEL_2_ITAB. ************************************** * http://www.erpdb.info * ************************************** TYPE-POOLS: truxs. PARAMETERS:...



Leave a Reply