Tcode MIRO with BADI: MRM_HEADER_CHECK

Hi,
in MIRO i will use badi: MRM_HEADER_CHECK.
i implementedt it and use in method: IF_EX_MRM_HEADER_CHECK~HEADERDATA_CHECK
this code:
  DATA: GT_ERRPROT    TYPE TABLE OF MRM_ERRPROT,
        GS_ERRPROT    TYPE          MRM_ERRPROT.
  APPEND GS_ERRPROT TO GT_ERRPROT.
  IF NOT I_RBKPV-LIFNR IS INITIAL
     AND I_RBKPV-LANDL <> 'DE'
     AND I_RBKPV-LZBKZ IS INITIAL.
    CLEAR GS_ERRPROT.
    GS_ERRPROT-MSGTY = 'E'.
    GS_ERRPROT-MSGID = 'ZZ'.
    GS_ERRPROT-MSGNO = '010'.
    GS_ERRPROT-MSGV1 =
     'ERROR in LZB'.
    CALL FUNCTION 'MRM_PROT_FILL'
      TABLES
        T_ERRPROT = GT_ERRPROT.
  ENDIF.
In MIRO i get the message wich i need, but the user is able to save (post) in MIRO.
How can i avoid saving when i generate the above message?
thanks.
Regards, Dieter

Hi,
check this:
* If there is any error do not allow saving, 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 'COMP' OR 'BU'. "Saving as complete/Post
            READ TABLE gt_errtab INTO gs_errtab WITH KEY msgty = 'E'
            msgid = 'ZZ' msgno = '010'.
            IF sy-subrc = 0.
* delete the ok-code.
              CLEAR <fs_okqx>.
              MESSAGE s0XX(zxx). "Invoice still has error messages
            ENDIF.
        ENDCASE.
      ENDIF.
    ENDIF.
Something more: in your code you should clear the message if the condition is not met (that is, the user has done something in the transaction to correct the condition producing the message).
DATA: GT_ERRPROT    TYPE TABLE OF MRM_ERRPROT,
        GS_ERRPROT    TYPE          MRM_ERRPROT.
  APPEND GS_ERRPROT TO GT_ERRPROT.
  IF NOT I_RBKPV-LIFNR IS INITIAL
     AND I_RBKPV-LANDL  'DE'
     AND I_RBKPV-LZBKZ IS INITIAL.
    CLEAR GS_ERRPROT.
    GS_ERRPROT-MSGTY = 'E'.
    GS_ERRPROT-MSGID = 'ZZ'.
    GS_ERRPROT-MSGNO = '010'.
    GS_ERRPROT-MSGV1 =
     'ERROR in LZB'.
    CALL FUNCTION 'MRM_PROT_FILL'
      TABLES
        T_ERRPROT = GT_ERRPROT.
ELSE.
* This is the code added
    FIELD-SYMBOLS: <fs_errprot> TYPE table.
    ASSIGN (c_errprot) TO <fs_errprot>.
    REFRESH gt_errtab[].
    gt_errtab[] = <fs_errprot>[].
    LOOP AT gt_errtab INTO gs_errtab
    WHERE msgty = 'E'
    AND msgid = 'ZXX'
    AND msgno = '010'.
      DELETE gt_errtab INDEX sy-tabix.
    ENDLOOP.
    <fs_errprot>[] = gt_errtab[].
  ENDIF.
Best regards.
Edited by: Pablo Casamayor on Sep 14, 2009 12:55 PM

