Regarding BADI  INVOICE_UPDATE, method CHANGE_AT_SAVE

Hi there,
I'm implementing this Badi so i can make some checks at the time of saving an edited preliminary (parked) document. If the total of the invoice is higher than the old one, i do the checks (against a Z table, a Z function module, etc) and if i have to stop saving, i trigger an error message raising ERROR_WITH_MESSAGE exception. As the only method that gets called in all the cases I need, and allows me to trigger messages, is CHANGE_AT_SAVE, I use this one.
The okcodes that i'm interested in are:
<i>PARK (Save parked document)
COMP (Save as completed)
BU (Post)</i>
The problem is, to do all the processing, i compare the method parameters
S_RBKP_OLD vs. S_RBKP_NEW.
When the okcode is PARK or COMP it's ok, but <b>when posting (BU) the S_RBKP_OLD doesn't get populated</b>! Anyone knows why is that and what the workaround would be?
Update: i've searched throught OSS but there's no note related to this.
Thank you very much.

Hi Narendran, thanks for your help,
But my problem is that i need to compare the new total of the invoice (s_rbkp_new-rmwwr) versus the old one (s_rbkp_old-rmwwr), so that if the new one is higher, i check that the difference between them is not higher than a set limit, otherwise i must stop saving/posting.
I could retrieve the values from RBKP table itself (which should still be the "old" ones at the time the BADI executes) but then, what is s_rbkp_old for?
Edit: Requirements changed and now i need to do the checks for every changed line of the invoice. As in the original problem, when posting, TI_RSEG_NEW has all the new values but TI_RSEG_OLD is initial. I've been debugging a little and got to the MRM_DOCUMENT_CHANGE_PREPARE function, which is not calling the MRM_*_READ functions since i_xupda (update flag) is 'I' when posting, although no new line has been inserted.
PLEASE, if you implemented this BADi method before, post your comments or example code. Documentation is scarce and on the internet there isn't much info neither.
I've been also looking at exits but they don't seem to serve this purpose.
By the way, i'm on 4.6C.
Many thanks

