BADI MRM_PAYMENT_TERMS - Baseline date

Hi All,
The requirment I have is to automatically populate the Baseline date based on the GR posting date and Invoice posting date.
While creation of the Invoice in MIRO,
       1) If the GR posting date is greater than the Invoice posting date then the Baseline date should be populated with the GR posting date.
       2) If the Invoice posting date is greater than the GR posting date then the Baseline date date should be populated with the Invoice posting date.
This logic I have implemented in  the BADI MRM_PAYMENT_TERMS which works as expected.
But the standard calculation of 'DUE ON' date, Payment terms, Cash discount days are not performing according to the standard functionality and these values do not get displayed.
Why is this getting affected?
Also, please suggest if there is any other way to achieve this requirement without any deviation from the standard functionality.
Below is the code that I have implemented in the BADI.
*----Defining the structure for work area for EKBE table data fetch
  TYPES: BEGIN OF TY_EKBE,
          EBELN  TYPE  EBELN,
          EBELP  TYPE  EBELP,
          BELNR  TYPE  MBLNR,
          BEWTP  TYPE  BEWTP,
          BWART  TYPE  BWART,
          BUDAT  TYPE  BUDAT,
         END OF TY_EKBE.
*----Defining the work areas
  DATA: WA_EKBE  TYPE                   TY_EKBE,          "Work area for History per Purchasing Document table
        WA_DRSEG TYPE LINE OF           MMCR_TDRSEG.      "Work area for Invoice doc items
*----Checking if the Company code is IBTG
  IF I_RBKPV-BUKRS = 'IBTG'.
*----Selecting data from EKBE table to fetch the latest GR posting date
    SELECT EBELN
           EBELP
           BELNR
           BEWTP
           BWART
           BUDAT
    INTO WA_EKBE
    FROM EKBE
    FOR ALL ENTRIES IN TI_DRSEG
    WHERE EBELN = TI_DRSEG-EBELN
    AND   BEWTP = 'E'
    AND   BWART = '101'.
    ENDSELECT.
*----Looping at Invoice Doc. Items table into its work area
    LOOP AT TI_DRSEG INTO WA_DRSEG.
      IF WA_EKBE-BUDAT > WA_DRSEG-BUDAT.                 "If GR posting date is greater than invoice date
        E_ZFBDT = WA_EKBE-BUDAT.                         "Assigning the GR date to Baseline date
      ELSEIF WA_EKBE-BUDAT < WA_DRSEG-BUDAT.             "If Invoice date is greater than GR date
        E_ZFBDT = WA_DRSEG-BUDAT.                        "Assigning the Invoice date to Baseline date
      ELSEIF WA_EKBE-BUDAT = WA_DRSEG-BUDAT.             "If Invoice date is Equal to GR date
        E_ZFBDT = WA_DRSEG-BUDAT.                        "Assigning the Invoice date to Baseline date
      ENDIF.
    ENDLOOP.
  ENDIF.

Hi,
if you go to se18 and display badi MRM_PAYMENT_TERMS,
in "Interface" tab if you double click on "Example implementation class"  CL_EXM_IM_MRM_PAYMENT_TERMS
and then in class interface CL_EXM_IM_MRM_PAYMENT_TERMS, if you display the code of IF_EX_MRM_PAYMENT_TERMS~PAYMENT_TERMS_SET you will find three examples:
METHOD if_ex_mrm_payment_terms~payment_terms_set .
*--- fill all export-parameter ----------------------------------------*
  e_zfbdt = i_rbkpv-zfbdt.
  e_zbd1t = i_rbkpv-zbd1t.
  e_zbd1p = i_rbkpv-zbd1p.
  e_zbd2t = i_rbkpv-zbd2t.
  e_zbd2p = i_rbkpv-zbd2p.
  e_zbd3t = i_rbkpv-zbd3t.
  e_zlspr = i_rbkpv-zlspr.
