*&---------------------------------------------------------------------*
*& Report ZSAN_DML
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSAN_DML.
TABLES:ZSAN_EMP_DETAILS.
DATA:SAN_ITABLE TYPE TABLE OF ZSAN_EMP_DETAILS,
SAN_STRUCT TYPE ZSAN_EMP_DETAILS.
PARAMETERS:P_EMPNO TYPE ZSAN_EMP_DETAILS-EMP_NO,
P_ENAME TYPE ZSAN_EMP_DETAILS-EMP_NAME,
P_SALARY TYPE ZSAN_EMP_DETAILS-EMP_SALARY.
** p_cunt type i.
START-OF-SELECTION.
PERFORM insert.
PERFORM UPDATE.
PERFORM DELETE.
PERFORM MODIFY.
*&---------------------------------------------------------------------*
*& Form INSERT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM INSERT .
SAN_STRUCT-EMP_NO = P_EMPNO.
SAN_STRUCT-EMP_NAME = P_ENAME.
SAN_STRUCT-EMP_SALARY = P_SALARY.
APPEND SAN_STRUCT TO SAN_ITABLE.
INSERT ZSAN_EMP_DETAILS FROM TABLE SAN_ITABLE.
LOOP AT SAN_ITABLE INTO SAN_STRUCT.
WRITE: SAN_STRUCT-EMP_NO,SAN_STRUCT-EMP_NAME,SAN_STRUCT-EMP_SALARY.
ENDLOOP.
ENDFORM.
" INSERT
*&---------------------------------------------------------------------*
*& Form UPDATE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM UPDATE .
LOOP AT SAN_ITABLE INTO SAN_STRUCT.
IF SAN_STRUCT-EMP_NO = P_EMPNO.
SAN_STRUCT-EMP_SALARY = '12345'.
APPEND SAN_STRUCT TO SAN_ITABLE.
UPDATE ZSAN_EMP_DETAILS FROM TABLE SAN_ITABLE.
ENDIF.
ENDLOOP.
UPDATE ZSAN_EMP_DETAILS SET EMP_SALARY = P_SALARY WHERE EMP_NO = P_EMPNO.
WRITE:'UPDATE SUCCESS'.
ENDFORM. " UPDATE
*&---------------------------------------------------------------------*
*& Form DELETE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DELETE .
DELETE FROM ZSAN_EMP_DETAILS WHERE EMP_NO = P_EMPNO.
WRITE: 'DELETE SUCCCESS'.
ENDFORM. " DELETE
*&---------------------------------------------------------------------*
*& Form MODIFY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MODIFY .
SAN_STRUCT-EMP_NO = P_EMPNO.
SAN_STRUCT-EMP_NAME = P_ENAME.
SAN_STRUCT-EMP_SALARY = P_SALARY.
MODIFY ZSAN_EMP_DETAILS FROM SAN_STRUCT .
WRITE: 'MODIFY SUCCESS'.
ENDFORM. " MODIFY
*& Report ZSAN_DML
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSAN_DML.
TABLES:ZSAN_EMP_DETAILS.
DATA:SAN_ITABLE TYPE TABLE OF ZSAN_EMP_DETAILS,
SAN_STRUCT TYPE ZSAN_EMP_DETAILS.
PARAMETERS:P_EMPNO TYPE ZSAN_EMP_DETAILS-EMP_NO,
P_ENAME TYPE ZSAN_EMP_DETAILS-EMP_NAME,
P_SALARY TYPE ZSAN_EMP_DETAILS-EMP_SALARY.
** p_cunt type i.
START-OF-SELECTION.
PERFORM insert.
PERFORM UPDATE.
PERFORM DELETE.
PERFORM MODIFY.
*&---------------------------------------------------------------------*
*& Form INSERT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM INSERT .
SAN_STRUCT-EMP_NO = P_EMPNO.
SAN_STRUCT-EMP_NAME = P_ENAME.
SAN_STRUCT-EMP_SALARY = P_SALARY.
APPEND SAN_STRUCT TO SAN_ITABLE.
INSERT ZSAN_EMP_DETAILS FROM TABLE SAN_ITABLE.
LOOP AT SAN_ITABLE INTO SAN_STRUCT.
WRITE: SAN_STRUCT-EMP_NO,SAN_STRUCT-EMP_NAME,SAN_STRUCT-EMP_SALARY.
ENDLOOP.
ENDFORM.
" INSERT
*&---------------------------------------------------------------------*
*& Form UPDATE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM UPDATE .
LOOP AT SAN_ITABLE INTO SAN_STRUCT.
IF SAN_STRUCT-EMP_NO = P_EMPNO.
SAN_STRUCT-EMP_SALARY = '12345'.
APPEND SAN_STRUCT TO SAN_ITABLE.
UPDATE ZSAN_EMP_DETAILS FROM TABLE SAN_ITABLE.
ENDIF.
ENDLOOP.
UPDATE ZSAN_EMP_DETAILS SET EMP_SALARY = P_SALARY WHERE EMP_NO = P_EMPNO.
WRITE:'UPDATE SUCCESS'.
ENDFORM. " UPDATE
*&---------------------------------------------------------------------*
*& Form DELETE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DELETE .
DELETE FROM ZSAN_EMP_DETAILS WHERE EMP_NO = P_EMPNO.
WRITE: 'DELETE SUCCCESS'.
ENDFORM. " DELETE
*&---------------------------------------------------------------------*
*& Form MODIFY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MODIFY .
SAN_STRUCT-EMP_NO = P_EMPNO.
SAN_STRUCT-EMP_NAME = P_ENAME.
SAN_STRUCT-EMP_SALARY = P_SALARY.
MODIFY ZSAN_EMP_DETAILS FROM SAN_STRUCT .
WRITE: 'MODIFY SUCCESS'.
ENDFORM. " MODIFY
0 comments:
Post a Comment