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

MIRO - User Exit during SAVE: Read items & Update header

Former Member
0 Kudos

Hi there!

During MIRO after pressing save...

I search for an user-exit or BAdI, to READ ITEM DATA and UPDATE HEADER DATA (XBLNR) after SAVE but before UPDATE.

I have searched this forum, but with no luck. Many more then me seem to have the same problem. The most common answer have been to try BAdI INVOICE_UPDATE, but that BAdI only give READ access and NO UPDATE, so no luck there..

To summarize all my searching here and findings... I list all exits I have tested...

User-Exits

LMR1M001 User exits in Logistics Invoice Verification

LMR1M002 Account grouping for GR/IR account maintenance

LMR1M003 Number assignment in Logistics Invoice Verification

LMR1M004 Logistics Invoice Verification: item text for follow-on docs

LMR1M005 Logistics Inv. Verification: Release Parked Doc. for Posting

LMR1M006 Logistics Invoice Verification: Process XML Invoice

MRMH0001 Logistics Invoice Verification: ERS procedure

MRMH0002 Logistics Invoice Verification: EDI inbound

MRMH0003 Logistics Invoice Verification: Revaluation/RAP

MRMN0001 Message output and creation: Logistics Invoice Verification

BADI - When saving in MIRO the following BAdI were passed...

PPA_CUST_BADI

/CCIS/FICLRDC_ENH

INVOICE_UPDATE << only read no update

ME_DP_CLEARING

AC_DOCUMENT

FI_LIMIT_PROCESS

AC_QUANTITY_GET

FMRE_BUS_PROCESS

EXIT_XFMPRI_001

CO_DOCUMENT_INFO

INVOICE_UPDATE (method change_before_update ) << only read no update

MRM_RANSACT_DEFAULT

MRM_HEADER_DEFAULT

Other BAdI's

MRM_HEADER_CHECK - Bara ingående värden för kontroll

MRM_HEADER_DEFAULT - Tyvärr sätter bara XBLNR precis när man går in i MIRO...dvs för tidigt.

MRM_ERS_HDAT_MODIFY - EJ anropad...

Would be greatful for any ideas on this matter...

Best regards

Henrik

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Henrik,

In BADI INVOICE_UPDATE there are 3 methods CHANGE_AT_SAVE, CHANGE_BEFORE_UPDATE and CHANGE_IN_UPDATE.

Of these CHANGE_AT_SAVE is called before INSERT / UPDATE statements are executed. We can use this to update RBKP-XBLNR.

We can't use CHANGE_BEFORE_UPDATE and CHANGE_IN_UPDATE methods as they are called after INSERT / UPDATE statements are executed and before COMMIT.

You can update RBKP-XBLNR through INVOICE_UPDATE~CHANGE_AT_SAVE method using call stack technique like below. You can replace 'VALUE' in the below code with the value based on your calculation using other variables like s_rbkp_new, ti_rseg_new etc.

method IF_EX_INVOICE_UPDATE~CHANGE_AT_SAVE.
  DATA: lv_name_xblnr(30) TYPE c VALUE '(SAPLMRMP)RBKPV'.
  FIELD-SYMBOLS: <fs_rbkpv> TYPE mrm_rbkpv.

  ASSIGN (lv_name_xblnr) TO <fs_rbkpv>.
  IF <fs_rbkpv> IS ASSIGNED.
    <fs_rbkpv>-xblnr = 'VALUE'.
  ENDIF.
endmethod.

Best regards,

Vishnu Tallapragada

6 REPLIES 6

Former Member
0 Kudos

This is an interesting situation. BADI INVOIC_UPDATE provides you both header and item data of the MIRO invoice but won't let you change them (all import variables). BADIs like MRM_HEADER_DEFAULT will allow you to change XBLNR but you don't get the item data and it is too early as this triggers as soon as the user enters data in MIRO.

You can update RBKP-XBLNR with INVOICE_UPDATE BADI. But you have to use call stack technique. We have done similar thing in our project. I will let you know when I can access my system.

Best regards,

Vishnu Tallapragada

Former Member
0 Kudos

Hello Henrik,

In BADI INVOICE_UPDATE there are 3 methods CHANGE_AT_SAVE, CHANGE_BEFORE_UPDATE and CHANGE_IN_UPDATE.

Of these CHANGE_AT_SAVE is called before INSERT / UPDATE statements are executed. We can use this to update RBKP-XBLNR.

We can't use CHANGE_BEFORE_UPDATE and CHANGE_IN_UPDATE methods as they are called after INSERT / UPDATE statements are executed and before COMMIT.

You can update RBKP-XBLNR through INVOICE_UPDATE~CHANGE_AT_SAVE method using call stack technique like below. You can replace 'VALUE' in the below code with the value based on your calculation using other variables like s_rbkp_new, ti_rseg_new etc.

method IF_EX_INVOICE_UPDATE~CHANGE_AT_SAVE.
  DATA: lv_name_xblnr(30) TYPE c VALUE '(SAPLMRMP)RBKPV'.
  FIELD-SYMBOLS: <fs_rbkpv> TYPE mrm_rbkpv.

  ASSIGN (lv_name_xblnr) TO <fs_rbkpv>.
  IF <fs_rbkpv> IS ASSIGNED.
    <fs_rbkpv>-xblnr = 'VALUE'.
  ENDIF.
endmethod.

Best regards,

Vishnu Tallapragada

0 Kudos

Hi dear Vishnu!

I am REALLY sorry....that I ONLY can provide you with 10 Points of award.

Because your answer were MORE than helpful.

You have opened my mind for this new way of thinking

Thankyou very very much for your HELP!!!

Best regards

Henrik

0 Kudos

Hi again Vishnu

I found a way to send you even more earning points....

You get both "Solved problem" 10p AND "Very helpful" 6p = total 16p ....Yihaaaa!!!!!

best reg

Henrik

0 Kudos

Hi Vishnu,

I want to update  TI_RSEG_NEW table's field trying call Stack Technique but not working as its table not only structure. Is there any other way to do change of TI_RSEG_NEW  internal table data..

charlesbeatle
Discoverer
0 Kudos

Do someone Know how can I change the field ZUONR and BKTXT that are placed on the "Details field" in tx MIRO????

I´m trying to avoid the use of a BAPI for posting Invoces, I'm using a simple LSMW but this field "asignación & header text" I would like to fill it with a user exit.

I hope that someone can help me, thanks.