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

Multiple call of update function module

Former Member
0 Likes
2,944

Hi Everybody,

I have made implementation to the definition MB_DOCUMENT_BADI( material Document creation).

While executing this BADI I am getting short dum with this error Multiple call of update function module.

Here is the short dump--

In the FORM routine Buchen_Ausfuehren (program SAPMM07M), an error

message was issued by a Business Add-In (BAdI) or function module.

This is not permitted, because it could lead to data

inconsistencies. For this reason, the update of the material

document was also terminated with a termination message (dump).

Note that this message (M7 372) is not the responsible error

message.

Please any body suggest the way forward.

Regards,

Sandeep.

16 REPLIES 16
Read only

LucianoBentiveg
Active Contributor
0 Likes
2,352

Are you using message statement in your implemetation?

Read only

0 Likes
2,352

Yes, I am using message implementation in method MB_DOCUMENT_BEFORE_UPDATE .

Is it causing any issue

Please suggest.

Regards,

Sandeep.

Read only

0 Likes
2,352

If you are using MB_DOCUMENT_UPDATE, this method is called in the update task, and MESSAGE sentence generate "Terminated Update".

Regards.

Read only

0 Likes
2,352

Hi Peluka,

I have solved the problem but here we have a new issue.

I have a question , Can we give a errror message in MB_DOCUMENT_BEFORE_UPDATE,if it is then is it impact any where to the sap standard code.

Please suggest your thought.

thanks

sandeep

Read only

0 Likes
2,352

Hey,

You can definitely issue error messages in the function MB_DOCUMENT_BEFORE_UPDATE. Doing so will not generate any short dump as this function is not called in the update task.

-Kiran

Read only

0 Likes
2,352

Hi Kiran,

Thanks for the reply.

I have created one implementation to the BADI MB_DOCUMENT_BADI. This badi will hit while creation of material document.I have write the code in method MB_DOCUMENT_BEFORE_UPDATE such that it will act only for certain movement types specially for t-codeMb1a and MB31.

What problem I am facing i have used a error message "MB_DOCUMENT_BEFORE_UPDATE" in this method.If we got the erroe message then we dont need to post the material dcoument,but here problem is that if the material document could not posted then it corrupt the material and when we performing 261/101 we got error message like " Inconsistency between MM and ML for material and plant"

I have used following things like-

1-while updating the customized table using " Commit Work".

2-Call function vb_change_batch for updating the batch and not in update task.

3. Dequeue the table after updating the table.

Will thos things can create any inconsistency to the MM and ML.

Please suggest me uor thoughts.

Thanks

sandeep.

Thanks ,

sandeep.

Read only

0 Likes
2,352

Hi Sandeep, one small Suggestion at this point, when your are performing any Database Updates(Commit or Rollback) always use AbEnd(A) Message type instead of error because message type A acts as Rollback command.

Thanks:-

Santosh.D

Read only

0 Likes
2,352

Hey,

Is there a COMMIT statement in your program before the error message is issued?

You should not be committing any data before the error message if you do not want the material document to be posted.

-Kiran

Read only

0 Likes
2,352

Hi Kiran,

I have used a Commit statement in method MB_DOCUMENT_BEFORE_UPDATE.

I have also used few things like-

1-Call function vb_change_batch for updating the batch and not in update task.

2- Dequeue the table after updating the table.

Will those things can create any inconsistency to the MM and ML.

Please suggest me uor thoughts.

Thanks & Regards,

sandeep

Read only

0 Likes
2,352

Boss,

Do not use COMMIT statements in the BADI, SAP will commit the data at the end of the transaction.

Commit statements might cause inconsistency.

-Kiran

Read only

0 Likes
2,352

One more question sir,

Can i use BAPI_TRANSACTION_COMMIT instead of Commit statement as I have to used after updating the batch using function module VB_CHANGE_BATCH.

and also cant use DEQUEUE function and it s must to update the function module in update task.

Thanks Kiran,

Regards,

Sandeep.

Read only

0 Likes
2,352

Nope... You shoudlnt be calling BAPI_TRANSACTION_COMMIT...

Whatever updates you are performing in the BADI will be committed by SAP. If you do not want to complete the processing if the BAPI to update batch fails then you should raise an abend message.

If the BAPI update is successful do not call the COMMIT bapi as these changes will be committed by SAP program's COMMIT WORK statement.

Why are you calling the ENQUEUE/DEQUEUE functions? What transaction are you trying to post?

-Kiran

*Please mark useful answers

Read only

0 Likes
2,352

I Have to update a ztable so that I have locked it before update and release it after update.

I am performinh some calculation to the batch before post the material document.

Once again can i use a Erroe message OR Abort message.

Thanks Kiran,

Regards,

sandeep

Read only

0 Likes
2,352

You can use ABORT message if the update in the custom table fails.

Ideally all the database updates must happen in the update task so that the either everything is committed or everything is rolled back.

Use the method which is called in update task.

Use the below code in your method for the same:

Update ZTABLE.

if sy-subrc ne 0.

message A000(msgid) with UPDATE FAILED

endif.

Call Batch Update BAPI

Read return table with key type = 'E'.

if sy-subrc eq 0.

message A000(msgid) with UPDATE FAILED

endif.

-Kiran

*Please reward useful answers

Read only

Former Member
0 Likes
2,352

Which method in the BADI are you using in the implementation? Is it MB_DOCUMENT_BEFORE_UPDATE OR

MB_DOCUMENT_UPDATE?

If you are using MB_DOCUMENT_UPDATE then note that this method is called in the update task and you should not use PERFORM ON COMMIT or COMMIT WORK statements in the method implementation.

Can you paste the code inside the method?

-Kiran

*Please reward useful answers

Read only

Former Member
0 Likes
2,352

Hi

I have the same issue. If anybody here know how to resolve please share your knowledge