‎2013 Apr 04 7:58 AM
Hi Gurus,
I am doing a project for Automated MIRO for this I am using the BAPI BAPI_INCOMINGINVOICE_CREATE, but in this BAPI does not do all the validations that MIRO does. For eg the error msg M8394 is displayed in MIRO but the same is not being checked in the BAPI & also the BAPI does not valiadate for duplicate invoice. Can anyone suggest any FM/BAPI that does all the validations of MIRO so that it can be used before creating the invoice.
Regards
Anil Malhotra
‎2013 Apr 04 8:24 AM
Hello,
As BAPI is not validating what MIRO does, You can go for BADI MRM_HEADER_CHECK to validate what MIRO does.
DATA: gt_errtab TYPE TABLE OF mrm_errprot,
gs_errtab TYPE mrm_errprot.
CONSTANTS: c_errprot(23) TYPE c VALUE '(SAPLMRMF)TAB_ERRPROT[]'.
FIELD-SYMBOLS: <fs_errprotj_dt> TYPE table.
ASSIGN (c_errprot) TO <fs_errprotj_dt>.
REFRESH gt_errtab[].
gt_errtab[] = <fs_errprotj_dt>[].
IF NOT gt_errtab[] IS INITIAL.
READ TABLE gt_errtab INTO gs_errtab WITH KEY msgty = 'E'.
IF sy-subrc = 0.
DATA: c_okqx(17) TYPE c VALUE '(SAPLMR1M)OK-CODE'.
FIELD-SYMBOLS: <fs_okqx> TYPE ANY.
ASSIGN (c_okqx) TO <fs_okqx>.
CASE <fs_okqx>.
WHEN 'BU'. "POST
* This is optional: you can either search for a particular message or
* do not allow any error message
* Here search for the message triggered in badi INVOICE UPDATE
READ TABLE gt_errtab INTO gs_errtab WITH KEY msgty = 'E'
msgid = 'ZXX' msgno = '030'.
IF sy-subrc = 0.
CLEAR <fs_okqx>.
MESSAGE s030(zxx). "While errors exist document will not be posted
ENDIF.
ENDCASE.
ENDIF.
ENDIF.
Thanks,
Abhijit
‎2013 Apr 04 9:23 AM
Hi Abhijit,
Thanks for your fast reply. Does this FM also check the item validations.
Regards
Anil Malhotra
‎2013 Apr 04 12:07 PM
‎2013 Apr 04 12:39 PM
Hi,
https://scn.sap.com/thread/1355935
The thread copied/pasted refers to a very specific question.
MRM_HEADER_CHECK seems to be used for Header checks.
The OP was asking for validations (Header/item) and particularly for duplicate invoice check.
Best regards.
‎2013 Apr 04 1:28 PM
Hi Pablo,
Yes it is copied from existing thread.
Anil is asking for validations in MIRO. So, i copied it to make him understand. Will you please let me know did i made any mistake?
Thanks,
Abhijit