SAP Database

ABAP Programs: Modifying multiple entries in a database table

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

REPORT ZSOURCE1306.
* Work area
TABLES CUSTOMERS.
* Internal table for changed entries
DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 50
WITH HEADER LINE.

* Filling the internal table
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS
WHERE CITY = SPACE.
ALL_CUSTOMERS-ID = ‘04295119′.
ALL_CUSTOMERS-NAME = ‘Gray’.
APPEND ALL_CUSTOMERS.
LOOP AT ALL_CUSTOMERS.
ALL_CUSTOMERS-CITY = ‘City unknown’.
MODIFY ALL_CUSTOMERS.
ENDLOOP.
* Modifying the database table with values from the internal table
MODIFY CUSTOMERS FROM TABLE ALL_CUSTOMERS.

———————
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: 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...
  2. 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://abaplearner.blogspot.com ...
  3. ABAP Programs: Deleting multiple entries from a database table REPORT ZSOURCE1308.* Work areaTABLES CUSTOMERS.* Internal table for deleted entriesDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 50 WITH HEADER LINE.* Filling the internal tableSELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS WHERE...
  4. 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...
  5. 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:...



Leave a Reply

  • Help Support CRY