Skip to content

Commit

Permalink
reorder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
iliyan-velichkov committed Jun 17, 2024
1 parent 0f4d411 commit b2fb34a
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions src/zcl_dirigible_employee_dao.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ ENDCLASS.

CLASS zcl_dirigible_employee_dao IMPLEMENTATION.

METHOD insert_employee.
" Declare a work area for the employee record
DATA: wa_employee TYPE ty_employee.
METHOD delete_all_employees.
DATA: lv_rc TYPE i.

wa_employee-id = 321.
wa_employee-first_name = 'Desislava'.
wa_employee-last_name = 'Dimitrova'.
DELETE FROM employees WHERE id > 0.

" Insert the work area into the employees table
INSERT INTO employees VALUES wa_employee.
lv_rc = sy-dbcnt.

IF sy-subrc = 0.
WRITE: / 'Employee inserted successfully.'.
IF lv_rc > 0.
WRITE: / 'All employees deleted successfully.'.
ELSE.
WRITE: / 'Failed to insert employee.'.
WRITE: / 'No employees found to delete.'.
ENDIF.
ENDMETHOD.

Expand All @@ -52,6 +48,24 @@ CLASS zcl_dirigible_employee_dao IMPLEMENTATION.
message_in = lt_employees ).
ENDMETHOD.

METHOD insert_employee.
" Declare a work area for the employee record
DATA: wa_employee TYPE ty_employee.

wa_employee-id = 321.
wa_employee-first_name = 'Desislava'.
wa_employee-last_name = 'Dimitrova'.

" Insert the work area into the employees table
INSERT INTO employees VALUES wa_employee.

IF sy-subrc = 0.
WRITE: / 'Employee inserted successfully.'.
ELSE.
WRITE: / 'Failed to insert employee.'.
ENDIF.
ENDMETHOD.

METHOD update_employee_last_name.
DATA: lv_rc TYPE i.

Expand All @@ -68,18 +82,6 @@ CLASS zcl_dirigible_employee_dao IMPLEMENTATION.
ENDIF.
ENDMETHOD.

METHOD delete_all_employees.
DATA: lv_rc TYPE i.

DELETE FROM employees WHERE id > 0.

lv_rc = sy-dbcnt.

IF lv_rc > 0.
WRITE: / 'All employees deleted successfully.'.
ELSE.
WRITE: / 'No employees found to delete.'.
ENDIF.
ENDMETHOD.

ENDCLASS.

0 comments on commit b2fb34a

Please sign in to comment.