*** Example 1: Setting ZFBDT depending on goods receive
  DATA: h_drseg TYPE mmcr_drseg,
        h_budat TYPE mmcr_ekbe-budat.
  TYPES: BEGIN OF x_datum ,
           budat LIKE h_budat,
         END OF x_datum.
  TYPES: BEGIN OF x_ekbe_gelesen,
           ebeln TYPE ekbe-ebeln,
           ebelp TYPE mmcr_ekbe-ebelp,
         END OF x_ekbe_gelesen.
  DATA: h_ekbe_gelesen  TYPE STANDARD TABLE OF x_ekbe_gelesen,
        h1_ekbe_gelesen TYPE x_ekbe_gelesen.
  DATA: h_datum TYPE STANDARD TABLE OF x_datum,
        h1_datum TYPE x_datum,
        h_ebeln LIKE h_drseg-ebeln,
        h_ebelp LIKE h_drseg-ebelp.
  LOOP AT ti_drseg INTO h_drseg WHERE selkz = 'X'.
    SELECT budat FROM ekbe INTO h_budat WHERE
         ebeln = h_drseg-ebeln  AND
         ebelp = h_drseg-ebelp  AND
         lfbnr = h_drseg-lfbnr  AND
         lfgja = h_drseg-lfgja  AND
         lfpos = h_drseg-lfpos  AND
         vgabe = '1'.
      IF sy-subrc EQ 0.
        MOVE h_budat TO h1_datum-budat.
        APPEND h1_datum TO h_datum.
      ENDIF.
    ENDSELECT.
  ENDLOOP.
  SORT h_datum DESCENDING.
  READ TABLE h_datum INDEX 1 INTO e_zfbdt.
*** Example 2: calculate best payment terms based on manual settings
  DATA: h2_drseg TYPE mmcr_drseg,
        h2_zbd1p TYPE mrm_rbkpv-zbd1p,
        h2_zbd1t TYPE mrm_rbkpv-zbd1t,
        h2_zbd2p TYPE mrm_rbkpv-zbd2p,
        h2_zbd2t TYPE mrm_rbkpv-zbd2t,
        h2_zbd3t TYPE mrm_rbkpv-zbd3t,
        h21_zbd1p TYPE mrm_rbkpv-zbd1p,
        h21_zbd1t TYPE mrm_rbkpv-zbd1t,
        h21_zbd2p TYPE mrm_rbkpv-zbd2p,
        h21_zbd2t TYPE mrm_rbkpv-zbd2t,
        h21_zbd3t TYPE mrm_rbkpv-zbd3t.
  LOOP AT ti_drseg INTO h2_drseg WHERE selkz = 'X'.
    SELECT zbd1p zbd1t zbd2p zbd2t zbd3t
      FROM ekko
      INTO (h2_zbd1p, h2_zbd1t, h2_zbd2p, h2_zbd2t, h2_zbd3t)
      WHERE ebeln = h2_drseg-ebeln.
      IF sy-subrc EQ 0.
        IF h2_zbd1p GT h21_zbd1p.
          MOVE h2_zbd1p TO h21_zbd1p.
          MOVE h2_zbd1t TO h21_zbd1t.
          MOVE h2_zbd2p TO h21_zbd2p.
          MOVE h2_zbd2t TO h21_zbd2t.
          MOVE h2_zbd3t TO h21_zbd3t.
        ENDIF.
      ENDIF.
    ENDSELECT.
  ENDLOOP.
  IF h21_zbd1p GT i_rbkpv-zbd1p.
    MOVE h21_zbd1p TO e_zbd1p.
    MOVE h21_zbd1t TO e_zbd1t.
    MOVE h21_zbd2p TO e_zbd2p.
    MOVE h21_zbd2t TO e_zbd2t.
    MOVE h21_zbd3t TO e_zbd3t.
  ENDIF.
*** Example 3: Setting ZLSPR depending on currency
  CONSTANTS: c_zlspr_r VALUE 'R',
             c_waers_itl TYPE waers VALUE 'ITL'.
  IF i_rbkpv-waers = c_waers_itl.
    MOVE c_zlspr_r TO e_zlspr.
  ENDIF.
ENDMETHOD.
your case is similar to the first example.
Best regards.