Similar Messages

  • MIRO badi MRM_HEADER_CHECK park/post control

    Hello friends,
    We have implemented MRM_HEADER_CHECK badi to check unplanned delivery cost, and used MRM_PROT_FILL fm to fill the errors.
    Everything going fine, but for this error message system should not allow to post document in MIRO, and it should only allow to part the document.
    Any expert ideas where and how do we control to not to allow posting the document, but only to allow to park if any failure in this badi?
    Thanks in advance.
    Manohar

    Check this thread in which Pablo Casamayor uses field symbol call stack technique (to retrieve values from main program memory) and use it to not allow saving in MIRO if there are still error messages.
    Another problem also may arise that even if user corrects the invoice document still custom message may still show in the message log, for that issue also the post by Pablo clarifies.
    [Pablo Casamayor's solution to MIRO messages problem with BADI: MRM_HEADER_CHECK |Tcode MIRO with BADI: MRM_HEADER_CHECK;

  • BADI MRM_HEADER_CHECK - Disable Tab in MIRO

    Hi all,
    I've been asked to disable the G/L tab in MIRO if a PO is entered. on the PO Tab.
    I've implemented the BADI MRM_HEADER_CHECK -  I can do a check and issue a warning message.
    However if I issue a Error meesage then It goes into an infinite loop.
    Is there and way I can stop processing on the message - to stop the transaction from completing the tab switch ?
    Or any other way of achieving the desired result if anyone can think of anything?
    Thanks in advance,
    D.

    Hi Guys,
    Thanks for the quick response !
    Sakthi Sri - I've already tried implementing the FM MRM_PROT_FILL
    But it doesn't stop the user from switching to the G/L tab,  it adds in the warning message but processing still continues
    and allows the user to carry on entering G/L Items.
    My Code so far is:
      DATA: lit_errtab    TYPE TABLE OF mrm_errprot,
            lwa_errtab    TYPE mrm_errprot.
    Declare the Contstants
      CONSTANTS: lc_Space    type CHAR01  VALUE '' ,
                 lc_X        type CHAR01  VALUE 'X',
                 c_ebeln(23) TYPE C       VALUE '(SAPLMR1M)RM08M-EBELN',
                 c_hkont(25) TYPE C       VALUE '(SAPLMR1M)ACGL_ITEM-HKONT',
    DATA: gt_errtab TYPE TABLE OF mrm_errprot,
    gs_errtab TYPE mrm_errprot.
    Field Symbols
      FIELD-SYMBOLS: <fs_ebeln> TYPE ANY,
                     <fs_hkont> TYPE ANY.
    Local Variables Set-up
      DATA:  lv_ERROR TYPE CHAR01.
      ASSIGN (c_ebeln)  TO <fs_ebeln>.
      ASSIGN (c_hkont)  TO <fs_hkont>.
    Clear the Error Flag
        lv_Error = lc_space.
    Only do this check when the Item tabs are selected.
      case sy-ucomm.
        when 'ITEMS_PO'.
          if <fs_hkont> is assigned.
            if <fs_hkont> is not initial.
              lv_Error =  lc_X.
            endif.
          endif.
        when 'ITEMS_G/L'.
          if <fs_ebeln> is assigned.
            if <fs_ebeln> is not initial.
              lv_Error =  lc_X.
            endif.
          endif.
      endcase.
    Error Detected raise an error message
      if lv_Error = lc_X.
    CLEAR gs_errtab.
    gs_errtab-msgty = 'E'.
    gs_errtab-msgid = 'Z31'.
    gs_errtab-msgno = '033'.
    gs_errtab-source = 'Q'.
    APPEND gs_errtab TO gt_errtab.
    CALL FUNCTION 'MRM_PROT_FILL'
    TABLES
    t_errprot = gt_errtab.
      endif.
    endmethod.

  • BADI FOR MIRO WITH FOREX POSTING

    Hi SAP team,
    While posting MM invoice through Miro transaction for PO with the account assignment K, we are getting Forex line for foreign exchange gain.
    So while posting we are getting cost center derived from the PO even to the Forex line.
    we would like to delete the cost center from the Forex line. kindly provide the BADI to avoid this.
    Regards
    Suni.

    Hi,
    try with badi MRM_HEADER_DEFAULT.
    Best regards.

  • Tcode FV60 with ECC 6.02 does not check duplicate invoices

    Hi,
    We use FV60 top enter all invoices.  We have config (under MM) for duplicate invoice check against company code and "ref field" only.  When we enter an invoice with the same ref field value, it gives error message as expected.  However, when we change the date, the error message is gone and we are allowed to create the invoice and post the invoice.  This is not desireable and behaves very differently than tcode MIRO. 
    Is there any solution to have tcode FV60 perform the same checks, look to the same config for duplicate invoices in SPRO as MIRO and not allow for invoice creation if the "ref field" is identical?

    Hi all,
    Any solution on this..  Even we have the same kind of issue in our organization.  I am also trying various ways.  Plz help me if anyone has found the solution for this.  If I get something, i will update.
    Regards

  • How to changes baseline date in miro with Posting date

    Please tell me the procedure to change the baseline date in miro with posting date (EKBE-BUdat) on basis of  Purchase order No (EBELN) .
    I tried it by using user exit :-EXIT_SAPLKONT_011  Enhancement : LMR1M002 but got stuck somewhere .Please tell me how to work on this .

    hey guys my problem is solved by using a badi  " MRM_PAYMENT_TERMS" .In method "PAYMENT_TERMS_SET" writing the code .

  • Post balance of invoice to asset via tcode Miro

    Hi ,
    We have a situation whereby we need to post the balance of  invoice to Asset and not GL in tcode MIRO.
    We have raised the  Invoice via tcode MIRO. The invoice amount is more than the  PO document (RE), therefore we have an outstanding balance and can't post the invoice. Typically we would select the GL tab  in tocde MIRO and post this balance to a GL account.  We now have a situation whereby we need to post to an asset account and do not have a tab available to do this via tcode MIRO. What we are looking for is a tcode similar to MIRO that incorporates tcode F-90  to allow post to asset.  Is this possible? Or please suggest an alternative method.
    Many thanks
    Alexsh

    Hi Jeyakanthan,
    There are a number of POs that we need to invoice with one invoice. Not all are fixed assets, some are going to GL and Internal orders. The balance relates to fixed assets so we need to know how to process the two transactions in one posting.
    Alexsh

  • Error while transporting infospoke with BADI in BW7.0

    Hi:
    We have an infospoke with Transformation ( ie with BADI) in BI7.0.
    While transporting to Quality box it gives error.
    "Transfer structure /BIC/CZZTXXXXX3 could not be generated
    Error when activating InfoSpoke ZTXXXXX3.
    Message no. RSOH010 "
    Could you please help in rectifying the error.
    PS: we tried transporting BADI first and then the infosoke but still its failing.
    Regards!
    Saniya

    Hi
    Check the forum link below
    Transport Problems with Spokes that have BADIs
    Thanks

  • How to restrict the quantity & rate of MIRO with MIGO and PO

    Hi friends,
    Can any body tell me how to restrict the quantity & rate of MIRO with MIGO and PO.
    e.g. if we have done MIGO for quantity 10 and the rate maintained in the PO is Rs.100.Then at the time of MIRO system should not allow to change the quantity and rate.
    How we can do this?
    Regards  
    Purnesh Sharma

    Hi,
    You are misunderstanding the use of MIRO.
    If you change the details in MIRO you are NOT changing anything. You are just entering the price and quantity from the Invoice.
    If this price and or qty is different from the GR aqty and PO price then the system will block the invoice for payment (and it can issue messages toinform the buyer if configured correctly).
    The whole design of MIRO is based on the principle that you enter EXACTLY what the vendor has put on the invoice. By preventing the users from changing anything you will get NO mismatched invoices, but you will not be paying the vendor the amount specified on their invoice. This will surely cause problems.
    If you do want to ensure that ONLY the GR qty and the PO price are used and cannot be changed then why not consider using ERS (Eveluated Receipt Settlement. this is basically self billing.
    Effectively you will be paying the vendor based on what you have received in MIGO multiplied by the price from the PO. (which is what you would be doing if you stop any changes in MIRO)
    Steve B

  • Invoice Verification - Tcode MIRO

    Hi, I would like to know if there is anyone who could help me on how to open the G/L field (HKONT) at Details tab in MIRO tcode to enable reconciliation accont changes during an Invoice Verification. In Brazilian Utilities Indutry Sector processes we legaly must have alternative reconciliation accounts for the same vendor.
    I've done a test enabling alternative reconciliation account in FI-GL and it works for the tcode FB60, opening automaticaly the field G/L at the Details tab allowing the user to change the account for an alternative one, but unfortunately for the tcode MIRO it simply doesn't works.
    I hope there is any MM configuration or enhancement which could enable this field.
    Thanks in advance,
    Daniel Damiani
    Business Senior Specialist at CSC

    Hi,
    It is not possible to explicitly change the account at the time an                
    invoice is posted through transaction MIRO, the way it is posible                 
    through FI. In MM, the accounts are automatically determined from the             
    customizing in transaction OMWB, or taken from the purchase order                 
    account assignment data.                                                                               
    You can also have a quick look in tr OMRMB, you will notice that field            
    INVFO-HKONT is not there to be customised.                                                                               
    There is no solution available within the SAP standard system for the             
    change of the reconciliation account for the vendor. Please check note            
    144081 for MIRO/MIR7 functions.                                                                               
    MM invoice verification was developed to finish the external procurement          
    process in logistics and check the invoice data sent by the vendors for           
    correctness (differences) and to post the corresponding accounting                
    document in FI additional.                                                                               
    Creating manually creditor invoices in FI have no relation to a logist            
    process. Therefore not all functions included in FI (FB60) are included           
    in MM invoice verification (MIRO) as well.                                                                               
    You can only change the reconciliation account via vendor master record:          
    Pls. choose "display vendor" in MIRO, than switch to the view accounting          
    information and change there the G/L account. This must be done by                
    every posting procedure and the change must be put back after booking             
    again.                                                                               
    Best regards
    Erika

  • MIRO with reference to MIGO number

    Hi All,
    I want to have MIRO with respect to MIGO Number.
    e.g
    PO QTY 1000
    GRN 1 -
    10 Qty
    GRN 2------5 Qty
    Required scenario:
    If we run MIRO then Qty would be 15 Qty
    We have a requirement that MIRO is done GRN wise.
    like  for MIGO # 1 -
    MIRO reflects 10 Qty
    for MIGO #2----
    MIRO reflects 5 qTY

    Hi ,
    In standard SAP it is not possible to select MIGO no to do MIRO .
    Only you can use the Delivary note no. as reference for doing MIRO .
    Else , purchase order is always taken as reference and non required line item is deselcted at the time of MIRO .
    So please check how best you can use the filed delivary note in MIGO for doing MIRO .
    Regards,
    Dewang T.

  • Log for changes done before posting LIV in Tcode MIRO

    Hi
    By default data will be fetched from PO/GR for LIV however our users are changing few details such as payment terms, tax code, vendor code, vendor invoice amount etc., before posting LIV in tcode MIRO. We don't have any log for these changes done by our users.
    We want to know what are fields which have been changed by our users at the time of doing LIV (i.e. before posting LIV).
    Can any one help us in this regard.
    Regards
    P Karthikeyan

    If you know those fields, you can find the differences for those field in table EKKO and EKPO for PO, the similar value will be available for IR in table RBKP and RSEG.
    Like as payment term, The payment term is saved in table RBKP - ZTERM for MIRO.
    The same will be available in table EKKO - ZTERM for PO.
    If the value for both fields are same, then user has not changed the field at the time of MIRO.
    If the value mismatched, then user has changes the value in MIRO.
    In this way, you can find the differences for other fields.

  • What causes ad-hoc to run with bad plan and its resolution

    One of our Company Application funcnalities uses the ad-hoc query that returns top first row from the result sets .There has been several times since this ad-hoc query ran with a bad
    execution in last 8 months .There is no specifice time and date or day when this query run with bad execution plan ,however whenever this query ran with a bad execution plan on SQL ,that happed always early in the morning , before 6am .The setting of database
    parameterization is set to forced .There is SQL maintenance reindexing job that runs each night at 2am that changes the recovedry model of our production database from Full to simple and changing back from simple to full after the reindexing operation .That
    causes the SQL plans to flush each night .The next day morning , when the application ad-hoc query runs on SQL first time , SQL generates a new plan for that query . Some strange reason , SQL genarates a good plan for that ad-hoc query most of the times ,but
    sometime this query picks up a bad plan .Whenever it happen,the application function becomes exetremly slow and it seems that the rest of the fuctionalities work fine meantime .
    Our application vender is aware of this issue and this issue will be fixed in the application next release .Developer is converting the ad-hoc query into stored procedure to fix this
    issue .Application new relase will not available for next 2-3 months ,meantime we still have to deal with the ad-hoc query bad execution plan issue . Usually ,when the ad-hoc query run with the bad execution plan , I retrieve the query bad plan and just remove
    the plan for that particular query from cache .Once the bad plan is removed from cache , the perfomance gets back to normal .
    As my understanding, this issue is related to parameter sniffing .but anyone thinks there are other factors responsible for this issue such as the network problem , the resource intensive
    report ran or something else .
    Has anyone have step by step troubleshooting steps that could help me with my investigation and what areas
     do I need to look into in order to investigate what could caused the ad-hoc query to pick up bad plan ?
    Any help will be apprecited .
    Daizy

    When we upgraded our Production Database to SQL server 2008R2 enterprise Edition. We ran into the transaction log file to grow too large during the reindexing job activities at night .To prevent the transaction log file to grow big , we had decided to change
    the recovery model of database from FULL to Simple before the reindexing job starts and the recovery model of Database is changed from Simple to Full after the reindexing job finishes . We also have the differential backup job setup right after the recovery
    model change back to full so the transaction log backup chain does not break.
    The transaction log chain breaks when you set the recovery to simple.
    Yes, if you take a diff backup, you can apply transaction logs from that point
    if the diff backup is good. If the diff backup is bad, you will lose all updates after you set recovery to simple. And, yes, when you hardware starts to deteoriate, you should not be surprise that the last backup is not good.
    Again, please stop setting recovery to simple, unless you have a very relaxed RPO in your SLA. Use bulk-logged recovery instead.
    By the way, you do take a t-log backup before you change the recovery mode, don't you?
     Changing the database recovery model does flush the SQL plans for specific Database. Please review this linkhttp://sqlblogcasts.com/blogs/steveh/archive/2010/09/02/changing-recovery-model-removes-plans-from-procedure-cache-for-a-database.aspx
    Hmmm. I don't have the time to verify this right now. Anyway, reindexing is good enough to flush the cache of most plans.
    I have pretty much all required info regarding this query , but what other areas or investigation do I need to do for the query parameter sniffing issue ?
    Have you researched what values the initial plan is sniffed for?
    As Erland said  adding space in query ,I don?t know adding space means just add additional space in the query so it hashes a different values .Please advice .
    Obviously, you need access to the application code. The other alternative is to set up an early morning job that runs after this first execution and which forces a recompilation; either by evicting this specific plan or more brutally runs sp_recompile on
    one of the tables in the query.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • User exit during MIRO with PO reference data

    I have maintained dates Validity Star and End dates in Purchase order header data. My client wants that during MIRO system will throw error message if the posting date of IV crosses the Validity end date maintained in PO.
    Is there any user exit for this so that during giving PO reference system will look for this data in PO and throw message or during simulate or post.
    Regards,
    Suman

    Hello Suman,
    Please follow this steps to get the list of Userexits for the TCODE MIRO read there short description to get the appropriate EXIT.
    Steps.
    1. Goto the Tcode
    2. System-> Status.
    3. Copy the program name, find the package for the program.
    4. Go to SMOD (tccode)  press F4 -> Click on "Information System" Push Button->
       Enter the Package name-> and press the enter button.
    5. Now you get the list of Userexits. Need to select one by looking into its short    description.
    Hope this solves your issue,
    Cheers,
    Suvendu

  • While doing MIRO with unplaned cost system is picking  accurel G/L account

    Dear All,
    While doing MIRO with unplaned delivery cost system is picking accural G/L account rather than cost element from PO.
    Thanks
    KMR

    Hi,
       It depeneds how the Unplanned Delivery Cost has been configured for the comany code.
    SPRO>Material Management>LIV>Incoming Invoice>Configure Unplanned Delivery Cost.
    Against Comapny Code put blank if : Unplanned delivery costs are distributed among the invoice items ( here the Materil account or the Account in the PO will be used. )
    Put     2 if : Unplanned delivery costs are posted to a separate general ledger   account  ( here the posting key UPF will be used to determine the g/l account ).
    Thanks and Regards

Maybe you are looking for