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: 

Rolling back of Material Document Number in a BADI

Former Member
0 Kudos
159

Hi folks,

                I am implementing the  BADI  'MB_DCOUMENT_BADI '  for MIGO transaction.

                 By the time this BADI is triggered, the material doc number MBLNR is already generated.

                 But based on some condition, i need to cancel this GR and the document should not be posted in database tables.

                 Is it possible ? If so could you please suggest me how to do this..

                 Can i use BAPI_TRANSACTION_ROLLBACK for this purpose ?

             Thanks in advance,

              Shyam.

4 REPLIES 4

former_member209722
Participant
0 Kudos
55

Hi

You can raise a error message before save, if dont want to continue, it wont save data.

Thanks,

Chandra

Former Member
0 Kudos
55

Hi,

Yes, the material document number is generated well before this BADI is triggered. You can stop the transaction based on your conditions that you want to apply. If the conditions are not met, you can raise an error message.

As SAP standard exceptions are not present in this BADI, you should give an error message to stop the transaction.

MESSAGE E899(MM) WITH 'Message1'
                                          'Message2'
                                          'Message3'
                                          'Message4'.

Regards,

Danish

Former Member
0 Kudos
55

Hi Shyam,

I did the same for one of my requirement in MIGO and works by raising error as at last before save in updatetask it will check for if any error ,if it found any error message it won't update the material docuemtn number.

Thanks,

Deb

kesavadas_thekkillath
Active Contributor
0 Kudos
55

You have to use MB_MIGO_BADI. the methods CHECK_ITEM & CHECK_HEADER.

You can see the same code to be written in these methods in class CL_EXM_IM_MB_MIGO_BADI