Application Development and Automation 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: 

Error message in case of One time vendor in MIR7 and MIR4.

jaideepsharma
Active Contributor
0 Kudos
1,255

Hi,

We have a requirement where we need to give a warning message when an invoice document is parked in case if it is a One time vendor and bank details are missing. It should be an error message if user is trying to save it as completed or posting the document. We have already found a BADI INVOICE_UPDATE method CHANGE_AT_SAVE for giving error / warning message but we also want the same to be appeared in the popup coming when we press Messages button in MIR4 screen same way as standard messages are shown. I know that there is a table T_ERRPROT which need to be populated in order to show the messages in the popup window but could not find any appropriate user exit or badi to populate this table. Any suggestion or solutions are welcomed.

Thanks and Regards,

Jaideep,

1 ACCEPTED SOLUTION

former_member333737
Active Participant
0 Kudos
440

Hi,

Check this FM

DISPLAY MESSAGE TROUGH  CALL FUNCTION:-
       
   CALL FUNCTION 'MB_EDIT_MESSAGE'
         EXPORTING
           T1            = MR21HEAD-WERKS
           T2            = MBEW-BWTAR
           T3            = 'does not exist in table'
           T4            = 'MBEW'
*           T5            = ' '
*           T6            = ' '
*          T7            =
*           T8            = ' '
*           NOULINE       = ' '
         IMPORTING
           MESSAGE       = message_text.
        message id 'CKPRCH' type 'I' number '064'  with message_text.

Message class:  u2018CKRPCHu2019
Message number:  064
Message : Entry &1 &2 &3 &4 (check entry)

Regards,

Nikhil.

8 REPLIES 8

former_member182371
Active Contributor
0 Kudos
440

Hi,

check fm MRM_PROT_FILL

Best regards.

0 Kudos
440

Hi,

I know this fm but my question is how can we populate t_errprot parameter with our own error messages alongwith the one which system populates.

KR Jaideep,

0 Kudos
440

Hi,

you can populate t_errprot thus:


          DATA: gt_errtab    TYPE TABLE OF mrm_errprot,
                gs_errtab    TYPE mrm_errprot.

            CLEAR gs_errtab.
            gs_errtab-msgty = 'E'.
            gs_errtab-msgid = 'ZXX'.
            gs_errtab-msgno = '030'.
            gs_errtab-source = 'Q'.
            APPEND gs_errtab TO gt_errtab.

            CALL FUNCTION 'MRM_PROT_FILL'
              TABLES
                t_errprot = gt_errtab.

Best regards.

former_member333737
Active Participant
0 Kudos
441

Hi,

Check this FM

DISPLAY MESSAGE TROUGH  CALL FUNCTION:-
       
   CALL FUNCTION 'MB_EDIT_MESSAGE'
         EXPORTING
           T1            = MR21HEAD-WERKS
           T2            = MBEW-BWTAR
           T3            = 'does not exist in table'
           T4            = 'MBEW'
*           T5            = ' '
*           T6            = ' '
*          T7            =
*           T8            = ' '
*           NOULINE       = ' '
         IMPORTING
           MESSAGE       = message_text.
        message id 'CKPRCH' type 'I' number '064'  with message_text.

Message class:  u2018CKRPCHu2019
Message number:  064
Message : Entry &1 &2 &3 &4 (check entry)

Regards,

Nikhil.

0 Kudos
440

Hi,

Thanks alot for your replies. Now the error message is coming in the popup. But when I post the document then it gets posted. I want the document to be in parked status and not posted in case there are any error messages in the document.

KR Jaideep,

0 Kudos
440

Hi,

1.- Implement badi MRM_HEADER_CHECK

2.- in this badi do:


*----------------------------------------------------------------------*
* If there is any error do not allow posting
*----------------------------------------------------------------------*
    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.

Best regards.

Edited by: Pablo Casamayor on May 27, 2009 3:05 PM

jaideepsharma
Active Contributor
0 Kudos
440

Hi Pablo,

I am still having issues with the posting of document. When I am trying to post the document without bank details from transaction MIRO then system do not allow me to post the document as expected.

If I park the document and then open it using MIR4 and post it directly then system allow the posting of document even if the bank details are missing for one time vendor.

Please find the code below.

<< Please only post the relevant portions of the code >>

Edited by: Rob Burbank on Jun 2, 2009 11:25 AM

0 Kudos
440

Hi,

in badi HEADERDATA_CHECK you have available as input parameter I_RBKPV.

do something like:


*----------------------------------------------------------------------*
* If there is any error do not allow posting
*----------------------------------------------------------------------*
    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>[].

    DATA: c_okqx(17)   TYPE c VALUE '(SAPLMR1M)OK-CODE'.
    FIELD-SYMBOLS: <fs_okqx> TYPE ANY.
    ASSIGN (c_okqx) TO <fs_okqx>.
 
    IF NOT gt_errtab[] IS INITIAL.
      READ TABLE gt_errtab INTO gs_errtab WITH KEY msgty = 'E'.
      IF sy-subrc = 0.
        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.
 
  ELSE. "THIS IS THE NEW PART
   IF i_rbkpv-YOURBANKFIELD IS INITIAL. "This is the New part
        CASE <fs_okqx>.
          WHEN 'BU'. "POST
              CLEAR <fs_okqx>.
              MESSAGE s031(zxx). "Please fill in bank details
        ENDCASE.
   ENDIF.
  ENDIF.

Best regards.

Edited by: Pablo Casamayor on Jun 2, 2009 6:39 PM