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: 

Call BAPI_GOODSMVT_CREATE several times without COMMIT Issue

adrian_mejido
Contributor
0 Kudos

Hi,

I have a requirement which is to create many Goodsmovements for the same material :First 101 and then 343. If 101 fails, then 343 shoundn't be created. If 101 works fine and 343 is wrong, then 101 shouldn't be created.

For that I call BAPI_GOODSMVT_CREATE at first time to create 101, but without doing a COMMIT. After that and if 101 doesn't have any error, I would have to call BAPI_GOODSMVT_CREATE for 343 movement, but at that time I am getting an error because I don't be allowed to do a second bapi call without doing COMMIT work.

How I could achieve that?

Thanks for your time and best Regards

1 ACCEPTED SOLUTION

NTeunckens
Active Contributor

I haven't done anything like this and it feels somewhat strange to me, but you could possibly 'predict' the results using the "TESTRUN"-Parameter? Test the BAPI using your GDSMVT and only proceed to 'real' Execution when you are quite sure what will work ...

Also there are some hints in the "Goods Movement via BAPI"-Wiki (link) and SAP-KBA's 520813 "FAQ on Good Movement BAPI" (link) ...

7 REPLIES 7

NTeunckens
Active Contributor

I haven't done anything like this and it feels somewhat strange to me, but you could possibly 'predict' the results using the "TESTRUN"-Parameter? Test the BAPI using your GDSMVT and only proceed to 'real' Execution when you are quite sure what will work ...

Also there are some hints in the "Goods Movement via BAPI"-Wiki (link) and SAP-KBA's 520813 "FAQ on Good Movement BAPI" (link) ...

0 Kudos

Thanks for your reply Nic.

In fact, that solution was the one’s I had taken into account to achieve my requirement if there wasn’t any chance to do that without TEST.

Best regards.

Hi Adrian,

As stated in the BAPI Documentation, you can use Parameter TESTRUN .

"You can use a simulation function before posting the goods movement to check how the data is updated in the database."


Regards

Himanshu

I though as much, however I wanted to raise this as the first / best option.

I don't know if you can get the multiple BAPI-Calls to work in sequence by calling them in a different LUW using DESTINATION 'NONE'? Even if that would work, it still seems like a 'hacked solution' so I wouldn't be in favour of that ...

The BAPI uses FM "MB_CREATE_GOODS_MOVEMENT" internally : if you are allowed to use anything other than a BAPI you might try that FM directly (as a last resort)?

Personally, I would use the 'TEST' and if that doesn't work out, stick to Posting with COMMIT and possibly Retracting the GoodsMovements when necessary ...

adrian_mejido
Contributor
0 Kudos

Thanks Roberto, but I already know how bapi’s work. My question is other.

Best regards.

adrian_mejido
Contributor
0 Kudos

I have achieved that calling the bapi in TESTRUN first and if all is right, then I call with COMMIT.

Best Regards

0 Kudos

Great, please close the Question, marking it as Answered ...