Professional Documents
Culture Documents
CORRECCIN:
SAP Note
Header Data
Symptom
Due to several program errors, the invoice verification documents are sometimes created
without
follow-up documents in accounting or they are created without an entry in the purchase
order history
(see the 'Related notes' section).
Report ZREPMIR7 determines these incorrect documents.
If you set the indicator 'P_UPDATE' to 'X', the report changes the status of the selected
incorrect
documents to 'on hold'. Afterwards, you can use the standard transactions to either delete
or
continue processing the changed documents.
The report does not process posted documents if you have aggregated purchase order history
records.
If this is the case, you must cancel the aggregation of the documents in question and then
run the
report again.
Older versions of this report incorrectly tell you that purchase order history records are
missing
when you aggregate the purchase order history records. This problem has been corrected in
the newer
versions of the report. The report now tells you when the purchase order history record for
a
document has been aggregated.
Ensure that your system contains the latest version of the report.
If you cannot repair an invoice document because the purchase order history is aggregated,
you must
cancel the aggregation temporarily.
To do this, proceed as follows:
Call transaction ME87 -> Make your entries -> Choose "Execute" (F8) -> Select the
aggregated record
-> Choose "Edit" -> Choose "Save disaggregation".
If several documents are aggregated, use the report Z_EKBEAUFL from Note 574494 to speed up
this
process.
Once you have repaired the incoming invoice, you can aggregate the purchase order history
again.
Other Terms
MIR7, RBSTAT, ME809, ME_UPDATE_INVOICE, MIR4, ME87, RM06EKBE
Validity
Correction Instructions
References
This document refers to:
SAP Notes
REPORTE ZREPMIR7:
REPORT ZREPMIR7
Delta001
Print
Context Block
Delete Block
Insert Block
*&---------------------------------------------------------------------*
*& *
*& Report ZREPMIR7 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*& *
*&---------------------------------------------------------------------*
* Change history
* 15.02.01: Version 0, Responsible: KlMe -> EnGe, note 382797
* 12.12.02: Version 1, Changed by : SvSi, add document summarization
* 02.04.03: Version 2, Changed by : EnGe, insert c_rbstat_rele_pa
* 13.01.04: Version 3, Changed by : SvSi, no PO check for zerolines
* 07.12.04: Version 4, Changed by : InTo, add case RBKP_BLOCKED
* 10.11.07: Version 5, Changed by : InTo, delete MLBE/MLBECR if ML is
* active
* 04.07.08: Version 6, Changed by : InTo, added posting date as
* selection criteria
* 21.09.09: Version 7, Changed by : PhGr, added c_rbstat_rele_pa
REPORT zrepmir7.
TABLES: rbkp.
SELECT-OPTIONS:
so_belnr FOR rbkp-belnr,
so_gjahr FOR rbkp-gjahr,
so_bukrs FOR rbkp-bukrs,
so_budat FOR rbkp-budat.
IF sy-saprl GE '46C'.
PARAMETERS: p_update TYPE c.
TYPES: BEGIN OF header,
belnr TYPE belnr_d,
gjahr TYPE gjahr,
rbstat TYPE rbstat,
x_no_po TYPE c, " no PO history
x_no_fi TYPE c, " no FI follow-on docs
x_ml_active TYPE c,
x_no_po_ml TYPE c, " no PO history ML side
END OF t_bwkey.
DATA: tab_rbkp TYPE TABLE OF rbkp,
tab_rbkp_blocked TYPE TABLE OF rbkp_blocked,
tab_rbkp_blocked_delete TYPE TABLE OF rbkp_blocked,
tab_rseg TYPE TABLE OF rseg,
tab_rbco TYPE TABLE OF rbco,
tab_ekbe TYPE TABLE OF ekbe,
tab_ekbz TYPE TABLE OF ekbz,
tab_bkpf TYPE TABLE OF bkpf,
tab_header TYPE TABLE OF header,
tab_ekbeh TYPE TABLE OF ekbeh,
tab_ekbzh TYPE TABLE OF ekbzh,
tab_mlwere TYPE TABLE OF mlwere,
tab_mlbe TYPE TABLE OF mlbe,
tab_mlbe_delete TYPE TABLE OF mlbe,
tab_mlbecr TYPE TABLE OF mlbecr,
tab_mlbecr_delete TYPE TABLE OF mlbecr.
DATA: s_rbkp TYPE rbkp,
s_rbkp_blocked TYPE rbkp_blocked,
s_rbkpb TYPE rbkpb,
s_rseg TYPE rseg,
s_rbco TYPE rbco,
s_ekbe TYPE ekbe,
s_ekbz TYPE ekbz,
s_bkpf TYPE bkpf,
s_header TYPE header,
s_ekbeh TYPE ekbeh,
s_ekbzh TYPE ekbzh,
s_mlwere TYPE mlwere,
s_mlbe TYPE mlbe,
s_mlbecr TYPE mlbecr.
DATA: f_lines_rbkp TYPE i,
f_lines_rseg TYPE i,
f_lines_delete TYPE i,
f_lines_mlwere TYPE i,
f_mlbe_delete TYPE i,
f_mlbecr_delete TYPE i,
f_awkey TYPE awkey,
f_new_rbstat TYPE rbstat,
f_no_po_item_expected TYPE c,
f_do_not_check TYPE c.
DATA: c_ivtyp_dialog TYPE ivtyp VALUE ' ',
c_rbstat_parked TYPE rbstat VALUE 'A',
c_rbstat_comple TYPE rbstat VALUE 'B',
s_header-x_doc_sum = 'X'.
ELSE.
READ TABLE tab_ekbzh INTO s_ekbzh WITH KEY
gjahr = s_rbkp-gjahr
belnr = s_rbkp-belnr
BINARY SEARCH.
IF sy-subrc EQ 0.
* ... Document summarization in EKBZH
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_doc_sum = 'X'.
ENDIF.
ENDIF.
* 2. PO history existing?
IF s_header-x_doc_sum IS INITIAL.
CLEAR s_ekbe.
CLEAR s_ekbz.
* Is there at least one EKBE/EKBZ entry for this invoice?
* Normally it is enough to check one entry: update is done
* for all entries or for none entry
READ TABLE tab_ekbe INTO s_ekbe WITH KEY
gjahr = s_rbkp-gjahr
belnr = s_rbkp-belnr
BINARY SEARCH.
IF sy-subrc NE 0.
READ TABLE tab_ekbz INTO s_ekbz WITH KEY
gjahr = s_rbkp-gjahr
belnr = s_rbkp-belnr
BINARY SEARCH.
IF sy-subrc NE 0.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_no_po = 'X'.
ENDIF.
ENDIF.
ENDIF.
* 3. EKBE/EKBZ exist: PO history of ML existing?
PERFORM existence_ml_po_history.
ENDIF.
CLEAR f_do_not_check.
IF sy-subrc <> 0.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_no_fi = 'X'.
ENDIF.
ENDIF.
* 5. Entry in RBKP_BLOCKED existing?
IF s_header-x_no_fi = 'X'.
READ TABLE tab_rbkp_blocked INTO s_rbkp_blocked
WITH KEY gjahr = s_rbkp-gjahr
belnr = s_rbkp-belnr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_blocked_found = 'X'.
ENDIF.
ENDIF.
IF NOT s_header IS INITIAL.
APPEND s_header TO tab_header.
ENDIF.
ENDLOOP.
* ML active?
IF NOT t_bwkey[] IS INITIAL.
LOOP AT tab_header INTO s_header.
READ TABLE tab_rseg INTO s_rseg WITH KEY
belnr = s_header-belnr
gjahr = s_header-gjahr.
* ML active for this plant?
READ TABLE t_bwkey WITH KEY bwkey = s_rseg-werks
BINARY SEARCH.
IF sy-subrc = 0.
s_header-x_ml_active = 'X'.
MODIFY tab_header FROM s_header.
ENDIF.
ENDLOOP.
ENDIF.
ebelp = s_ekbe-ebelp
zekkn = s_ekbe-zekkn
stunr = ' '
zaehk = ' '.
IF sy-subrc = 0.
READ TABLE tab_mlbe INTO s_mlbe WITH KEY
mlvnr = s_mlwere-mlvnr
gjahr = s_ekbe-gjahr
belnr = s_ekbe-belnr
buzei = s_ekbe-buzei.
IF sy-subrc NE 0.
READ TABLE tab_mlbecr INTO s_mlbecr WITH KEY
mlvnr = s_mlwere-mlvnr
gjahr = s_ekbe-gjahr
belnr = s_ekbe-belnr
buzei = s_ekbe-buzei.
IF sy-subrc NE 0.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_no_po_ml = 'X'.
ENDIF.
ENDIF.
ELSE.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_no_po_ml = 'X'.
ENDIF.
ELSEIF NOT s_ekbz IS INITIAL.
READ TABLE tab_mlwere INTO s_mlwere WITH KEY
ebeln = s_ekbz-ebeln
ebelp = s_ekbz-ebelp
stunr = s_ekbz-stunr
zaehk = s_ekbz-zaehk.
IF sy-subrc = 0.
READ TABLE tab_mlbe INTO s_mlbe WITH KEY
mlvnr = s_mlwere-mlvnr
gjahr = s_ekbz-gjahr
belnr = s_ekbz-belnr
buzei = s_ekbz-buzei.
IF sy-subrc NE 0.
READ TABLE tab_mlbecr INTO s_mlbecr WITH KEY
mlvnr = s_mlwere-mlvnr
gjahr = s_ekbz-gjahr
belnr = s_ekbz-belnr
buzei = s_ekbz-buzei.
IF sy-subrc NE 0.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_no_po_ml = 'X'.
ENDIF.
ENDIF.
ELSE.
MOVE-CORRESPONDING s_rbkp TO s_header.
s_header-x_no_po_ml = 'X'.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " existence_ml_po_history
*&---------------------------------------------------------------------*
*& Form ml_po_history_delete
*&---------------------------------------------------------------------*
* Deletes MLBE and MLBECR.
*----------------------------------------------------------------------*
FORM ml_po_history_delete.
REFRESH tab_mlbe_delete.
REFRESH tab_mlbecr_delete.
LOOP AT tab_rseg INTO s_rseg
WHERE belnr = s_header-belnr AND
gjahr = s_header-gjahr.
CLEAR s_ekbe.
IF s_rseg-exkbe = 'X'.
LOOP AT tab_ekbe INTO s_ekbe
WHERE ebeln = s_rseg-ebeln
AND ebelp = s_rseg-ebelp
AND ( vgabe = '2' OR
vgabe = '3' )
AND gjahr = s_rseg-gjahr
AND belnr = s_rseg-belnr
AND buzei = s_rseg-buzei.
READ TABLE tab_mlwere INTO s_mlwere WITH KEY
ebeln = s_ekbe-ebeln
ebelp = s_ekbe-ebelp
zekkn = s_ekbe-zekkn
stunr = ' '
zaehk = ' '.
IF sy-subrc = 0.
READ TABLE tab_mlbe INTO s_mlbe WITH KEY
mlvnr = s_mlwere-mlvnr
vgabe = s_ekbe-vgabe
gjahr = s_ekbe-gjahr
belnr = s_ekbe-belnr
buzei = s_ekbe-buzei.
IF sy-subrc = 0.
APPEND s_mlbe TO tab_mlbe_delete.
ENDIF.
CLEAR s_mlbecr.
LOOP AT tab_mlbecr INTO s_mlbecr
WHERE mlvnr = s_mlwere-mlvnr
AND vgabe = s_ekbe-vgabe
AND gjahr = s_ekbe-gjahr
AND belnr = s_ekbe-belnr
AND buzei = s_ekbe-buzei.
APPEND s_mlbecr TO tab_mlbecr_delete.
ENDLOOP.
ENDIF.
ENDLOOP.
ELSEIF s_rseg-xekbz = 'X'.
LOOP AT tab_ekbz INTO s_ekbz
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/corr_instr/correction...
29/04/2014
ENDFORM. " ml_po_history_delete
Print