取消检验批过账(取消检验批UD判定到Rerel,再把非限性库存转到质检库存,然后就可以取101收货了)

news/2024/11/8 3:13:39/

直接取消101收货时,出现以下提示:

 

(1)第一种方法:先把主数据的QM视图的QM相关信息取消,如下图:

  

取消QM采购激活及检验设置后,通过传输过账,把数量从非限库存转到质检库存。

过账完成后,数量从非限定到质检。再过SE16N把删除检验批与物料凭证的关联关系(记得在查询前在命令窗口输入/h,再回车):

 

然后,选中,删除,保存即可。

再取消101收货即可,

 

 (2)第二种方法,就打Notes(SAP Notes 74638).通过检验批取消UD转到为Rerel(zqevac40)。再通过检验批把非限定性库存转为质检库存(zrqevac50)。

对用户来讲,只需输入事务码:ZMMXX8 (可以把权限直接给仓库主管即可),然后输入检验批,执行即可以。

执行完成后,直接 MIGO,取消相应的物料凭证即可。

 具体代码如下:

 以下代码调用两步(UD转REREL\非限定库存转质检库存),可以定一个事务码:ZMMXX8,程序ZQMR_CANCEL_Q。

*&---------------------------------------------------------------------*
*& Report  ZQMR_CANCEL_Q
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*REPORT ZQMR_CANCEL_Q.PARAMETERS:prueflos LIKE qals-prueflos OBLIGATORY MEMORY ID qls.START-OF-SELECTION.SUBMIT zqevac40 WITH prueflos = prueflos AND RETURN.WAIT UP TO 1 SECONDS.SUBMIT zrqevac50 WITH prueflos = prueflos AND RETURN.

 取消检验批UD转rerel,代码如下:

*&---------------------------------------------------------------------*
*& Report  ZQEVAC40
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zqevac40.
*----------------------------------------------------------------------*
*  Datendefinitionen
*----------------------------------------------------------------------*
* Tabellen
*----------------------------------------------------------------------*
TABLES sscrfields.
TABLES qals.
TABLES qave.*----------------------------------------------------------------------*
* Konstanten
CONSTANTS:c_rc_0  LIKE sy-subrc           VALUE 0,c_rc_4  LIKE sy-subrc           VALUE 4,c_rc_20 LIKE sy-subrc           VALUE 20,
*c_kreuz LIKE qm00-qkz           VALUE 'X'.
**----------------------------------------------------------------------*
* Eingabebildschirm
SELECTION-SCREEN SKIP 2.
PARAMETERS prueflos  LIKE qals-prueflos MATCHCODE OBJECT qalsMEMORY ID qls .
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK search WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.SELECTION-SCREEN PUSHBUTTON 3(20) TEXT-s01 USER-COMMAND sear.
SELECTION-SCREEN PUSHBUTTON 40(20) TEXT-s02 USER-COMMAND show.SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK search.*----------------------------------------------------------------------*
AT SELECTION-SCREEN.IF sscrfields-ucomm EQ 'SEAR'OR prueflos IS INITIAL.CALL FUNCTION 'QELA_START_SELECTION_OF_LOTS'EXPORTINGi_selid          = ' 'i_stat_aenderung = 'X'i_stat_ero       = 'X'i_stat_frei      = 'X'i_stat_ve        = ' 'IMPORTINGe_prueflos       = prueflosEXCEPTIONSno_entry         = 1no_selected      = 2OTHERS           = 3.ENDIF.IF sscrfields-ucomm EQ 'SHOW'.CALL FUNCTION 'QSS1_LOT_SHOW'EXPORTINGi_prueflos = prueflos.ENDIF.CHECK sscrfields-ucomm EQ 'ONLI'.* ab hier mu Pr黤losnummer gef黮lt sein.IF prueflos IS INITIAL.MESSAGE e164(qa).ENDIF.* Lesen LosCALL FUNCTION 'ENQUEUE_EQQALS1'EXPORTINGprueflos = prueflos.CALL FUNCTION 'QPSE_LOT_READ'EXPORTINGi_prueflos = prueflosIMPORTINGe_qals     = qalsEXCEPTIONSno_lot     = 1.IF NOT sy-subrc IS INITIAL.MESSAGE e102(qa).ENDIF.
*-----------------
* Pr黤en StatusCALL FUNCTION 'QAST_STATUS_CHECK'EXPORTINGi_objnr          = qals-objnri_status         = 'I0218' "Status VE getroffenEXCEPTIONSstatus_not_activ = 1.IF NOT sy-subrc IS INITIAL.MESSAGE e102(qv) WITH qals-prueflos.ENDIF.
*CALL FUNCTION 'QEVA_UD_READ'EXPORTINGi_prueflos = qals-prueflosIMPORTINGe_qave     = qave.*---------------------------------------------------------------------*
START-OF-SELECTION.
* Vorgaben sind ok.   1. Material Umlagern und Los 鋘dernPERFORM qals_aendern.
************************************************************************
*----------------------------------------------------------------------*
*       FORM QALS_aendern
*----------------------------------------------------------------------*
FORM qals_aendern.
*PERFORM status_fix_setzen USING 'I0002' c_kreuz.PERFORM status_fix_setzen USING 'I0216' space.PERFORM status_fix_setzen USING 'I0217' space.PERFORM status_fix_setzen USING 'I0218' space.CLEAR: qals-stat14.CLEAR: qals-stat35.CLEAR: qave-vauswahlmg,qave-vwerks,qave-versionam,qave-vcodegrp,qave-vcode,qave-vbewertung,qave-versioncd,qave-vfolgeakti,qave-qkennzahl.
*--... verbuchenCALL FUNCTION 'QEVA_UD_UPDATE' IN UPDATE TASKEXPORTINGqals_new = qalsqave_new = qave.COMMIT WORK.MESSAGE s101(qa) WITH qals-prueflos.CALL FUNCTION 'DEQUEUE_EQQALS1'EXPORTINGprueflos = prueflos.
ENDFORM.                    "qals_aendern
*----------------------------------------------------------------------*
*       Form  STATUS_FIX_SETZEN
*----------------------------------------------------------------------*
*   Setzen eines Status aufgrund von Voreinstellungen wie QMAT etc.    *
*----------------------------------------------------------------------*
*  -->  STATUS    Status der gesetzt werden soll
*  -->  AKTIV     Status wird aktiviert sonst deaktiviert
*----------------------------------------------------------------------*
FORM status_fix_setzen USINGVALUE(status) LIKE tj02-istatVALUE(aktiv) LIKE c_kreuz.
* lokale Tabelle fuer StatusfortschreibungDATA: BEGIN OF l_stattab OCCURS 0.INCLUDE STRUCTURE jstat.DATA  END OF l_stattab.
*
* Falls Objektnr. nicht gef黮lt. --> Fehlermeldung !!!IF qals-objnr EQ space.MESSAGE e013(qv).
*   Fehlende Objektnr.: Problem f script>document.write('\r\n');ENDIF.MOVE status TO l_stattab-stat.IF aktiv EQ space.MOVE c_kreuz TO l_stattab-inact.ENDIF.
*APPEND l_stattab.
*CALL FUNCTION 'STATUS_CHANGE_INTERN'EXPORTINGcheck_only = spaceobjnr      = qals-objnrTABLESstatus     = l_stattab.ENDFORM.                               " STATUS_FIX_SETZEN

