Skip to Content
0

Unable to change User Status in VA02 because of BAPI in MV45AFZZ

Apr 06, 2017 at 01:44 PM

149

avatar image

Hi All,

Scenario: We want to place a delivery block (Awaiting Inspection) on deliveries when the sales order is set to a certain user status (QA To View). We need to stop certain deliveries from being sent until an additional QA inspection is carried out.

I've created an include in MV45AFZZ-USEREXIT_SAVE_DOCUMENT that places a delivery block using BAPI_OUTB_DELIVERY_CHANGE when the sales document is saved. I've tested this and it works just fine on its own.

The issue has appeared when attempting to invoke this code based on the user status being changed (e.g. Created > QA To View) in VA02:

When I change the status, and select save, VA02 reports that the document has been successfully saved and exits to the selection screen. When I go back into the order header afterwards, the status has not changed and it still displays as Created.

I can change the status to any of the other 3 above and it works fine. The issue only occurs when BAPI_OUTB_DELIVERY_CHANGE is run, as the status change works when I comment it out of my include code.

My code below: All I'm doing before this part is checking the document type, and ensuring the user status isn't already QA To View:

Has anybody come across a similar issue, or can suggest a fix?

Cheers,

Sam

10 |10000 characters needed characters left characters exceeded

Hi All,

I've managed to 'fix' the issue by just calling FM STATUS_CHANGE_EXTERN after my BAPI call.

This ensures that the status changes to QAVW as expected, however it doesn't necessarily answer the question as to why the BAPI affects the standard functionality - so I'll leave this unanswered for a while longer.

Cheers,

Sam

1
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Mahendra Morra Reddy Apr 06, 2017 at 02:03 PM
2

Hi Sam,

Issue is with commit statement 'BAPI_TRANSACTION_COMMIT' inside User exit.

I would suggest to call BAPI function for Delivery change 'IN UPDATE TASK' and update results.

Thanks

Mahendra

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Mehandra,

Sadly I do not think this will be a suitable fix:

Thanks,

Sam

0
Mahendra Morra Reddy Apr 06, 2017 at 08:55 PM
1

Hi Sam,

Can you please try with calling only BAPI for changing OB delivery in regular way. Without addition Update task.

FM 'BAPI_TRANSACTION_COMMIT' should be commented or not called. SAP standard commit would take care of posting of OB delivery changes.

Regards

Mahendra

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Mahendra,

Thanks for your input, but it's still not taking effect! Current code:

0

Hi Sam,

Are you getting the errors in lt_bapi_ret[ ] ??

0