VL01N/QA32/QA11出口增强

需求:某工厂某库存地点销售发货时不需要做检验批处理.

 

分析:SAP标准质量管理视图只能控制到工厂级别,无法实现库存地点级别的控制.

        所以寻求abap方式去解决,寻遍N多出口与增强也无法实现,最后只能进行残忍

        的标准程序debug了.

 

程序名:FV50WF0W

程序段:

*... Check QM status?
      CLEAR LF_NO_QM_CHECK.
      IF NOT LIKP-VERURSYS IS INITIAL.
*      No inspection lot check in decentralized WMS
      ELSE.
        IF ( NOT XLIPS-QPLOS IS INITIAL   OR
             NOT XLIPS-QTLOS IS INITIAL ) AND
*        Check only if inspection lot is in delivery item
                 XLIPS-SHKZG CA ' XH'     AND
                 LIKP-VBTYP  CA VBTYP_LIEF.
*        Check only outboud deliveries
          IF ( XLIPS-WERKS NE XLIPS-UMWRK AND
             NOT XLIPS-WERKS IS INITIAL   AND
             NOT XLIPS-UMWRK IS INITIAL ) OR
             ( XLIPS-LGORT NE XLIPS-UMLGO AND
             NOT XLIPS-LGORT IS INITIAL   AND
             NOT XLIPS-UMLGO IS INITIAL ).
*          Don't check stock transfers/transports excluding STO
            LF_NO_QM_CHECK = CHARX.
          ENDIF.
        ELSE.
          LF_NO_QM_CHECK = CHARX.
        ENDIF.
*      Perform Userexit for manual control of inspection lot check:
*      To set the flag LF_NO_QM_CHECK in the Userexit means not to check
*      the status of the inspection lot during goods movement.
        PERFORM USEREXIT_QM_CHECK IN PROGRAM SAPMV50A IF FOUND
                                             CHANGING LF_NO_QM_CHECK.
*      Call inspection lot check if required
        IF LF_NO_QM_CHECK IS INITIAL.
          CALL FUNCTION 'QVDM_CHECK_GOODS_ISSUE_ALLOWED'
            EXPORTING
              I_LIKP                  = LIKP
              I_LIPS                  = XLIPS
            EXCEPTIONS
              GOODS_ISSUE_NOT_ALLOWED = 01.
          IF SY-SUBRC > 0.
*          MESSAGE E171: Status of inspection lot & / partial lot & does
*                        not allow good issue
            MOVE-CORRESPONDING XLIPS TO WAT.
            WAT-MSGNO = '171'.
            WAT-MSGTY = E.
            WAT-MSGID = 'VL'.
            WAT-MSGV1 = XLIPS-QPLOS.
            WAT-MSGV2 = XLIPS-QTLOS.
            WAT-MSGV3 = SPACE.
            WAT-MSGV4 = SPACE.
            APPEND WAT.
            WB_LS_ERR = CHARX.
          ENDIF.
        ENDIF.
      ENDIF.                                                "^_n_674782

 

发现标准程序有预留了出口:

        PERFORM USEREXIT_QM_CHECK IN PROGRAM SAPMV50A IF FOUND
                                             CHANGING LF_NO_QM_CHECK.

 

实现:

程序名:MV50AFZ1

新增程序段:

*---------------------------------------------------------------------*
*       FORM USEREXIT_QM_CHECK                                *
*---------------------------------------------------------------------*
*      Perform Userexit for manual control of inspection lot check:
*      To set the flag LF_NO_QM_CHECK in the Userexit means not to check
*      the status of the inspection lot during goods movement.
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_QM_CHECK CHANGING LF_NO_QM_CHECK.

  CHECK lips-werks EQ '4020'.
  CHECK lips-lgort EQ '3003' OR
        lips-lgort EQ '3004' OR
        lips-lgort EQ '3005' OR
        lips-lgort EQ '3006' OR
        lips-lgort EQ '3007' OR
        lips-lgort EQ '3010' OR
        lips-lgort EQ '3015' OR
        lips-lgort EQ '3017' OR
        lips-lgort EQ '3103' OR
        lips-lgort EQ '3104'. 

  

MESSAGE 'QA32-VL02N test!' TYPE 'I'.


ENDFORM.

该方法的实现逻辑是发货过账时利用程序自动通过QA11的检验批从而实现过账.

 

 

另:

初衷想在交货单生成时控制不让生成检验批.但是较复杂需要修改标准程序.

综合考虑后还是放弃了这个做法.

以下是跟踪标准程序得到的代码段:

 


*---------------------------------------------------------------------*

*---------------------------------------------------------------------*

FV50PFLP_LIPS_BEARBEITEN

    if v50agl-create_decentral eq space.                    "40C WMS
      perform qm_lips_hinzufuegen.
    endif.


LQAATF01
*     User-Exit für Lieferungstyp, Fehler werden ignoriert
      CALL CUSTOMER-FUNCTION '001'
           EXPORTING
                I_LIKP        = P_LIKP
                I_LIPS        = P_LIPS
                I_QVDM        = L_QVDM
           IMPORTING
                E_ABRVW       = S_ABRVW
           EXCEPTIONS
                ERROR_MESSAGE = 00
                OTHERS        = 00.


*   Material zu prüfen?
    CALL FUNCTION 'QMAT_READ'
         EXPORTING
              I_ART    = L_ART
              I_MATNR  = P_LIPS-MATNR
              I_WERKS  = P_LIPS-WERKS
         IMPORTING
              E_QMAT   = S_QMAT
         EXCEPTIONS
              NO_ENTRY = 01.
    IF NOT SY-SUBRC IS INITIAL.
      CLEAR: S_ABRVW,
             S_QMAT.
    ENDIF.


FV50PF0Q
* Los ändern
  move xlips[] to l_xlips_tab.
  call function 'QAAT_SD_LOT_MODIF'
    exporting
      i_kuwev                 = kuwev
      i_likp_new              = likp
      i_likp_old              = *likp
      i_lips_new              = lips
      i_lips_old              = *lips
      i_tvlk                  = tvlk
    importing
      e_prueflos              = lips-qplos
      e_teillos               = lips-qtlos
    tables
      xlips_tab               = l_xlips_tab
    exceptions
      x_modif_not_possible    = 01
      x_lot_is_blocked        = 02
      x_partiallot_is_blocked = 03
      error_message           = 05
      others                  = 04.
  l_subrc = sy-subrc.
  if l_subrc > 0.
    perform message_aufbauen(sapmv50a) using sy-msgno
                                             sy-msgty
                                             sy-msgid
                                             sy-msgv1
                                             sy-msgv2
                                             sy-msgv3
                                             sy-msgv4
                                             ftext.
  endif.


SAPLQAAT / LQAATF01 / SD_LOT_CREATION
  CHECK NOT L_QMAT-AKTIV IS INITIAL.



转载自:http://hi.baidu.com/fok_abaper/item/b993ddd36f58b412d80e4421




你可能感兴趣的:(SAP,SD,增强,VL01N,QA32,QA11)