Similar Messages

  • Creation of Vendor Invoice  - BADI to control "Payment Baseline Date field"

    Hi ,
    In SRM - Creation of Vendor Invoice  or Credit memo  -
    In the process of creation of vendor invoice in Header Data - Payment Data tab there is a field "Payment Baseline Date" and I want to populate custom value to this field using BADI. But I could not find any BADI to do this.
    Can any one please let me know if any idea what BADI I can use.
    I tried DOC_CHANGE_BADI and this one does not have this field in the ET_HEADER.
    Thanks in advance.
    Venkat

    Hi,
    Any ideas please?
    Thanks for ur time.

  • User exit / substiution /  badi for changing baseline date

    Dear Experts ,
                           I have a requirement to change the base line date of residual document created in F-28 / F-32 to the base line date of original document getting partially cleared .
    I have explored the option of substitution but it doesnt work as field ZBLDT is not available for substitution there .
    Please let me know any BADI / Exit which can perform this change of baseline date .
    thanks in advance

    Hi Milind,
    Following are the user-exits for F-32 :
    RFAVIS01            Customer Exit for Changing Payment Advice Segment Text
    RFEPOS00            Line item display: Checking of selection conditions
    RFKORIEX            Automatic correspondence
    SAPLF051            Workflow for FI (pre-capture, release for payment)
    F050S001            FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment
    F050S002            FIDCC1: Change IDoc/do not send
    F050S003            FIDCC2: Change IDoc/do not send
    F050S004            FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send
    F050S005            FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document
    F050S006            FI Outgoing IDoc: Reset Clearing in FI Document
    F050S007            FIDCCH Outbound: Influence on IDoc for Document Change
    F180A001            Balance Sheet Adjustment
    FARC0002            Additional Checks for Archiving MM Vendor Master Data
    I hope this will help you.
    Regards,
    Nitin.

  • Baseline Date not chaning using BADI FAGL_SET_SEGMENT

    If someone has worked with this badi FAGL_SET_SEGMENT, can you please help.
    I'm trying to change the baseline date for the vendor invoice created using FB60.  I implemented the above BADI and changed the value of Baseline Date and Cash discount days based on the business logic. But the change is not reflecting in the document.
    Please help.
    Thank you.

    I understand the proposed solution but I do not think this should be a custom coding requirement.  The underlying assumption of the invoice payment term is that goods / services have been delivered.  The transfer of title should be a configurable trigger for the vendor payment baseline date.  Many consumer goods are shipped FOB to the customer destination with a 3-4 week shipping timeline.  Normal payment terms run 30-45 days.  We want our baseline date to start when the title transfers.  I can understand the GR document does not take the place of a proof of delivery but it is much closer to the the point where we actually transfer title then when we normally receive the invoice (2 days after vendor shipment).  Of course I have been through the argument that the invoice document date should be manipulated but I do not buy into it because it envokes a form of dispute management on a standard flow.  Initially I went down the path of GR based IV which follows the same logic as above for the release of ultimate payment.  I am confused as to why the standard solution does not provide an equivalent configuration for baseline date computation.  Can anyone explain why this is the case or whether I am just missing something obvious?

  • Substitution - Baseline Date to be replaced by the Goods Receipt date

    Dear Forum,
    We have the payment terms defined in the system, with the baseline date corresponding to the 'Document Date' and the credit terms as 60 Days. The users now desire that the Baseline Date should instead correspond to the Goods Receipt Date. To enable this we need to define the substitution such as the Baseline Date at the time of Invoice Verification gets substituted by the Goods Receipt Date, if the GR Date is earlier than the IV date.
    Would appreciate help from the friends as to how to configure this and which feilds to be chosen and replaced.
    Thanks!
    Regards,

    Hi
    You can make the Baseline Date in Invoice (MIRO) with Goods Receipt Date using BADI.
    BADI -->MRM_PAYMENT_TERMS
    Tell your ABAP Guy to work on this BADI.
    In the BADI,  MRM_PAYMENT_TERMS Read the Value in WEBUD of Internal Table TI_DRSEG and Pass it into E_ZFBDT.
    Also if the Baseline Date is changed manually, then after posting you can see the Goods Receipt Date in Baseline Date.
    This resolves your issue.
    regards
    venkat

  • Baseline Date getting cleared

    Hi Experts,
    While creating invoice in MIRO,the baseline date in the payment tab is getting cleared.When you manually enter baseline date due on date is getting set to the baseline date even if payment terms is Z030.Badi MRM_PAYMENT_TERMS was affecting these dates.When i re-assigned all the export parameters the Due on problem got resolved but the BASELINE DATE is still getting cleared.
    Please help me.
    Thanks,
    Saumia

    Hi,
    Find your solution here  BADI MRM_PAYMENT_TERMS
    Regards,
    Nihad
    Edited by: nihad omerbegovic on Dec 10, 2009 3:24 PM

  • Baseline date blank in MIRO

    Hi Experts,
    When I create MIRO, the baseline date always blank. Payment terms is filled, but baseline date always blank.
    Everytime I try to fill manually the baseline date, when I enter. It goes back to blank.
    I cannot save invoice.
    Please help.
    Thanks,
    Melissa

    Hi,
    By default the payment term read from vendor master data is 0001. Then the baseline date is blank.
    When I try to change the payment term, the baseline date appears.
    But after I enter several times, baseline date going back blank again.
    If yes, do you know any user exit that impacted this field ?
    I have enhancement for BADI MRM_PAYMENT_TERMS. Is it possible that after I activate this, the baseline date not working as usual ?
    Thanks,
    Melissa

  • 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 .

  • Baselin date as a recent GR posting date

    My Requirement is to modify baseline date in MIRO to Recent GR posting date for which i have implemented BADI  'MRM_PAYMENT_TERMS  and its functioning properly in MIRO . after doing the payment and generating the invoice document number for same what i found is baseline date in invoice document in FB02 has the the same Date which was coming earlier in Material document in MIRO and not the recent GR posting date which is my requirement.
          i tried to do it by updating the invoice document for modify baseline date to recent GR posting date  in the same BADI but couldnt succeed as the invoice document number is generated after the call of this badi and hence coulnt modify the same .
       so can anyone please sugest me some other BADI and other work aroundfor it?
    helpful answers will be awared.
    Thanks in advance.
    AVI

    Edited by: SAP Learner on Jul 23, 2009 11:22 AM

  • Making Baseline date default as GR date

    Hi All,
    I have requirement like I want to default Baseline date in MIRO as GR posting date, how to do this.
    I tried by configuring it but its not working.
    Please guide me.
    Thanks in Advance
    Pavan

    With Standard settings it may not possible.
    Tey this BADI-- MRM_PAYMENT_TERMS
    Thanx
    Rammohan.

  • Baseline date for payment due date.

    Hi,
    In FB60 and Miro, Baseline date for calculating due date for payment is taken as default as document date, as per setting in payment terms. But I want to take this date as date of GR/SE. Can we do this. I also want to make it gray and dont want user to change it. Please suggest how to do it.

    Hi
    go through the link answered by me.
    Re: Substitution - Baseline Date to be replaced by the Goods Receipt date
    the Goods receipt date can be defaulted as Baseline Date.
    tell your ABAP consultant to check the BADI and do the necessary.
    regards
    venkat

  • Setting baseline date based on a specific payment term

    Hello everybody,
    I have a requirement where i have to change the baseline date in MIRO based on a specific payment term. For ex: out of 3 payment terms A, B and C which all take the same base line date set in MIRO, i want to change the base line date for say condition B only.
    I can't find the 3 different payment terms in any exit or BADI. I just get the value in ZTERM as say 'A1' which is the main installment term.
    Could anybody tell me how I am supposed to do this?
    Regards,
    Ritwik Rajkumar

    Dmytro has made some excellent suggestions. If it were me, I would rebuild the table into partitions based on the new column EXPIRATION_DATE assuming that the vast majority of the records are to be "expired".
    However, I would first set a local variable from sysdate rather than use it in the SQL so that you don't have any context switching to query sysdate for each record AND preserve the same timestamp for all records updated:
    declare
    V_TIMESTAMP date := sysdate;
    begin
    update MY_BIG_TABLE
    set EXPIRATION_DATE = V_TIMESTAMP
    where nvl(EXPIRATION_DATE,V_TIMESTAMP) >= V_TIMESTAMP;
    end;

  • GRN Date as Baseline Date

    Hi ,
    Want system should capture GRN Posting Date as Base Line date while doing the MIRO.
    ( If payment term is 30 Days , then system shoulld calculate the 30 Days from GRN posting date )
    Any Badi  will serve this purpose ( INVOICE_UPDATE )
    Thanks in advance.

    Hi,
    The BADI : MRM_PAYMENT_TERMS to you used to copy the GRN Posting Date as Base Line date while doing the MIRO
    Go to T code : SE24 enter the object type  CL_EX_MRM_PAYMENT_TERMS click display.
    Copy the code and add the same code in your object for the BADI MRM_PAYMENT_TERMS I will work without any issue.
    Thanks.

  • Tcode Impacted by the BADI  "MRM_PAYMENT_TERMS"

    Hello,
    Could you please tell me what are the T-code in which this BADI "MRM_PAYMENT_TERMS" is triggered or how i can get the list of all the tccode for which this BADI is called.
    As of i know two tcode MIRO and MIR7.
    I want to know is there any other tcode in which this BADI will be triggered.
    Thanks for your help.
    Sachin Yadav

    Hi,
    according to the documentation of the badi:
    When is the Business Add-In called?
    The Business Add-In is called after allocation (availability of the invoice item information -> PO data) and before further processing of the terms of payment (calculation of the cash discount).
    Because of its central position in the function module MRM_FINAL_CHECK, the Business Add-In can be implemented for all procedures within Logistics Invoice Verification. Using the origin of a invoice document (RBKP-IVTYP), you can control for which transactions the Business Add-In is implemented.
    The possible values of RBKP-IVTYP are:
         Online
    1     ERS
    2     ERS zero document
    3     Batch run
    4     EDI
    5     Cancellation
    6     Invoicing plan
    7     Transfer prices
    8     Revaluation
    9     WEB invoice
    B     BAPI invoice
    A     Invoice from Parking function
    C     Account maintenance
    and this is what i "guess" might be the corresponding transactions:
         Online                             -> MIR7, MIRO
    1     ERS                                -> MRRL
    2     ERS zero document                  ->
    3     Batch run                          -> MRBP
    4     EDI                                ->
    5     Cancellation                       -> MR8M
    6     Invoicing plan                     -> MRIS
    7     Transfer prices                    ->
    8     Revaluation                        -> MRNB
    9     WEB invoice                        ->
    B     BAPI invoice                       -> BAPI_INCOMINGINVOICE_PARK/POST
    A     Invoice from Parking function      ->
    C     Account maintenance                ->
    Best regards.

  • Invoice Baseline Date = GR Doc. Date

    Hi all,
    I have a requirement to fetch the GR Doc. Date into the Baseline Date Field in MIRO.
    What are the settings to be done.
    Regards,
    Baskar

    Have a look into OSS Note 1156325 - BAdIs in the Logistics Invoice Verification environment
    among much more information:
    How does the BAdI affect the application?
    The (possibly) changed terms of payment are provided for the application. They form the basis for further processing in the Logistics Invoice Verification and in accounting.
    Example
    You want to carry out a determination of the terms of payment that differs from the standard; this could be, for example:
    The baseline date for payment is to be derived from the goods receipt date.
    The terms of payment entered by the user and available in the purchase orders are to be checked and the most favorable terms of payment are to be determined from this.
    You want to set a payment block in the document header for certain transactions.
    More information
    Documentation for the BAdI interface IF_EX_MRM_PAYMENT_TERMS

