cancel
Showing results for 
Search instead for 
Did you mean: 

BADI / MIRO postings

Former Member
0 Kudos

Hi all,

we wanna check the document type ( blart) regarding the MIRO type (rm08m-vorgang like 1= INVOICE, 2 = CREDIT, etc.).

I tried to use BADIs

IF_EX_MRM_TRANSACT_DEFAULT~TRANSACTION_DEFAULT_SET,

IF_EX_MRM_HEADER_DEFAULT~HEADER_DEFAULT_SET and

IF_EX_INVOICE_UPDATE~CHANGE_AT_SAVE.

The firts two Badi's are not useable, because they only are executed once at the beginning of MIRO.

IF_EX_INVOICE_UPDATE~CHANGE_AT_SAVE is not too bad, because it let me show an error message if the document type is not correct (see tab detail within MIRO).

But as described we wanna check the document type ( blart) regarding the MIRO type (rm08m-vorgang like 1= INVOICE, 2 = CREDIT, etc.) which is not known to INVOICE_UPDATE~CHANGE_AT_SAVE.

Actual coding in for example IF_EX_MRM_HEADER_DEFAULT~HEADER_DEFAULT_SET is:

...

case i_rbkpv-bukrs.

when'190'.

if i_rm08m-vorgang = '1' or i_rm08m-vorgang = '3'.

e_blart = 'FC'.

elseif i_rm08m-vorgang = '2' or i_rm08m-vorgang = '4'.

e_blart = 'NC'.

endif.

when

others.

if i_rm08m-vorgang = '1' or i_rm08m-vorgang = '3'.

e_blart = 'GI'.

else.

e_blart = 'GC'.

endif.

endcase.

...

Does anyone have an idea?

Thx a lot!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

thx for your response.

It just has structures MRM_RBKPV and MMCR_TDRSEG which do not include the variable "vorgang" (1=Invoice, 2=Credit, etc.), or?

Former Member
0 Kudos

Hi

Yes, your right, but u can use the BADI to set default values in order to export to memory the operation type and then u can import it where u need.

Max

former_member182371
Active Contributor
0 Kudos

Hi,

for "vorgang" try this in any of the badi´s suggested:


  CONSTANTS: c_vorgang(23) TYPE c VALUE '(SAPLMR1M)RM08M-VORGANG'.
  FIELD-SYMBOLS: <fs_vorgang> TYPE ANY.
  ASSIGN (c_vorgang) TO <fs_vorgang>.

 CASE <fs_vorgang>.
  WHEN '1'.
  WHEN '3'.
  WHEN OTHERS.
 ENDCASE.

.

Best regards.

Answers (4)

Answers (4)

Former Member
0 Kudos

One more question:

When I correct the error (wrong blart selected) within MIRO and do a simulation again, it will still show the previous message.

How can I delete that one so I'm able to post the invoice?

Former Member
0 Kudos

Ok,

had a look at your very helpful code:

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.

Tell me, what is the meaning of -> gs_errtab-source = 'Q'.

Can I add my own parameters to the error text?

Thx.

former_member182371
Active Contributor
0 Kudos

Hi,

1.- Tell me, what is the meaning of -> gs_errtab-source = 'Q'.

the values of gs_errtab-source an be found in include MRM_CONST_COMMON:


* Herkunft fuer Meldungsprotokoll
  c_source_assign TYPE c            VALUE 'A',   " Assign
  c_source_check  TYPE c            VALUE ' ',   " Check
  c_source_cond   TYPE c            VALUE 'C',   " Conditions
  c_source_merge  TYPE c            VALUE 'M',   " Merge
  c_source_post   TYPE c            VALUE 'P',   " Post
  c_source_posqu  TYPE c            VALUE '1',   " Position- quantity
  c_source_posam  TYPE c            VALUE '2',   " Position- amount
  c_source_posli  TYPE c            VALUE '3',   " Position- limit
  c_source_pospe  TYPE c            VALUE '4',   " Position- period
  c_source_posop  TYPE c            VALUE '5',   " Position- order price
  c_source_pos    TYPE c            VALUE '6',   " Position- sonstige
  c_source_posco  TYPE c            VALUE '7',   " POsition- Kontierung

i did this long ago and i believe is was due to the fact that when i simulated the error was cleared when i used gs_errtab-source = 'P' and using a new one caused no trouble.

2.- Can I add my own parameters to the error text?

Yes, you can so something like:


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

CLEAR gs_errtab.
gs_errtab-msgty = 'E'. "This can be W, A, E...etc
gs_errtab-msgid = 'ZXX'. "This is you message class (SE91)
gs_errtab-msgno = '030'. "This is your message number
gs_errtab-source = 'Q'.
APPEND gs_errtab TO gt_errtab.

CALL FUNCTION 'MRM_PROT_FILL'
TABLES
t_errprot = gt_errtab.

if you have a look at this:


TYPES: BEGIN OF mrm_errprot,
         msgty       LIKE sy-msgty,
         msgid       LIKE sy-msgid,
         msgno       LIKE sy-msgno,
         msgv1       LIKE sy-msgv1,
         msgv2       LIKE sy-msgv2,
         msgv3       LIKE sy-msgv3,
         msgv4       LIKE sy-msgv4,
         source      TYPE c,
         rblgp       LIKE drseg-rblgp,
         shown       LIKE boole-boole,
       END OF mrm_errprot.

you´ll see that you can use all this fields in order to display a message.

Best regards.

Edited by: Pablo Casamayor on Jul 22, 2009 8:42 AM

Former Member
0 Kudos

Hi Pablo

you're the man )

I did what you told me and it looks not too bad!

CONSTANTS: c_vorgang(23) TYPE c VALUE '(SAPLMR1M)RM08M-VORGANG'.

FIELD-SYMBOLS: <l_vorgang> TYPE ANY.

ASSIGN (c_vorgang) TO <l_vorgang>.

case S_RBKP_NEW-bukrs.

when '190'.

if ( <l_vorgang> = '1' or <l_vorgang> = '3' ) and S_RBKP_NEW-blart <> 'FC'.

" howto raise error ?

elseif ( <l_vorgang> = '2' or <l_vorgang> = '4' ) and S_RBKP_NEW-blart <> 'NC'.

" howto raise error ?

endif.

when

others.

if ( <l_vorgang> = '1' or <l_vorgang> = '3' ) and S_RBKP_NEW-blart <> 'GI'.

" howto raise error ?

elseif ( <l_vorgang> = '2' or <l_vorgang> = '4' ) and S_RBKP_NEW-blart <> 'GC'.

" howto raise error ?

endif.

endcase.

Do you know how to add or raise a message?

Thx a lot.

former_member182371
Active Contributor
0 Kudos

Hi,

check this thread:

Best regards.

Former Member
0 Kudos

Hi

Have you tried to use the BADI MRM_HEADER_CHECK?

Max