2012年3月30日 星期五

[User Exit] Checks for changes to order operations

Enhancement 

PPCO0019
*&---------------------------------------------------------------------*
*&  Include           ZXCO1U19
*&---------------------------------------------------------------------*
* If WO Online Qty Not Equal 0, SAP PP Order Operation change is deny!
*&---------------------------------------------------------------------*
  DATA: lt_woqty LIKE ztmes_wo_online OCCURS 0 WITH HEADER LINE,
        lv_ck_werks(1),
        lv_ck_dispo(1),
        lv_ck_auart(1),
        lv_ck_ftrmi(1).

  FIELD-SYMBOLS: <fnew> TYPE ANY,
                 <fold> TYPE ANY.

**/ Check MES Interface Configuration
  CLEAR: lv_ck_werks, lv_ck_dispo, lv_ck_auart, lv_ck_ftrmi.
* Get Implement scope check result
  CALL FUNCTION 'ZMES_CHECK_IMP_SCOPE'
    EXPORTING
      pi_werks = is_header-werks
      pi_dispo = is_header-dispo
      pi_auart = is_header-auart
      pi_ftrmi = is_header-ftrmi
    IMPORTING
      pe_werks = lv_ck_werks
      pe_dispo = lv_ck_dispo
      pe_auart = lv_ck_auart
      pe_ftrmi = lv_ck_ftrmi.
* Check result
  IF lv_ck_werks = 'N' OR  " Check Plant
     lv_ck_dispo = 'N' OR  " Check PP Order MRP Controller
     lv_ck_auart = 'N' OR  " Check PP Order type
     lv_ck_ftrmi = 'N'.    " Check PP Order release date
    EXIT.
  ENDIF.

**/ Check WO Online qty.
  CLEAR lt_woqty.
  SELECT DISTINCT * INTO lt_woqty
      FROM ztmes_wo_online
     WHERE aufnr = is_header-aufnr
     ORDER BY erdat DESCENDING erzet DESCENDING.
    EXIT.
  ENDSELECT.
  IF sy-subrc       EQ 0  AND
     lt_woqty-gamng GT 0.
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE is_operation_new TO <fnew>.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      ASSIGN COMPONENT sy-index OF STRUCTURE is_operation_old TO <fold>.
      IF <fnew> NE <fold>.
        MESSAGE e022(zmsg) WITH 'You can''t change PP order operation'
                                'when MES WO online qty greater than 0!'.
      ENDIF.
    ENDDO.
  ENDIF.   

沒有留言:

張貼留言