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 a dynamic table name

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

REPORT ZSOURCE1110.
* Variables for later use
DATA: TABLENAME(10),
COUNT_ROWS TYPE I.
* Setting the table name dynamically
MOVE ‘CUSTOMERS’ TO TABLENAME.
* Selecting data
SELECT COUNT( * ) FROM (TABLENAME) INTO COUNT_ROWS.
WRITE: TABLENAME, COUNT_ROWS.

~ end of post ~

———————
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: 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 ‘ID’, VALUE2 LIKE VALUE1. *...
  2. ABAP Programs:Dynamic Open SQL Commands: table name 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...
  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 STANDARD...
  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....
  6. ABAP Programs: Using table parameters REPORT ZSOURCE1006. * Work area of database table and internal table for later useTABLES CUSTOMERS.DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 50 WITH HEADER LINE.* Calling a form with a table parameterPERFORM...
  7. 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 *...
  8. 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:...
  9. ABAP Programs: Updating multiple entries in a database table REPORT ZSOURCE1304.* Work areaTABLES CUSTOMERS.* Internal table for changed entriesDATA CHANGED_CUSTOMERS LIKE CUSTOMERS OCCURS 50 WITH HEADER LINE.* Filling the internal tableSELECT * FROM CUSTOMERS INTO TABLE CHANGED_CUSTOMERS WHERE CITY...
  10. ABAP Programs: Updating single entries in a database table REPORT ZSOURCE1303.* Work areaTABLES CUSTOMERS.* Record used as alternative work areaDATA MY_CUSTOMER LIKE CUSTOMERS.* Updating one entry from the work areaCUSTOMERS-ID = ’12345678′.CUSTOMERS-CITY = ‘Village’.UPDATE CUSTOMERS.IF SY-SUBRC 0. WRITE: ‘Entry...
  11. ABAP Programs: Modifying multiple entries in a database table REPORT ZSOURCE1306.* Work areaTABLES CUSTOMERS.* Internal table for changed entriesDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 50 WITH HEADER LINE.* Filling the internal tableSELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS WHERE CITY...
  12. ABAP Programs: Deleting single entries from a database table REPORT ZSOURCE1307.* Work areaTABLES CUSTOMERS.* Deleting an entryCUSTOMERS-ID = ’12345678′.DELETE CUSTOMERS. ~ end of post ~ ———————ABAPer, mail: abap.community@gmail.com http://www.erpdb.info...
  13. ABAP Programs : Inserting multiple entries in a database table REPORT ZSOURCE1302.* Work areaTABLES CUSTOMERS.* Internal table for new entriesDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Filling the internal tableALL_CUSTOMERS-ID = ’12345678′.ALL_CUSTOMERS-NAME = ‘Brown’.APPEND ALL_CUSTOMERS.ALL_CUSTOMERS-ID = ’11111111′.ALL_CUSTOMERS-NAME =...
  14. ABAP Programs: Inserting single entries in a database table REPORT ZSOURCE1301.* Work areaTABLES CUSTOMERS.* Record used as alternative work areaDATA MY_CUSTOMER LIKE CUSTOMERS.* Inserting one entry from the work areaCUSTOMERS-ID = ’12345678′.CUSTOMERS-NAME = ‘Brown’.INSERT CUSTOMERS.IF SY-SUBRC 0. WRITE: /...
  15. ABAP Programs: Modifying single entries in a database table REPORT ZSOURCE1305.* Work areaTABLES CUSTOMERS.* Modifying an entryCUSTOMERS-ID = ’12345678′.CUSTOMERS-CITY = ‘Village’.MODIFY CUSTOMERS. ~ end of post ~ ———————ABAPer, mail: abap.community@gmail.com http://www.erpdb.info...



Leave a Reply