Modify From
Modify From
If the database table contains no line with the same primary key as the line to be inserted, MODIFY works like INSERT, that is, the line is added. If the database already contains a line with the same primary key as the line to be inserted, MODIFY works like UPDATE, that is, the line is changed. The syntax for the MODIFY statement is as follows. MODIFY <database table> FROM <work area> If the database table does not already contain a line with the same primary key as specified in the work area, a new line is inserted. If the database table does already contain a line with the same primary key as specified in the work area, the existing line is overwritten. SY-SUBRC is always set to 0.
DATA: gwa_employee TYPE zemployee. gwa_employee-id gwa_employee-name gwa_employee-place gwa_employee-phone gwa_employee-dept_id = = = = = 6. 'JOSEPH'. 'FRANKFURT'. '7897897890'. 5.
Since there was no entry with the key 6, a new entry was added to the table.
DATA: gwa_employee TYPE zemployee.
= = = = =
Since there was an entry with the key 6, the values in the existing record were modified.