*&---------------------------------------------------------------------*
*& Include ZVVF_MM032_PHYINV_0200_PAI *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200 INPUT *
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0200 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
CLEAR SAVE_OK.
ENDMODULE. " USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200_EXIT INPUT *
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0200_SAVE INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'SAVE'.
PERFORM F001_SAVE_DATA_0200.
PERFORM F002_UNLOCK.
ENDCASE.
CLEAR SAVE_OK.
ENDMODULE. " USER_COMMAND_0200_SAVE INPUT
*&---------------------------------------------------------------------*
*& Module GET_DESCRIPTION INPUT *
*&---------------------------------------------------------------------*
MODULE GET_DESCRIPTION INPUT.
SELECT * FROM ZVVF_MT032_PHINV
INTO CORRESPONDING FIELDS OF TABLE IT_PHYINV
WHERE ZVVF_MATNR = WA_PHYINV-ZVVF_MATNR
AND ZVVF_WERKS = WA_PHYINV-ZVVF_WERKS
AND ZVVF_LGORT = WA_PHYINV-ZVVF_LGORT.
IF SY-SUBRC NE 0.
MESSAGE E006(ZMM).
ENDIF.
SELECT SINGLE MAKTX FROM MAKT
INTO W_MATDESC
WHERE MATNR = WA_PHYINV-ZVVF_MATNR.
IF SY-SUBRC NE 0.
ENDIF.
SELECT SINGLE NAME1 FROM T001W
INTO W_PLANTDESC
WHERE WERKS = WA_PHYINV-ZVVF_WERKS.
IF SY-SUBRC NE 0.
ENDIF.
SELECT SINGLE LGOBE FROM T001L
INTO W_LOCATIONDESC
WHERE LGORT = WA_PHYINV-ZVVF_LGORT.
IF SY-SUBRC NE 0.
ENDIF.
ENDMODULE. " GET_DESCRIPTION INPUT
*&---------------------------------------------------------------------*
*& Module CHECK_DATA INPUT *
*&---------------------------------------------------------------------*
MODULE CHECK_DATA INPUT.
SELECT SINGLE * FROM T001W
WHERE WERKS = WA_PHYINV-ZVVF_WERKS.
IF SY-SUBRC NE 0 .
CLEAR W_PLANTDESC.
PERFORM F002_UNLOCK.
MESSAGE E002(ZMM).
ENDIF.
SELECT SINGLE * FROM T001L
WHERE LGORT = WA_PHYINV-ZVVF_LGORT.
IF SY-SUBRC NE 0 .
CLEAR W_LOCATIONDESC.
PERFORM F002_UNLOCK.
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 .
CLEAR W_MATDESC.
PERFORM F002_UNLOCK.
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 NE 0.
PERFORM F002_UNLOCK.
MESSAGE E006(ZMM).
ENDIF.
PERFORM F003_LOCK.
ENDMODULE. " CHECK_DATA INPUT
*&---------------------------------------------------------------------*
*& Form SAVE_DATA_0200 *
*&---------------------------------------------------------------------*
FORM F001_SAVE_DATA_0200 .
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.
PERFORM DATA_CHECK.
IF W_DELFLAG = 0.
PERFORM CALC_BOOKSTK.
PERFORM ONCOMMIT.
*ADDED 12.02.2005
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.
CALL FUNCTION 'DEQUEUE_EZVVF_MM032_PINV'
EXPORTING
MODE_ZVVF_MT032_PHINV = 'S'
MANDT = SY-MANDT
ZVVF_WERKS = WA_PHYINV-ZVVF_WERKS
ZVVF_LGORT = WA_PHYINV-ZVVF_LGORT
ZVVF_MATNR = WA_PHYINV-ZVVF_MATNR
* X_ZVVF_WERKS = ' '
* X_ZVVF_LGORT = ' '
* X_ZVVF_MATNR = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.
MESSAGE I009(ZMM).
ENDIF.
ELSE.
MESSAGE I006(ZMM).
ENDIF.
ENDFORM. " SAVE_DATA_0200
*&---------------------------------------------------------------------*
*& Form UNLOCK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM F002_UNLOCK . CALL FUNCTION 'DEQUEUE_EZVVF_MM032_PINV' EXPORTING MODE_ZVVF_MT032_PHINV = 'S' MANDT = SY-MANDT ZVVF_WERKS = WA_PHYINV-ZVVF_WERKS ZVVF_LGORT = WA_PHYINV-ZVVF_LGORT ZVVF_MATNR = WA_PHYINV-ZVVF_MATNR * X_ZVVF_WERKS = ' ' * X_ZVVF_LGORT = ' ' * X_ZVVF_MATNR = ' ' * _SCOPE = '3' * _SYNCHRON = ' ' * _COLLECT = ' ' . ENDFORM. " UNLOCK *&---------------------------------------------------------------------* *& Form LOCK *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM F003_LOCK . IF W_WERK NE WA_PHYINV-ZVVF_WERKS OR W_LGORT NE WA_PHYINV-ZVVF_LGORT OR W_MATNR NE WA_PHYINV-ZVVF_MATNR. CALL FUNCTION 'DEQUEUE_EZVVF_MM032_PINV' EXPORTING MODE_ZVVF_MT032_PHINV = 'S' MANDT = SY-MANDT ZVVF_WERKS = W_WERK ZVVF_LGORT = W_LGORT ZVVF_MATNR = W_MATNR * X_ZVVF_WERKS = ' ' * X_ZVVF_LGORT = ' ' * X_ZVVF_MATNR = ' ' * _SCOPE = '3' * _SYNCHRON = ' ' * _COLLECT = ' ' . ENDIF. CALL FUNCTION 'ENQUEUE_EZVVF_MM032_PINV' EXPORTING MODE_ZVVF_MT032_PHINV = 'S' MANDT = SY-MANDT ZVVF_WERKS = WA_PHYINV-ZVVF_WERKS ZVVF_LGORT = WA_PHYINV-ZVVF_LGORT ZVVF_MATNR = WA_PHYINV-ZVVF_MATNR * X_ZVVF_WERKS = ' ' * X_ZVVF_LGORT = ' ' * X_ZVVF_MATNR = ' ' * _SCOPE = '2' * _WAIT = ' ' * _COLLECT = ' ' EXCEPTIONS FOREIGN_LOCK = 1 SYSTEM_FAILURE = 2 OTHERS = 3 . IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " LOCK
No comments:
Post a Comment