cancel
Showing results for 
Search instead for 
Did you mean: 

Function module MB_CREATE_GOODS_MOVEMENT cannot be executed

shaji_chandran
Participant
0 Kudos

Hello Friends,

I am invoking following 2 BAPI's from MII one after another.

1) BAPI_GOODSMVT_CREATE

2) BAPI_REPMANCONF_CREATE_MTS

First BAPI is getting executed successfully and it creates the Mat document number as well. But while calling second BAPI I am getting an error as "Function module MB_CREATE_GOODS_MOVEMENT cannot be executed".

Can anyone help me on this? I think both BAPI should execute in same transaction session to complete the transaction successfully at SAP.

MII Version 15.1 SP5

Thanks

Shaji Chandran

Accepted Solutions (1)

Accepted Solutions (1)

former_member185280
Active Contributor

Check the function module documentation. I think BAPI_GOODSMVT_CREATE is one of those functions that has to have a commit immediately after being called and before any other functions are executed so make sure that is the case and you are doing that. REPMANCONF may have a similar restriction. Also I think BAPI_GOODSMVT_CREATE is async in the background so even tho you get a mat doc returned the stock change or whatever may be locked or not visible yet to the next function if you call it right away. If you can't get them to both work at all even if you call them separately or whatever then it may be something else entirely.

Regards,
Christian

shaji_chandran
Participant
0 Kudos

Thanks Christian. Your solution is working fine. I have one more question, Is there way to execute both these BAPI's under same session. I mean to say either I want both BAPI's gets executed successfully or none of them.

Thanks

Shaji

Answers (1)

Answers (1)

former_member185280
Active Contributor

Most of the time I have seen BAPI_GOODSMVT_GETDETAIL called in a loop until it gets a positive response for the mat doc before moving on to the next step. In terms of a rollback of the movement if the conf fails I think you would have to code the logic to do the reversal of the goods movement.

Typically for these kinds of situations I recommend moving things back into SAP by either creating a custom rfc to wrap the logic or enhancing a standard bapi if possible.