Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_INCOMINGINVOICE_CREATE Validations

Former Member
0 Kudos

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

5 REPLIES 5

Abhijit74
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Abhijit,

Thanks for your fast reply. Does this FM also check the item validations.

Regards

Anil Malhotra

Abhijit74
Active Contributor
0 Kudos

Hello Anil,

In BAPI i think it's not possible.

Thanks,

Abhijit

0 Kudos

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.

Abhijit74
Active Contributor
0 Kudos

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