Maybe you are looking for

  • Authority Objects to read HR FM BAPI_ORGUNITEXT_DATA_GET

    Hello gurus,    i want to run only FM BAPI_ORGUNITEXT_DATA_GET  through a SAP User ID, i assigned some Authority Objects to it but its not returining anything if i run it through other user using same parameters its showing me the data. i assigned S_

  • Vector Graphic / HPGL file processing VI ???

    Hi all, Is there a VI out there that will load AND interpret any common type of vector file format, producing an array of line start and end point coordinates (I only need to read lines, not shapes) ??? I have some "motorised" hardware to control via

  • Re: OBIEE 10.1.3.4.1 integration with Hyperion shared services 11.1.1.3

    I am working on OBIEE authentication using hyperion shared services. To achieve this I did the following steps, 1) Registered the shared services in Answers using 'Manage EPM workspace' 2)Modified config.xml to enable HSSauthenticator 3)Modified inst

  • CRM_IC_ERP_BADI  should be triggered...

    The Badi CRM_IC_ERP_BADI method BEFORE_CREATION should be triggered when we create a sales order in CRM_UI transaction  (IC Web Client), all this to to change the sales district VBKD-BZIRK, but we have a problem, it does not. so the question is if th

  • Bug tracking and project workflow management

    Hi, I was wondering how bigger projects are managed so that everyone in the team knows what he has to do and what are current problems on the project, what is their status etc. I googled for a while and found lots of sites that offer free hosting for