Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FUNCTION Z_ASG_FN_INSERT.
- *"----------------------------------------------------------------------
- *"*"Local Interface:
- *" IMPORTING
- *" REFERENCE(WA_EMP) TYPE ZASG_EMP
- *" EXPORTING
- *" VALUE(E_SUBRC) TYPE SY-SUBRC
- *"----------------------------------------------------------------------
- TABLES : ZASG_EMP.
- CONSTANTS: admin TYPE c LENGTH 4 VALUE 'admin'.
- DATA: temp_name LIKE wa_emp-name.
- TRANSLATE temp_name TO LOWER CASE.
- * CHANGE POSITION VALUES TO FIT THE DATABASE.
- IF wa_emp-emppositon = 'Junior Developer'.
- wa_emp-empposition = 'JUNIOR'.
- ELSEIF wa_emp-empposition = 'Senior Developer'.
- wa_emp-empposition = 'SENIOR'.
- ELSEIF wa_emp-empposition = 'Team Leader'.
- wa_emp-empposition = 'TL'.
- ELSEIF wa_emp-empposition = 'Project Manager'.
- wa_emp-empposition = 'PM'.
- ENDIF.
- if temp_name = admin.
- E_SUBRC ='0'.
- ELSE.
- SELECT * FROM ZASG_EMP
- WHERE id = wa_emp-id.
- ENDSELECT.
- IF NOT ZASG_EMP-id is INITIAL.
- E_SUBRC = '3'.
- ELSE.
- SELECT * FROM ZASG_EMP
- WHERE name = wa_emp-name.
- ENDSELECT.
- IF ZASG_EMP-id IS INITIAL.
- ZASG_EMP-id = wa_emp-id.
- ZASG_EMP-name = wa_emp-name.
- ZASG_EMP-empposition = wa_emp-empposition.
- INSERT INTO ZASG_EMP VALUES ZASG_EMP.
- E_SUBRC = '1'.
- ELSE.
- E_SUBRC = '2'.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement