Skip to Content
SAP ERP

The determination logic of 'valuation type' when using T-code MR8M

      When cancelling an Invoice document using T-code MR8M, and there is 'valuation type' assigned in the original
Invoice, system may issue error M8422 'Invoice document & cannot be processed further' if it cannot determine
'valuation type' for the cancellation document. So in this document,
I would like to share the logic about how
the 'valuation type' is determined in the cancellation document.

      Firstly system will clear the value of 't_bzt-bwtat' in the following coding, because the value will be copied from PO
item (ekpo-batwr) afterwards.


**************************************************

Main Program     SAPLEINR

Source code of   LEINRF0H

IF t_bzt-bwtar NE space.
  IF ekpo-webre EQ space.
hier kann die BWTAR immer aus der EKPO verwendet werden
-> sie wird hier gecleart, damit in XEK08BN_FUELLEN nicht nochmal
   die Position nachgelesen werden muß und damit beim RE nur genau
   eine Zeile vorgeschlagen wird
    CLEAR t_bzt-bwtar.          <<<<<<
   ENDIF.
ENDIF.

**************************************************


      Then in the second step, system will check the PO item and transfer the value of 'ekpo-batwr' to 't_bzt-
bwtat' in the following coding:


*****************************************

Main Program     SAPLEINR
Source code of   LEINRU08

   IF <ls_xek08bn>-bwtar EQ space.
     <ls_xek08bn>-bwtar = ekpo-bwtar. <<<<<<<

******************************************

      If there is no valuation type in PO item, 'ekpo-batwr' is blank, system will check table T149 for the default
value of valuation type. The corresponding coding is:

************************************************

IF ekpo-bwtty NE space.

    PERFORM bewertungstyp_lesen USING t001w-bwkey ekpo-bwtty

                                CHANGING lv_rc.           "978746

    IF lv_rc EQ 0.                                        "978746

      <ls_xek08bn>-vbwaf = t149-vbwaf.

      <ls_xek08bn>-kzvbf = t149-kzvbf.

      <ls_xek08bn>-kzbaa = t149-kzbaa.

      IF <ls_xek08bn>-bwtar EQ space.

        <ls_xek08bn>-bwtar = t149-vbwaf.

       ENDIF.

    ENDIF.

  ENDIF.

***********************************************

      When system cannot get 'valuation type' from all the steps above, because the inconsistency between the
cancellation document and original invoice document, error M8422 will be issued.


No comments