Application Development and Automation 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: 
Read only

BADI Implementation is not getting triggered

Former Member
0 Likes
5,699

Hi,

I have created Z implementation for BADI --> MB_DOCUMENT_BADI

My implementation name is Z_ORDER_STATUS_UPDT

Now i am facing problem in which my BADI implementation is not getting triggered

Please note ...I have ensured these things before testing

1. Putting break point on CL_EXITHANDLER , I have checked BADI name after pressing 'SAVE' on transaction MIGO ...BADI name that i got is MB_DOCUMENT_BADI

2. Then i have created implementation for that BADI.

3. Activated both code and Implementation.

4. I have put the break point in my code

but still my BADI is not getting triggered

When i searched from SE15, i got these active implementation's for MB_DOCUMENT_BADI

/BEV2/ED_MM_DOC_UPD

/ISDFPS/MB_DOC_UPD_1

/SAPTRX/MM_MATDOC

CIN_MB_57FC_SAVE

CIN_MB_CREATE_PART1

FRE_MB_DOCUMENT_BADI

Z_ORDER_STATUS_UPDT

ZPUR_DOCUMENT_BADI

In all above implementation only 'Multiple Use' option is checked

Please help me in above scenario

Edited by: Amol Deshpande on May 30, 2009 7:54 PM

10 REPLIES 10
Read only

Firoz_Ashraf
Contributor
0 Likes
3,290

Hi,

Try to write the following code in method "MB_DOCUMENT_BEFORE_UPDATE" of your implementation.

message s001(ZABC) with 'Test BADI'.

Put a breakpoint at this mssage statement and check if you come to this breakpoint when executing MIGO.

Regards,

Firoz.

Read only

Former Member
0 Likes
3,290

hai amol did u activated the project u have implemetned, there is a button for a activatign the implemtnign project check once

m.a

Read only

Former Member
0 Likes
3,290

Hi Amol,

Multiple use BADI can activate more than one implementation. There is no sequence control for the multiple active implementation. Hence the logic put in should not have dependency on the

execution sequence.

First please check whether the BADI is activated or not.

If activated, then check whether you have checked the field Multiple use while creating the BADI.

Hope this will help.

Regards,

Manish

Edited by: Manish Bisht on Jun 1, 2009 7:25 AM

Edited by: Manish Bisht on Jun 1, 2009 7:26 AM

Read only

0 Likes
3,290

HI Manish,

Before testing I have ensured that my BADI implementation is activated.

Now working on same issue i got some information. (Please correct me if i am wrong)

1. method 'MB_DOCUMENT_UPDATE' in my implementation belongs to Update task

and though we put break point, it will never go to that statement. (because of Update Task)]

2. According to Firoj, I have put break point in method 'MB_DOCUMENT_BEFORE_UPDATE'

Now program is halting at break point.

3. To check whether my method is getting triggered or not, I have inserted Message staement with type 'A' (Abandon) and then after executing SM13 i got to know that my method is getting called.

But now some more problem has occurred.

(P. S. -- Actually my requirement is, i want to update user status for Process Order from 'ZREL' to ZISU' when any goods issue done against process order)

In method 'MB_DOCUMENT_UPDATE' i am using one BAPI that is 'BAPI_PROCORD_SETUSERSTATUS'

to update User Status for Process order.

But when i am going to create goods issue against process order then its giving me error "Update was terminated" . I have also checked ST22. there i am getting message " Invalid COMMIT WORK in an update function module"

I am not witting any explicit commit statement there. but BAPI itself is triggering COMMIT.

I am writing that code under method 'MB_DOCUMENT_UPDATE' because i want to updated status only after creation of material document.

Please suggest any solution to above.

thanks...

Read only

0 Likes
3,290

Hi Amol,

Below are responses to your questions.

1. method 'MB_DOCUMENT_UPDATE' in my implementation belongs to Update task - You can put breakpoint at the starting of the method or Set External breakpoint inside the method, it will stop at the break-point.

2. "Update was terminated" - Avoid including statements or call function modules that carry out a database commit inside the BADI. because if the BADI is called between updation of database, your FM that causes a database commit will interfere in the processing and will tries commit unfinished jobs in the database. Thats why you are getting the Dump.

Hope, this will solve your queries.

Regards,

Manish

Read only

0 Likes
3,290

Hi Manish,

thanks, I have gone through your reply.

Still some queries.

1. How to set External Break point in BADI method (expecting path).

2. I am not getting any proper space to insert BAPI i.e. 'BAPI_PROCORD_SETUSERSTATUS'

that BAPI should be called only after successful creation of Good issue from tcode MIGO

Please find more info about my requirement.

In transaction COR2 user can able to maintain User Status manually. Now if that status is 'ZREL' then he can allow to do goods issue from MIGO. As soon as user has made goods issue against process order user status for that process should change from 'ZREL' to 'ZISU'

So where i have to put that BADI ? or any other solution ?

Read only

0 Likes
3,290

Hi Amol,

1. Can you check whether there is any exit that triggers after the successful creation of Good. Put a breakpoint on the exits and check whether they triggers after the creation.

There are many exits for MIGO, you can check which one is applicable in your case

MB_CF001 Customer Function Exit in the Case of Updating a Mat. Doc.

MBCF0002 Customer function exit: Segment text in material doc. item

MBCF0005 Material document item for goods receipt/issue slip

MBCF0006 Customer function for WBS element

MBCF0007 Customer function exit: Updating a reservation

MBCF0009 Filling the storage location field

MBCF0010 Customer exit: Create reservation BAPI_RESERVATION_CREATE1

MBCF0011 Read from RESB and RKPF for print list in MB26

OR

2. if you want to change the status after the successful creation of Good issue from tcode MIGO. You can create a task and link it with the event that was created whenever a Good is issued from MIGO. In this task you can update the status of the process.

Hope you got your answer. If not, please let me know.

Regards,

Manish

Read only

0 Likes
3,290

Hi Manish,

I have solved the issue.

Solution: I have inserted all my code under method 'MB_DOCUMENT_BEFORE_UPDATE' (which is being called before Update task) instead of 'MB_DOCUMENT_UPDATE'

Now everything is working fine.

But while testing i got one unexpected behavior.

When i am doing goods issue from MIGO against Process order. for first time my BAPI -> 'BAPI_PROCORD_SETUSERSTATUS' is not updating JEST table (to change status for process order)

but when i am doing it for second time it is updating the status in JEST

I have checked documentation for BAPI_PROCORD_SETUSERSTATUS

and it says, that this BAPI itself giving call to COMMIT work so don't call BAPI_TRANSACTION_COMMIT explicitly.

Is it related to Database commit ?

I am not getting any clue.

thanks in advance

Read only

0 Likes
3,290

Hi Amol,

Usually we Call FM 'BAPI_TRANSACTION_COMMIT' after calling the any BAPI otherwise it does not saves the data in database. But if the documentation says that this BAPI itself giving call to COMMIT work so don't call BAPI_TRANSACTION_COMMIT explicitly, dont use the FM 'BAPI_TRANSACTION_COMMIT'.

Or you can try using both, with or without BAPI_TRANSACTION_COMMIT, whichever helps. : )

Hope this helps.

Regards,

Manish

Read only

Former Member
0 Likes
3,290

Closing this thread because partially i was succeeded in getting solution...but still facing unexpected behavior (refer to mine last replies) while updating User status in table JEST