SAP Database - The Unofficial SAP Knowledge Base

Free Business and Tech Magazines and eBooks

ABAP Programs:Dynamic Open SQL Commands: table name

Print This Post Email This Post Written by admin on Jan 21st, 2008 | Filed under: ABAP Programs

REPORT ZSOURCE2305.

PARAMETERS TABLENAME(10) DEFAULT 'CUSTOMERS'.
DATA COUNT_ROWS TYPE I.
SELECT COUNT( * ) FROM (TABLENAME) INTO COUNT_ROWS.
WRITE: TABLENAME, COUNT_ROWS.

DATA WHERE_TAB(80) OCCURS 10 WITH HEADER LINE.
APPEND 'name like ''E%''' TO WHERE_TAB.
APPEND 'and city like ''S%''' TO WHERE_TAB.
TABLES CUSTOMERS.
DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100.
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS
WHERE ID BETWEEN 1 AND 999
AND (WHERE_TAB).

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

  1. ABAP Programs: Using a dynamic table name REPORT ZSOURCE1110.* Variables for later useDATA: TABLENAME(10), COUNT_ROWS TYPE I.* Setting the table name dynamicallyMOVE ‘CUSTOMERS’ TO TABLENAME.* Selecting dataSELECT COUNT( * ) FROM (TABLENAME) INTO COUNT_ROWS.WRITE: TABLENAME, COUNT_ROWS. ~...
  2. ABAP Programs: Dynamic read table command REPORT ZSOURCE2303. * Parameters for reading a single line, can be modified by the end user PARAMETERS: KEY1(10) DEFAULT ‘NAME’, VALUE1(25), KEY2 LIKE KEY1 DEFAULT [...]...
  3. ABAP: How to create a dynamic internal table and work area FIELD-SYMBOLS:<fs_table> TYPE STANDARD TABLE, <fs_table_wa> TYPE ANY. DATA: table_ref TYPE REF TO data, wa_ref TYPE REF TO data. DATA: l_structure TYPE dd02l-tabname value 'VBAP'.   CREATE DATA table_ref TYPE...
  4. ABAP Programs: Filling an internal table from a database table REPORT ZSOURCE1203.* Work area for a database tableTABLES CUSTOMERS.* Defining an internal table with header lineDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Filling the internal table (previous content...
  5. ABAP Programs:Dynamic subtotals REPORT ZSOURCE2304. TABLES ACTFLI. DATA MY_FLIGHTS LIKE ACTFLI OCCURS 10 WITH HEADER LINE. DATA SUM_OCCUPIED_SEATS LIKE MY_FLIGHTS-SEATSOCC. DATA COLUMN(30). SELECT * FROM ACTFLI INTO TABLE MY_FLIGHTS ORDER BY PRIMARY KEY....



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