*&---------------------------------------------------------------------*
*& Include ZVVF_MM032_PHYINV_0100_PAI *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT *
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
DATA : SAVE_OK TYPE SY-UCOMM.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'BACK'.
CALL SCREEN 800.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
CLEAR SAVE_OK.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100_ENTE INPUT *
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0100_ENTE INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'ENTE'.
PERFORM CHECK_IF_DATA_EXISTS.
ENDCASE.
CLEAR SAVE_OK.
ENDMODULE. " USER_COMMAND_0100_ENTE INPUT
*&---------------------------------------------------------------------*
*& Form CHECK_IF_DATA_EXISTS *
*&---------------------------------------------------------------------*
FORM CHECK_IF_DATA_EXISTS.
SELECT SINGLE * FROM T001W
WHERE WERKS = WA_PHYINV-ZVVF_WERKS.
IF SY-SUBRC NE 0 .
MESSAGE E002(ZMM).
ENDIF.
SELECT SINGLE * FROM T001L
WHERE LGORT = WA_PHYINV-ZVVF_LGORT.
IF SY-SUBRC NE 0 .
MESSAGE E003(ZMM).
ENDIF.
IF WA_PHYINV-ZVVF_MATNR CA W_STR.
ELSE.
shift WA_PHYINV-ZVVF_MATNR right deleting trailing space.
overlay WA_PHYINV-ZVVF_MATNR with '000000000000000000'.
ENDIF.
SELECT SINGLE * FROM MARA
WHERE MATNR = WA_PHYINV-ZVVF_MATNR.
IF SY-SUBRC NE 0 .
MESSAGE E004(ZMM).
ENDIF.
SELECT SINGLE * FROM ZVVF_MT032_PHINV
WHERE ZVVF_WERKS = WA_PHYINV-ZVVF_WERKS
AND ZVVF_LGORT = WA_PHYINV-ZVVF_LGORT
AND ZVVF_MATNR = WA_PHYINV-ZVVF_MATNR.
IF SY-SUBRC = 0.
MESSAGE E001(ZMM).
ELSE.
SET PARAMETER ID 'ZVVF_MM032PHINV_WERK' FIELD WA_PHYINV-ZVVF_WERKS.
SET PARAMETER ID 'ZVVF_MM032PHINV_Sloc' FIELD WA_PHYINV-ZVVF_LGORT.
SET PARAMETER ID 'ZVVF_MM032PHINV_Mat' FIELD WA_PHYINV-ZVVF_MATNR.
ENDIF.
ENDFORM. " CHECK_IF_DATA_EXISTS
*&---------------------------------------------------------------------*
*& Form ONCOMMIT
*&---------------------------------------------------------------------*
FORM ONCOMMIT .
WA_PHYINV-ZVVF_DIFF = 0.
MODIFY ZVVF_MT032_PHINV FROM WA_PHYINV.
COMMIT WORK.
ENDFORM. " ONCOMMIT
No comments:
Post a Comment