Similar Messages

  • Regarding BADI , INVOICE_UPDATE ( MIRO transaction )

    Hi All,
    In Miro transaction, I need to do some manipulationwith  the amount field ( WRBTR ) from the line items of the invoice.
    I have found the BADI 'INVOICE_UPDATE' and method for this is 'CHANGE_AT_SAVE'. I can see all the line items entered on the miro screen into the the internal table TI_RSEG_NEW.
    However in the method it does not allow me to write the code to change the TI_RSEG_NEW table.
    Please help me out in achieveing this requirment.
    -Sanjay

    Hai.
    check this.
    User exit in the invoice
    USEREXIT_NUMBER_RANGE (module pool SAPLV60A, program RV60AFZZ)
    The internal set of numbers used in the standard is given in the table of kind of invoice and can be changed in this user exit. This user exit is called only when putting on the invoice.
    USEREXIT_ACCOUNT_PREP_KOMKCV (module pool SAPLV60A, program RV60AFZZ)
    In this user exit additional fields for the account identification are taken up in the communication structure KOMKCV (head fields), which is not intended in the standard.
    USEREXIT_ACCOUNT_PREP_KOMPCV (module pool SAPLV60A)
    In this user exit additional fields for the account identification in the communication structure become KOMPCV (position fields) aufenommen, which is not intended in the standard.
    USEREXIT_NUMBER_RANGE_INV_DATE (module pool SAPLV60A, program RV60AFZC)
    Dependent on the set of numbers over the table TVFKD the invoice date is set (country-specific requirement from Italy).
    During the use of this user exit the user exit USEREXIT_NUMBER_RANGE is automatically inactively switched.
    USEREXIT_FILL_VBRK_VBRP (module pool SAPLV60A, program RV60AFZC)
    This user exit is called only when putting on the invoice. It is used, in order to supply the head and the position of the invoice which can be provided with deviating or additional data.
    USEREXIT_PRINT_ITEM (module pool SAPLV61A, program RV61AFZB)
    Printing the position line of an invoice can be supplemented or changed.
    USEREXIT_PRINT_HEAD (module pool SAPLV61A, program RV61AFZB)
    Printing the headline of an invoice can be supplemented or changed.
    User exit in the program RV60AFZD
    A short description of the user exits are contained in the program:
    o USEREXIT_RELI_XVBPAK_AVBPAK
    o USEREXIT_NEWROLE_XVBPAK_AVBPAK
    o USEREXIT_NEWROLE_XVBPAP_AVBPAK
    USEREXIT_FILL_VBRK_VBRP (module pool SAPLV60A, program RV60AFZC
    Use RV60AFZZ Include
    regards.
    sowjanya.b

  • BAdI 'INVOICE_UPDATE' could be used in MIR7/MIR4 ??

    Hello,
    Our customer implemented  BAdI implementation to check qty and currency ammount in the following BAdI.
       BAdI      BAdI  INVOICE_UPDATE
       method  CHANGE_AT_SAVE
       Then I found that note 1156325 describes as folloes;
    The BAdI 'INVOICE_UPDATE' was only designed to execute checks during document entry or document posting in transaction MIRO.
    This seems to restrict only in transaction 'MIRO', but it seems to work in other transaction, such as MIR7, MIR4.
    We should not use this BAdI and should use 'MRM_HEADER_CHECK' ?
    Could anyone give me your recomendation/suggestion?
    Thank you
    Yuko

    Try use field symbol assign to change the field value.
    First make sure that the field can be assigned to a field symbol. Usually the field must be declare in global top include program.
    If yes. Then
    ASSIGN (l_v_field) TO <l_fs>. 
    CHECK sy-subrc EQ 0.
    <l_fs>  = new_value.  " change value here
    l_v_field is char type. l_v_field = (PROGRAM-NAME)FIELD-NAME.
    Good luck.
    Edited by: Chris Xu on Dec 25, 2007 11:47 AM

  • MIRO BADI 'INVOICE_UPDATE'

    I am using BADI 'INVOICE_UPDATE' to update a flag 'ZLSPR' in header data on SAVE in MIRO transaction. but the method 'CHANGE_AT_SAVE' in this BADI only has import parameters. No export parameters. Can anyone advice:
    1) if I can use this method to change values?
    2) is there anyother badi available for this transaction.
    Thank you.

    Hi,
       Can you pls help me as my requirment is also same.I have to change the "Base Line Date" i.e. ZFBDT field of BSIK which is there in the Importing Parameters of method "CHANGE_AT_SAVE". Can i change the importing parameters..
    If you get any alternate solution for the same, pls suggest me
    Regards,
    Rushikesh

  • Get Invoice number in BADI INVOICE_UPDATE

    Hi all.
    It`s posible to get a invoice number in badi invoice_update. I create invoice in tc MIRO. I create my implementation and i call my function group (here i need number just creating invoice)
    Thx
    Grzegorz

    HI,
       Check the methods parameters for CHANGE_AT_SAVE method: S_RBKP_NEW or S_RBKP_OLD.
    S_RBKP_NEW-BELNR will ahve the document number.
    Regards,
    Ravi

  • Badi BBP_SC_TRANSFER_BE, method GROUP_PO

    Hi All,
    We are on SRM 5.0 SP07.
    I want to add an additional grouping criteria for grouping backend PO's- <b>Shopping cart Line item currency</b>.
    In addition to the standard grouping (which is as per the PO header fields like vendor, purchase org, purchase group, company code etc.), I want to add line item currency as one more grouping criteria.
    Can someone suggest how I can do it using BADI BBP_SC_TRANSFER_BE, method GROUP_PO?
    Sample code might be very useful.
    Thanks,
    Srivatsan

    Hi
    Custom fields addition, go through the OSS Notes
    672960 and 458591.
    <b>To see the sample code, please go through the SAP OSS Notes, which is recommended here -></b>
    Note 610332 BADI BBP_SC_TRANSFER_BE/BBP_RESERVATION_GRP: Customer fields
    Note 1040082 BADI BBP_BS_GROUP_BE: Parameter is_object not filled
    Note 980017 Follow-on document not created
    Note 715213 Interface change in BAdIs in Release SRM 4.0
    Note 912873 Item not filled when using PO number range BADI
    Note 820404 BADI BBP_SC_TRANSFER_BE not called correctly
    Do let me know.
    Regards
    - Atul

  • BADI INVOICE_UPDATE Removing error message

    Hi
    I have implemented some validations in BADI INVOICE_UPDATE and I raise the ERROR_WITH_MESSAGE exception in case of incorrect data entered via MIRO.
    But after user corrects the error and presses ENTER, the Error message still remains in the message tab.
    Is there any way to delete the error message?
    Thanks and Regards
    Radha

    Hi,
    when you say:
    I directly press "SAVE' in MIRO
    are you holding RBKP-RBSTAT = ' ',
    parking RBKP-RBSTAT = 'A',
    or saving  as complete RBKP-RBSTAT = ' B'
    the document?
    According to SAP Note 1156325 - BAdIs in the Logistics Invoice Verification environment:
    Definition name: INVOICE_UPDATE
    Usage
    The BAdI 'INVOICE_UPDATE' was only designed to execute checks during
    document entry or document posting in transaction MIRO.
    According to SAP Note 392342 - MIRO: No data change through Bussiness Add In
    Symptom
    In the logistics invoice verification MIRO, you cannot change data using
    Business Add In 'INVOICE_UPDATE'.
    Additional key words
    BAdI, SE18, MRM_BADI_INVOICE_CHECK,
    Cause and prerequisites
    This system behavior is correct.
    BAdI 'INVOICE_UPDATE' was only designed to execute checks during the
    document entry or document posting in Transaction MIRO. Therefore, it has
    only import parameters. There are no export parameters. This means that the
    data changed in the BAdI is not processed further in standard program MIRO.
    Best regards.
    Edited by: Pablo Casamayor on May 11, 2010 4:56 PM

  • Data in BADI "INVOICE_UPDATE"

    Hey,
    im using the BAdI INVOICE_UPDATE to run some checks when an invoice is posted. Within that i need the resulting prices of each position after the calculation of discount (skonto) etc.
    In fact i need the values shown when you click on Simulate.
    Now i have the data for discount, accounting and position values etc but they are not cumulated. So i would need to calculate them myself. I guess there must be a method doing that. Is anyone able to guide me with that ?
    Thanks for your help - which will be rewarded.
    oliver

    Thanks venu for the reply. But i cant see a table containing the spread of position prices over the accounting.
    I need the following. Assume you have 2 positions, one with single, one with multiple accounting.
    Tax 10%
    POS1: 20Eur
    POR2: 20Eur, Acc1 50%  Acc2 50%
    Now i need the following like its shown when you preas Simulate in MIRO.
    Pos1  22EUR   GLAccount xyz1_1
    Pos2  11EUR   GLAccount xyz2_1
    Pos2  11EUR   GLAccount xyz2_2
    I dont want to calculate that myself in case there are some things i might forget about. So i need a correct way to retrieve these values.
    The import-parameters of the badis doesnt seem to have these values.
    Any help is appreciated. Thanks,
    oliver

  • BADi INVOICE_UPDATE

    Hi All,
    I am using Badi INVOICE_UPDATE to change the value of 'Tax Amount' with some other value when i am going to create a Invoice for the Purchase Order. I am not able to set the flag inside the BADi which for which i need to make the changes.  So please any of have worked on the same scenario plz suggest me.
    Waiting for quick replies from your end.
    Thnks in advance.
    Santosh

    Hi ,
    You achieve this using the ABAP memory:
    From the place you want to capture the FLAG:
    export flag to memory id 'YOURID'.
    At the place you want to check the FLAG and do some operations:
    import flag from memory id 'YOURID'.
    Now when you have the FLAG value, you can check that and do the desired operations.
    Hope these option might have clarified most of your doubts.
    Regards,
    Ashish Arora

  • BADI INVOICE_UPDATE - MIRO Transaction

    Hi,
    can anyone let me know how to code the BADI INVOICE_UPDATE.
    I'm trying to get the PO number and based on the PO, need to get few more info from another table. i have already went to SE19 and created a implementation for this Badi. And then in the method, i need to code this.
    Please help.
    Thanks.

    i have successfully triggered the BADI. But one more question, since i'm using CHANGE_BEFORE_UPDATE, it is generating the Invoice Document. And i'm checking in the BADI, that the PO number can be used for the Material Invoice or Service Invoice, based on the Document Type.
    Since i couldn't get the PO number in the MIRO User Exit, so i tried BADI. But the new invoice document is getting generated and if it is wrong PO, it comes out from the screen and the invoice document number range is missing.
    So is there any other BADI, upon entering the PO number, i need to validate.
    Thanks

  • Help needed regarding BADI in SAP-CRM 2007.

    hi all,
    i need some help regarding BADI for new creation and enhancement.
    plz help, you will be rewarded accordingly.
    regards.
    raman.

    Hi Raman,
    visit this link
    http://help.sap.com/saphelp_nw70/helpdata/en/32/a83942424dac04e10000000a1550b0/content.htm
    http://help.sap.com/saphelp_crm40/helpdata/en/c3/69bf4abf1045e0966badb60d6160dd/content.htm
    Regards
    Anup.

  • BAdi INVOICE_UPDATE   for MIRO

    Hi, we're having following issue  after the implementation of badi INVOICE_UPDATE in MIRO:
    Commitment item data in report S_ALR_87013620 is not matching data in KSB2
    Total record in S_ALR_87013620  is not equal to line item total in KSB2.
    Which two table can compare for total and  cost center line items.
    Thanks,
    sa

    Resolved

  • Regarding BADI implementation in Debugging

    Hi,
       i have a doubt regarding BADI.There are multiple badi implementations for VA02 transaction. now i am processing the VA02 transaction. Can i know which implementation is processing for the transaction.

    Hi Praveen,
    Use this code to find out the BADI of a Transaction code:
    *& Report ZGET_BADI
    REPORT ZGET_BADI.
    TABLES : TSTC,
    TADIR,
    MODSAPT,
    MODACT,
    TRDIR,
    TFDIR,
    ENLFDIR,
    SXS_ATTRT ,
    TSTCT.
    DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
    DATA : FIELD1(30).
    DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
    PARAMETERS : P_TCODE LIKE TSTC-TCODE,
    P_PGMNA LIKE TSTC-PGMNA .
    DATA wa_tadir type tadir.
    START-OF-SELECTION.
    IF NOT P_TCODE IS INITIAL.
    SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
    ELSEIF NOT P_PGMNA IS INITIAL.
    TSTC-PGMNA = P_PGMNA.
    ENDIF.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'PROG'
    AND OBJ_NAME = TSTC-PGMNA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    IF SY-SUBRC NE 0.
    SELECT SINGLE * FROM TRDIR
    WHERE NAME = TSTC-PGMNA.
    IF TRDIR-SUBC EQ 'F'.
    SELECT SINGLE * FROM TFDIR
    WHERE PNAME = TSTC-PGMNA.
    SELECT SINGLE * FROM ENLFDIR
    WHERE FUNCNAME = TFDIR-FUNCNAME.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'FUGR'
    AND OBJ_NAME EQ ENLFDIR-AREA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    ENDIF.
    ENDIF.
    SELECT * FROM TADIR INTO TABLE JTAB
    WHERE PGMID = 'R3TR'
    AND OBJECT in ('SMOD', 'SXSD')
    AND DEVCLASS = V_DEVCLASS.
    SELECT SINGLE * FROM TSTCT
    WHERE SPRSL EQ SY-LANGU
    AND TCODE EQ P_TCODE.
    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(19) 'Transaction Code - ',
    20(20) P_TCODE,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
    WRITE:/(105) SY-ULINE.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    *Sorting the internal Table
    sort jtab by OBJECT.
    data : wf_txt(60) type c,
    wf_smod type i ,
    wf_badi type i ,
    wf_object2(30) type C.
    clear : wf_smod, wf_badi , wf_object2.
    *Get the total SMOD.
    LOOP AT JTAB into wa_tadir.
    at first.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 'Enhancement/ Business Add-in',
    41 SY-VLINE ,
    42 'Description',
    105 SY-VLINE.
    WRITE:/(105) SY-ULINE.
    endat.
    clear wf_txt.
    at new object.
    if wa_tadir-object = 'SMOD'.
    wf_object2 = 'Enhancement' .
    elseif wa_tadir-object = 'SXSD'.
    wf_object2 = ' Business Add-in'.
    endif.
    FORMAT COLOR COL_GROUP INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 wf_object2,
    105 SY-VLINE.
    endat.
    case wa_tadir-object.
    when 'SMOD'.
    wf_smod = wf_smod + 1.
    SELECT SINGLE MODTEXT into wf_txt
    FROM MODSAPT
    WHERE SPRSL = SY-LANGU
    AND NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    when 'SXSD'.
    *For BADis
    wf_badi = wf_badi + 1 .
    select single TEXT into wf_txt
    from SXS_ATTRT
    where sprsl = sy-langu
    and EXIT_NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    endcase.
    WRITE:/1 SY-VLINE,
    2 wa_tadir-OBJ_NAME hotspot on,
    41 SY-VLINE ,
    42 wf_txt,
    105 SY-VLINE.
    AT END OF object.
    write : /(105) sy-ULINE.
    ENDAT.
    ENDLOOP.
    WRITE:/(105) SY-ULINE.
    SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ 'No.of Exits:' , wf_smod.
    WRITE:/ 'No.of BADis:' , wf_badi.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'No userexits or BADis exist'.
    ENDIF.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'Transaction does not exist'.
    ENDIF.
    AT LINE-SELECTION.
    data : wf_object type tadir-object.
    clear wf_object.
    GET CURSOR FIELD FIELD1.
    CHECK FIELD1(8) EQ 'WA_TADIR'.
    read table jtab with key obj_name = sy-lisel+1(20).
    move jtab-object to wf_object.
    case wf_object.
    when 'SMOD'.
    SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
    CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    when 'SXSD'.
    SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
    CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
    endcase.
    Reward if useful
    Regards
    Ravi

  • Can somebody provide a real time dummy object regarding BADI

    hi guru.
    it's urgent.can somebody provide a real time dummy object regarding BADI.
    please forward me.
    deffinitely good points waiting for u.
    thanks&regards.
    subhasis.

    Please check .
    http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm

  • Provide me Technical Speck or Functional Speck regarding BADIs

    Hi,
    can any one provide me the Technical Speck or Functional Speck regarding BADIs  its very urgent for me. you can send to my mail id: [email protected]
    waiting for your cooperation.
    Ramarao
    Message was edited by:
            rama rao

    Hi Rama !
    You can visit the following link:
    http://mysapbi.blogspot.com/2006/12/abap-certification.html
    You will find documentation and tutorials for whatever material you wish.
    Apart from that would be sending you step by step docs for both ALE and BADI.
    Reward if its helpful.
    Abir

Maybe you are looking for

  • SG 200-08 All LED lights flashing green after power failure

    Thinking back, about a month ago I updated the firmware (sorry I can't check version at the moment). The switch has been working fine since then. Today I needed to move some power cables and the switch lost power. Now ALL of the LED lights are flashi

  • Adjusting clip length

    When I try to fine tune the front of a clip in timeline, the blue selection changes to the previous clip and adjusts the end length of the previous clip instead. This happens whether or not I hold down the command key. I'm using iMovie HD. Thanks for

  • IPhone email setttings

    If I check " Delete from server - When removed from Inbox", does that JUST delete the email from an Apple server, or also from the Hostmonster server where my email is hosted? I'm trying to reduce the 3gb or so my iphone wastes on email I've deleted

  • I don't have iPhone anymore, how do I cancel my apple account

    How do I cancel my IPhone account?  Im not getting messages from anyone with iphone. Any help will work

  • What is "divide sign" in java/

    double d = 10 / 3; the result is 3.0 but i want to get 3.11111.....until the precision is end. how to implement?