把非限定性库存转质检库存代码如下:


*&---------------------------------------------------------------------*
*& Report  ZRQEVAC50
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zrqevac50 MESSAGE-ID qa.TYPES:t_mkpf_tab LIKE mkpf  OCCURS 0,t_mseg_tab LIKE mseg  OCCURS 0.PARAMETERS:prueflos LIKE qals-prueflos OBLIGATORY MEMORY ID qls.DATA:g_msgv1       LIKE sy-msgv1,g_qals        LIKE qals,g_qals_leiste LIKE qals,g_qamb_tab    TYPE qambtab,g_qamb_vb_tab TYPE qambtab,g_mkpf_tab    TYPE t_mkpf_tab,g_mseg_tab    TYPE t_mseg_tab,g_subrc       LIKE sy-subrc.START-OF-SELECTION.PERFORM enqueue_qals USING prueflosg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM read_qals USING prueflosg_qalsg_qals_leisteg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID 'QA' TYPE 'S' NUMBER '102'WITH prueflos.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM check_lot USING g_qalsg_subrc.IF NOT g_subrc IS INITIAL.CASE g_subrc.WHEN 256.g_msgv1 = 'Lot & does not refer to a material doc'.WHEN 128.g_msgv1 = 'Material & is serialized'.REPLACE '&' WITH g_qals-matnr INTO g_msgv1.WHEN  64.g_msgv1 = 'Lot & is not stock relevant'.WHEN  32.g_msgv1 = 'Lot &: No stock transferred'.WHEN  16.g_msgv1 = 'Lot & is cancelled'.WHEN   8.g_msgv1 = 'Lot & is archived'.WHEN   4.g_msgv1 = 'Lot & is blocked'.WHEN   2.g_msgv1 = 'Lot & is HU managed'.ENDCASE.REPLACE '&' WITH prueflos INTO g_msgv1.MESSAGE ID '00' TYPE 'S' NUMBER '208'WITH g_msgv1.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM read_qamb USING g_qalsg_qamb_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID 'QA' TYPE 'S' NUMBER '068'WITH prueflos.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM read_mkpf USING g_qamb_tabg_mkpf_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM check_mkpf USING g_mkpf_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID 'QA' TYPE 'S' NUMBER '068'WITH prueflos.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM read_mseg USING g_mkpf_tabg_mseg_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM check_mseg USING g_mseg_tabg_qamb_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID 'QA' TYPE 'S' NUMBER '068'WITH prueflos.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM create_goods_movement USING g_qalsg_mseg_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID 'QA' TYPE 'S' NUMBER '068'WITH prueflos.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.PERFORM post_goods_movement.PERFORM post_data USING g_qalsg_qals_leisteg_qamb_tabg_qamb_vb_tabg_subrc.IF NOT g_subrc IS INITIAL.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ELSE.COMMIT WORK AND WAIT.g_msgv1 = 'inspection lot &'.REPLACE '&' WITH prueflos INTO g_msgv1.MESSAGE ID '00' TYPE 'S' NUMBER '368'WITH 'Stock posting reversed for ' g_msgv1.
*    SUBMIT (SY-REPID) VIA SELECTION-SCREEN.ENDIF.*----------------------------------------------------------------------*
*       Form  ENQUEUE_QALS                                             *
*----------------------------------------------------------------------*
*       Los sperren                                                    *
*----------------------------------------------------------------------*
FORM enqueue_qals USING p_prueflos LIKE qals-prueflosp_subrc    LIKE sy-subrc.CLEAR: p_subrc.CALL FUNCTION 'ENQUEUE_EQQALS1'EXPORTINGprueflos       = p_prueflosEXCEPTIONSforeign_lock   = 1system_failure = 2OTHERS         = 3.p_subrc = sy-subrc.ENDFORM.                               " ENQUEUE_QALS*----------------------------------------------------------------------*
*       Form  READ_QALS                                                *
*----------------------------------------------------------------------*
*       Pr黤los lesen                                                  *
*----------------------------------------------------------------------*
FORM read_qals USING p_prueflos    LIKE qals-prueflosp_qals        LIKE qalsp_qals_leiste LIKE qalsp_subrc       LIKE sy-subrc.CLEAR: p_subrc.CALL FUNCTION 'QPSE_LOT_READ'EXPORTINGi_prueflos  = p_prueflosi_reset_lot = 'X'IMPORTINGe_qals      = p_qalsEXCEPTIONSno_lot      = 1.p_subrc = sy-subrc.IF p_subrc IS INITIAL.p_qals_leiste = p_qals.ELSE.CLEAR: p_qals,p_qals_leiste.ENDIF.ENDFORM.                               " READ_QALS*----------------------------------------------------------------------*
*       Form  CHECK_LOT                                                *
*----------------------------------------------------------------------*
*       Pr黤los pr黤en                                                 *
*----------------------------------------------------------------------*
FORM check_lot USING p_qals  LIKE qalsp_subrc LIKE sy-subrc.DATA:l_stat     LIKE jstat,l_stat_tab LIKE jstat OCCURS 0 WITH HEADER LINE.p_subrc = 256.*/No reference to material documentIF p_qals-zeile IS INITIAL.EXIT.ELSE.p_subrc = 128.ENDIF.*/Serialized MaterialIF NOT p_qals-sernp IS INITIAL.EXIT.ELSE.p_subrc = 64.ENDIF.*/BERFCALL FUNCTION 'STATUS_CHECK'EXPORTINGobjnr             = p_qals-objnrstatus            = 'I0203'EXCEPTIONSstatus_not_active = 2.IF NOT sy-subrc IS INITIAL.EXIT.ELSE.p_subrc = 32.ENDIF.*/BTEI & BENDCLEAR l_stat. CLEAR l_stat_tab. REFRESH l_stat_tab.l_stat-stat = 'I0219'. APPEND l_stat TO l_stat_tab. "BTEIl_stat-stat = 'I0220'. APPEND l_stat TO l_stat_tab. "BENDCALL FUNCTION 'STATUS_OBJECT_CHECK_MULTI'EXPORTINGobjnr        = p_qals-objnrTABLESstatus_check = l_stat_tab.IF l_stat_tab[] IS INITIAL.EXIT.ELSE.p_subrc = 16.ENDIF.*/LSTO & LSTVCLEAR l_stat. CLEAR l_stat_tab. REFRESH l_stat_tab.l_stat-stat = 'I0224'. APPEND l_stat TO l_stat_tab. "LSTOl_stat-stat = 'I0232'. APPEND l_stat TO l_stat_tab. "LSTVCALL FUNCTION 'STATUS_OBJECT_CHECK_MULTI'EXPORTINGobjnr        = p_qals-objnrTABLESstatus_check = l_stat_tab.IF NOT l_stat_tab[] IS INITIAL.EXIT.ELSE.p_subrc = 8.ENDIF.*/ARSP & ARCH & REO1 & REO2 & REO3CLEAR l_stat. CLEAR l_stat_tab. REFRESH l_stat_tab.l_stat-stat = 'I0225'. APPEND l_stat TO l_stat_tab. "ARSPl_stat-stat = 'I0226'. APPEND l_stat TO l_stat_tab. "ARCHl_stat-stat = 'I0227'. APPEND l_stat TO l_stat_tab.       "REO3l_stat-stat = 'I0228'. APPEND l_stat TO l_stat_tab.       "REO2l_stat-stat = 'I0229'. APPEND l_stat TO l_stat_tab.       "REO1CALL FUNCTION 'STATUS_OBJECT_CHECK_MULTI'EXPORTINGobjnr        = p_qals-objnrTABLESstatus_check = l_stat_tab.IF NOT l_stat_tab[] IS INITIAL.EXIT.ELSE.p_subrc = 4.ENDIF.*/SPERCALL FUNCTION 'STATUS_CHECK'EXPORTINGobjnr             = p_qals-objnrstatus            = 'I0043'EXCEPTIONSstatus_not_active = 2.IF sy-subrc IS INITIAL.EXIT.ELSE.p_subrc = 2.ENDIF.*/HUMCALL FUNCTION 'STATUS_CHECK'EXPORTINGobjnr             = p_qals-objnrstatus            = 'I0443'EXCEPTIONSstatus_not_active = 2.IF sy-subrc IS INITIAL.EXIT.ELSE.p_subrc = 0.ENDIF.ENDFORM.                               " CHECK_LOT*----------------------------------------------------------------------*
*       Form  READ_QAMB                                                *
*----------------------------------------------------------------------*
*       QAMBs lesen                                                    *
*----------------------------------------------------------------------*
FORM read_qamb USING p_qals     LIKE qalsp_qamb_tab TYPE qambtabp_subrc    LIKE sy-subrc.CLEAR: p_subrc.SELECT * FROM qamb INTO TABLE p_qamb_tabWHERE prueflos =  p_qals-prueflosAND typ   = '3'.p_subrc = sy-subrc.ENDFORM.                               " READ_QAMB*----------------------------------------------------------------------*
*       Form  READ_MKPF                                                *
*----------------------------------------------------------------------*
*       Read material document header                                  *
*----------------------------------------------------------------------*
FORM read_mkpf USING p_qamb_tab TYPE qambtabp_mkpf_tab TYPE t_mkpf_tabp_subrc    LIKE sy-subrc.DATA:BEGIN OF l_mkpf_key_tab OCCURS 0,mblnr LIKE mkpf-mblnr,mjahr LIKE mkpf-mjahr,END   OF l_mkpf_key_tab.DATA:l_qamb  LIKE qamb,l_mkpf  LIKE mkpf,l_trtyp LIKE t158-trtyp VALUE 'A',l_vgart LIKE t158-vgart VALUE 'WQ',l_xexit LIKE qm00-qkz.p_subrc = 4.LOOP AT p_qamb_tab INTO l_qamb.l_mkpf_key_tab-mblnr = l_qamb-mblnr.l_mkpf_key_tab-mjahr = l_qamb-mjahr.COLLECT l_mkpf_key_tab.ENDLOOP.LOOP AT l_mkpf_key_tab.CALL FUNCTION 'ENQUEUE_EMMKPF'EXPORTINGmblnr          = l_mkpf_key_tab-mblnrmjahr          = l_mkpf_key_tab-mjahrEXCEPTIONSforeign_lock   = 1system_failure = 2OTHERS         = 3.IF NOT sy-subrc IS INITIAL.l_xexit = 'X'.EXIT.ENDIF.CLEAR: l_mkpf.CALL FUNCTION 'MB_READ_MATERIAL_HEADER'EXPORTINGmblnr         = l_mkpf_key_tab-mblnrmjahr         = l_mkpf_key_tab-mjahrtrtyp         = l_trtypvgart         = l_vgartIMPORTINGkopf          = l_mkpfEXCEPTIONSerror_message = 1.IF NOT sy-subrc IS INITIAL.l_xexit = 'X'.EXIT.ELSE.APPEND l_mkpf TO p_mkpf_tab.ENDIF.ENDLOOP.IF NOT l_xexit IS INITIAL.EXIT.ELSE.p_subrc = 0.ENDIF.ENDFORM.                               " READ_MKPF*----------------------------------------------------------------------*
*       Form  READ_MSEG                                                *
*----------------------------------------------------------------------*
*       MSEGs lesen                                                    *
*----------------------------------------------------------------------*
FORM read_mseg USING p_mkpf_tab TYPE t_mkpf_tabp_mseg_tab TYPE t_mseg_tabp_subrc    LIKE sy-subrc.DATA:l_mkpf     LIKE mkpf,l_mseg_tab LIKE mseg OCCURS 0 WITH HEADER LINE,l_trtyp    LIKE t158-trtyp VALUE 'A',l_xexit    LIKE qm00-qkz.p_subrc = 4.LOOP AT p_mkpf_tab INTO l_mkpf.CLEAR: l_mseg_tab. REFRESH: l_mseg_tab.CALL FUNCTION 'MB_READ_MATERIAL_POSITION'EXPORTINGmblnr         = l_mkpf-mblnrmjahr         = l_mkpf-mjahrtrtyp         = l_trtyp
*/            ZEILB  = P_ZEILE
*/            ZEILE  = P_ZEILETABLESseqtab        = l_mseg_tabEXCEPTIONSerror_message = 1.IF NOT sy-subrc IS INITIAL.l_xexit = 'X'.EXIT.ELSE.APPEND LINES OF l_mseg_tab TO p_mseg_tab.ENDIF.ENDLOOP.IF NOT l_xexit IS INITIAL.EXIT.ELSE.
*/  XAuto-Zeilen und Chargenzustands鋘derung werden gel鰏chtDELETE p_mseg_tab WHERE xauto NE spaceOR bwart EQ '341'OR bwart EQ '342'.p_subrc = 0.ENDIF.ENDFORM.                               " READ_MSEG*----------------------------------------------------------------------*
*       Form  CREATE_GOODS_MOVEMENT                                    *
*----------------------------------------------------------------------*
*       Warenbewegung anlegen                                          *
*----------------------------------------------------------------------*
FORM create_goods_movement USING p_qals     LIKE qalsp_mseg_tab TYPE t_mseg_tabp_subrc    LIKE sy-subrc.DATA:l_lmengezub LIKE qals-lmengezub,l_lmengegeb LIKE qals-lmengezub,l_mbqss     LIKE mbqss,l_imkpf     LIKE imkpf,l_imseg     LIKE imseg,l_imseg_tab LIKE imseg OCCURS 1,l_emkpf     LIKE emkpf,l_emseg     LIKE emseg,l_emseg_tab LIKE emseg OCCURS 1,l_mseg      LIKE mseg,l_mseg_tab  LIKE mseg  OCCURS 1,l_tcode     LIKE sy-tcode VALUE 'QA11',l_tabix     LIKE sy-tabix VALUE 1,l_xstbw     LIKE t156-xstbw.CLEAR: p_subrc.*/QAMB initialisierenCALL FUNCTION 'QAMB_REFRESH_DATA'.*/Kopf f黮lenl_imkpf-bldat = sy-datlo.l_imkpf-budat = sy-datlo.l_imkpf-bktxt = 'Cancellation of QM UD postings'.*/Urspr黱gliche zu buchende Menge merken + inkrementierenl_lmengezub = p_qals-lmengezub.l_lmengegeb =   p_qals-lmenge01+ p_qals-lmenge02+ p_qals-lmenge03+ p_qals-lmenge04+ p_qals-lmenge05+ p_qals-lmenge06+ p_qals-lmenge07+ p_qals-lmenge08+ p_qals-lmenge09.*/Zeilen aufbauenl_mseg_tab[] = p_mseg_tab[].LOOP AT l_mseg_tab INTO l_mseg.MOVE-CORRESPONDING l_mseg  TO l_mbqss.MOVE-CORRESPONDING l_mbqss TO l_imseg.
*/  Referenzbeleg 黚ergeben, falls Bestellnummer gef黮ltIF NOT l_mseg-ebeln IS INITIAL.MOVE: l_mseg-lfbnr TO l_imseg-lfbnr,l_mseg-lfbja TO l_imseg-lfbja,l_mseg-lfpos TO l_imseg-lfpos.ENDIF.MOVE l_mseg-kdauf          TO l_imseg-kdauf.MOVE l_mseg-kdpos          TO l_imseg-kdpos.MOVE l_mseg-ps_psp_pnr     TO l_imseg-ps_psp_pnr.*/  Umlagerungsfelder setzenMOVE:l_mseg-ummat  TO l_imseg-ummat,l_mseg-umwrk  TO l_imseg-umwrk,l_mseg-umlgo  TO l_imseg-umlgo,l_mseg-umcha  TO l_imseg-umcha.*/  Storno-Beleg setzenMOVE: l_mseg-mjahr  TO l_imseg-sjahr,l_mseg-mblnr  TO l_imseg-smbln,l_mseg-zeile  TO l_imseg-smblp.*/  Falsch gef黮lte Felder initialisierenCLEAR: l_imseg-mblnr,l_imseg-menge,l_imseg-meins.*/  Bewegungsart lesenSELECT SINGLE xstbw FROM t156 INTO l_xstbwWHERE bwart = l_imseg-bwart.IF NOT sy-subrc IS INITIAL.p_subrc = 4.EXIT.ENDIF.*/  Werk/Lagerort f黮lenIF p_qals-stat11 IS INITIAL.IF l_xstbw IS INITIAL.MOVE p_qals-lagortvorg TO l_imseg-lgort.ELSE.MOVE p_qals-lagortvorg TO l_imseg-umlgo.ENDIF.ENDIF.IF l_xstbw IS INITIAL.MOVE p_qals-werkvorg TO l_imseg-werks.ELSE.MOVE p_qals-werkvorg TO l_imseg-umwrk.ENDIF.*/  Zus鋞zliche FelderMOVE p_qals-mengeneinh TO l_imseg-erfme."MOVE P_GRUND           TO L_IMSEG-GRUND."MOVE P_ELIKZ           TO L_IMSEG-ELIKZ.
*/  Kennzeichen Storno-Buchung setzenMOVE 'X'               TO l_imseg-xstob.MOVE p_qals-prueflos   TO l_imseg-qplos.APPEND l_imseg TO l_imseg_tab.IF p_qals-stat11 IS INITIAL.ADD      l_imseg-erfmg TO   l_lmengezub.SUBTRACT l_imseg-erfmg FROM l_lmengegeb.ELSE.IF     l_imseg-kzbew EQ spaceAND l_imseg-werks NE spaceAND l_imseg-lgort NE spaceAND l_imseg-umwrk NE spaceAND l_imseg-umlgo NE spaceAND l_imseg-werks EQ l_imseg-umwrkAND l_imseg-umlgo EQ l_imseg-umlgo.
*/      Dummy Buchung bei WE-Sperrbestand & StichprobeELSE.ADD      l_imseg-erfmg TO   l_lmengezub.SUBTRACT l_imseg-erfmg FROM l_lmengegeb.ENDIF.ENDIF.ENDLOOP.IF NOT p_qals-stat11 IS INITIAL.
*/  Bei WE-Sperrbestand und Stichprobenbuchung Zeilen tauschenDO.READ TABLE l_imseg_tab INDEX sy-index INTO l_imseg.IF     sy-subrc      IS INITIALAND l_imseg-kzbew EQ spaceAND l_imseg-werks NE spaceAND l_imseg-lgort NE spaceAND l_imseg-umwrk NE spaceAND l_imseg-umlgo NE spaceAND l_imseg-werks EQ l_imseg-umwrkAND l_imseg-umlgo EQ l_imseg-umlgo.IF sy-tabix NE l_tabix.DELETE l_imseg_tab INDEX sy-tabix.INSERT l_imseg     INTO  l_imseg_tab INDEX l_tabix.l_tabix = l_tabix + 1.ELSE.l_tabix = l_tabix + 1.CONTINUE.ENDIF.ELSEIF sy-subrc IS INITIAL.CONTINUE.ELSE.EXIT.                          "from doENDIF.ENDDO.ENDIF.*/QM deaktivierenCALL FUNCTION 'QAAT_QM_ACTIVE_INACTIVE'EXPORTINGaktiv = space.
*/BuchenCALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'EXPORTINGimkpf = l_imkpfxallp = 'X'xallr = 'X'ctcod = l_tcodexqmcl = ' 'IMPORTINGemkpf = l_emkpfTABLESimseg = l_imseg_tabemseg = l_emseg_tab.
*/QM wieder aktivierenCALL FUNCTION 'QAAT_QM_ACTIVE_INACTIVE'EXPORTINGaktiv = 'X'.*/Buchung auswertenIF l_emkpf-subrc GT 1.IF l_emkpf-msgid NE space.
*/    Fehler auf KopfebeneMESSAGE ID l_emkpf-msgid TYPE 'S'NUMBER l_emkpf-msgnoWITH l_emkpf-msgv1 l_emkpf-msgv2l_emkpf-msgv3 l_emkpf-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ELSE.
*/    Fehler auf Zeilenebene (Ausgabe des ersten Fehlers)LOOP AT l_emseg_tab INTO l_emseg.IF l_emseg-msgid NE space.MESSAGE ID l_emseg-msgid TYPE 'S'NUMBER l_emseg-msgnoWITH l_emseg-msgv1 l_emseg-msgv2l_emseg-msgv3 l_emseg-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.ENDLOOP.ENDIF.ENDIF.LOOP AT l_emseg_tab INTO l_emseg.CALL FUNCTION 'QAMB_COLLECT_RECORD'EXPORTINGlotnumber   = p_qals-prueflosdocyear     = l_emkpf-mjahrdocnumber   = l_emkpf-mblnrdocposition = l_emseg-mblpotype        = '7'.ENDLOOP.*/Sonderkorrektur f黵 Frei-An-Frei & WE-Sperr-An-We-SperrIF NOT p_qals-stat11 IS INITIAL.IF p_qals-lmenge04 EQ l_lmengegeb.ADD      p_qals-lmenge04 TO   l_lmengezub.SUBTRACT p_qals-lmenge04 FROM l_lmengegeb.ENDIF.ELSEIF p_qals-insmk IS INITIAL.IF         p_qals-lmenge01 GE l_lmengegebAND NOT p_qals-lmenge01 IS INITIAL.ADD      l_lmengegeb     TO   l_lmengezub.SUBTRACT l_lmengegeb     FROM l_lmengegeb.ENDIF.ENDIF.CLEAR: p_qals-stat34,p_qals-matnrneu,p_qals-chargneu,p_qals-lmenge01,p_qals-lmenge02,p_qals-lmenge03,p_qals-lmenge04,p_qals-lmenge05,p_qals-lmenge06,p_qals-lmenge07,p_qals-lmenge08,p_qals-lmenge09.p_qals-lmengezub = l_lmengezub.IF NOT l_lmengegeb IS INITIAL.p_subrc = 4.ENDIF.ENDFORM.                               " CREATE_GOODS_MOVEMENT*----------------------------------------------------------------------*
*       Form  POST_GOODS_MOVEMENT                                      *
*----------------------------------------------------------------------*
*       Warenbewegung buchen                                           *
*----------------------------------------------------------------------*
FORM post_goods_movement.CALL FUNCTION 'MB_POST_GOODS_MOVEMENT'.ENDFORM.                               " POST_GOODS_MOVEMENT*----------------------------------------------------------------------*
*       Form  POST_DATA                                                *
*----------------------------------------------------------------------*
*       QM-Daten verbuchen                                             *
*----------------------------------------------------------------------*
FORM post_data USING p_qals        LIKE qalsp_qals_leiste LIKE qalsp_qamb_tab    TYPE qambtabp_qamb_vb_tab TYPE qambtabp_subrc       LIKE sy-subrc.DATA:l_stat     LIKE jstat,l_stat_tab LIKE jstat OCCURS 0,l_qamb     LIKE qamb,l_updkz    LIKE qalsvb-upsl VALUE 'U'.*/QAMBs umsetzen (7 = VE-Buchung storniert)LOOP AT p_qamb_tab INTO l_qamb.l_qamb-typ = '7'.APPEND l_qamb TO p_qamb_vb_tab.ENDLOOP.*/BERF & BTEI zur點knehmenCLEAR l_stat. CLEAR l_stat_tab.l_stat-inact = 'X'.l_stat-stat = 'I0219'. APPEND l_stat TO l_stat_tab. "BTEIl_stat-stat = 'I0220'. APPEND l_stat TO l_stat_tab. "BENDCALL FUNCTION 'STATUS_CHANGE_INTERN'EXPORTINGobjnr         = p_qals-objnrTABLESstatus        = l_stat_tabEXCEPTIONSerror_message = 1.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.SUBMIT (sy-repid) VIA SELECTION-SCREEN.ENDIF.*/Pr黤los aktualisierenCALL FUNCTION 'QPL1_UPDATE_MEMORY'EXPORTINGi_qals  = p_qalsi_updkz = l_updkz.CALL FUNCTION 'QPL1_INSPECTION_LOTS_POSTING'EXPORTINGi_mode = '1'.CALL FUNCTION 'STATUS_UPDATE_ON_COMMIT'.*/QAMB initialisierenCALL FUNCTION 'QAMB_REFRESH_DATA'.PERFORM update_qamb ON COMMIT.p_subrc = 0.ENDFORM.                               " POST_DATA*----------------------------------------------------------------------*
*       Form  UPDATE_QAMB                                              *
*----------------------------------------------------------------------*
*       Update auf QAMB                                                *
*----------------------------------------------------------------------*
FORM update_qamb.CALL FUNCTION 'QEVA_QAMB_CANCEL' IN UPDATE TASKEXPORTINGt_qamb_tab = g_qamb_vb_tab.ENDFORM.                               " UPDATE_QAMB*----------------------------------------------------------------------*
*       Form  CHECK_MSEG                                               *
*----------------------------------------------------------------------*
*       MSEGs pr黤en                                                   *
*----------------------------------------------------------------------*
FORM check_mseg USING p_mseg_tab TYPE t_mseg_tabp_qamb_tab TYPE qambtabp_subrc    LIKE sy-subrc.DATA:l_mseg_stor_tab LIKE mseg OCCURS 0 WITH HEADER LINE.CLEAR: p_subrc.*/Zeilen bereits storniert?SELECT mblnr mjahr zeile smbln sjahr smblpFROM mseg INTO CORRESPONDING FIELDS OF TABLE l_mseg_stor_tabFOR ALL ENTRIES IN p_mseg_tabWHERE smbln EQ p_mseg_tab-mblnrAND sjahr EQ p_mseg_tab-mjahrAND smblp EQ p_mseg_tab-zeile.IF sy-subrc IS INITIAL.LOOP AT l_mseg_stor_tab.DELETE p_mseg_tab WHERE     mblnr = l_mseg_stor_tab-smblnAND mjahr = l_mseg_stor_tab-sjahrAND zeile = l_mseg_stor_tab-smblp.DELETE p_qamb_tab WHERE     mblnr = l_mseg_stor_tab-smblnAND mjahr = l_mseg_stor_tab-sjahrAND zeile = l_mseg_stor_tab-smblp.ENDLOOP.IF p_mseg_tab[] IS INITIAL.p_subrc = 4.EXIT.ENDIF.ENDIF.ENDFORM.                               " CHECK_MSEG
*----------------------------------------------------------------------*
*       Form  CHECK_MKPF                                               *
*----------------------------------------------------------------------*
*       Materialbelege pr黤en (Wurde durch VE-Buchung Pr黤llos erzeugt?*
*----------------------------------------------------------------------*
FORM check_mkpf USING p_mkpf_tab TYPE t_mkpf_tabp_subrc    LIKE sy-subrc.DATA:l_mkpf_tab TYPE t_mkpf_tab.CLEAR: p_subrc.SELECT mblnr FROM qamb INTO CORRESPONDING FIELDS OF TABLE l_mkpf_tabFOR ALL ENTRIES IN p_mkpf_tabWHERE mblnr EQ p_mkpf_tab-mblnrAND mjahr EQ p_mkpf_tab-mjahrAND typ   = '1'.IF sy-subrc IS INITIAL.p_subrc = 4.ENDIF.ENDFORM.                               " CHECK_MKPF


http://www.ppmy.cn/news/806731.html

相关文章

什么是UID、UED、UXD、IXD、UCD、IAD,看这篇就足够了

文章目录 UID&#xff1a; User Interface Design 用户界面设计UI&#xff1a;User Interface&#xff08;用户界面&#xff09;UID&#xff08;用户界面设计师&#xff09;UID认知现状 UED&#xff1a; User Experience Design 用户体验设计UE or UX&#xff1a; User Experie…

滤波总结+应用举例1(kalman滤波、序贯滤波、UD分解滤波、遗忘滤波、信息滤波、自适应滤波)(内含matlab代码)

最近在研究滤波的相关知识&#xff0c;在此写个总结&#xff0c;以免自己遗忘。 卡尔曼滤波其实是一种估计方法&#xff0c;在已知前一时刻的状态量和当前时刻的量测情况下&#xff0c;估计当前状态量。 1、首先介绍常规kalman filter&#xff08;含详细代码及标注&#xff09;…

UUID?

通用唯一识别码&#xff08;英语&#xff1a;Universally Unique Identifier&#xff0c;缩写&#xff1a;UUID&#xff09;是用于计算机体系中以识别信息的一个128位标识符。 UUID按照标准方法生成时&#xff0c;在实际应用中具有唯一性&#xff0c;且不依赖中央机构的注册和分…

vue+Element 设置头部固定,并解决遮罩层显示问题

通过整体框架代码可以看到&#xff0c;其实element-ui已经实现了头部固定 找到这个fixedHeader&#xff0c;发现直接在全局设置文件里 这里如果设置为false&#xff0c;就表示头部不固定&#xff1b;改为true&#xff0c;则表示头部固定。 上述更改完后&#xff0c;就可以实…

UD三分区补充教程1——激活不同分区对于UD三分区bios启动和uefi启动兼容性影响的讨论

2015年08月01日 UD三分区补充教程1——激活不同分区对于UD三分区bios启动和uefi启动兼容性影响的讨论 UD三分区UD区ntfs数据区fat格式的高端efi 目前在测试UD三分区的过程中&#xff0c;特别是简化型三分区&#xff08;UD区只放grldr&#xff0c;其它全放efi区&#xff09;&…

捷联惯导系统学习6.4(UD分解滤波 )

UD(unit upper traingular& diagonal factorization)分解滤波 UD(unit upper traingular& diagonal factorization)分解 P : n 阶 正 定 的 对 称 矩 阵 P:n阶正定的对称矩阵 P:n阶正定的对称矩阵 对矩阵P进行上三角-对角分解: U : 上 三 角 阵 U:上三角阵 U:上三角…

分别使用U+、B+、UD制作WinPE启动盘

同步在个人博客&#xff1a;https://www.zhyong.cn/posts/bb8d/ 最近看了女娲工坊的关于系统启动相关的视频&#xff0c;以及U盘启动制作的三种方式并进行了实践&#xff0c;学到了很多&#xff0c;在此记录。 什么是WinPE Windows预安装环境&#xff08;Microsoft Windows P…

SAP QM 取消UD方法

一、业务场景 1、 适用业务 通常检验批作完检验结果录入后,最后一步就是做UD判断,这一步的内容主要包括两方面:选定UD代码,表示检验将作如何的判定,如A表示接受,R表示拒绝,A1表示让步接受…&#xff1b;另外就是做库存转移&#xff0c;就是将检验状态的库存移为非限制状态的库…