ABAP Programs: Inserting single entries in a database table
REPORT ZSOURCE1301.
* Work area
TABLES CUSTOMERS.
* Record used as alternative work area
DATA MY_CUSTOMER LIKE CUSTOMERS.
* Inserting one entry from the work area
CUSTOMERS-ID = ‘12345678′.
CUSTOMERS-NAME = ‘Brown’.
INSERT CUSTOMERS.
IF SY-SUBRC <> 0.
WRITE: / ‘Entry already exists:’, CUSTOMERS-ID.
ENDIF.
* Inserting one entry from the record
MY_CUSTOMER-ID = ‘11111111′.
MY_CUSTOMER-NAME = ‘Green’.
INSERT INTO CUSTOMERS VALUES MY_CUSTOMER.
IF SY-SUBRC <> 0.
WRITE: / ‘Entry already exists:’, MY_CUSTOMER-ID.
ENDIF.
———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com
If you like this post, you may as well like these too:
- 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:...
- 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...
- 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 ...
- 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://abaplearner.blogspot.com ...
- ABAP Programs: Reading single entries REPORT ZSOURCE1105.* Work area for a database tableTABLES CUSTOMERS.* Reading a single entrySELECT SINGLE * FROM CUSTOMERS WHERE ID = ‘87654321′.IF SY-SUBRC = 0. WRITE CUSTOMERS-NAME.ELSE. WRITE ‘Customer not...

















Leave a Reply