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: 

Release WBS element on Save of Sale Order

GauravKoundal
Explorer
0 Kudos

Dear All,

Can we release WBS element on Save of Sales order??

Requirement:- Need to release WBS at the time of Saving the sales order. I am not able to find out exit where we can right a code for the release of WBS.

I tried MV45AFZZ - USEREXIT_SAVE_DOCUMENT_PREPARE but during this time XVBAP-PS_PSP_PNR is  initial.

Please guide.

Thanks,

Gaurav

6 REPLIES 6

Former Member
0 Kudos

Well, you were at the right place. In case you are unable to find the value in the field you mentioned, put a watch point and see if it is ever populated in that field in first place.

In case it isn't, you will have to look for other fields.

0 Kudos

Yes, I found the WBS but now it is not updating the WBS status. I am calling Z FM in Update task as I need to call this FM after sales order save event.

Inside Z FM I am calling below functional modules for updating the WBS status.

BAPI_PS_INITIALIZATION

BAPI_BUS2054_GET_STATUS

BAPI_BUS2054_SET_STATUS

BAPI_PS_PRECOMMIT

Not sure What I am missing  in it. is there any other way to update the WBS status.( any other FM )

0 Kudos

You also need to call

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       IMPORTING
         return = wa_return.

But since you are writing this code in an exit it might not work (can give dump).

Hence, add


IN UPDATE TASK

while calling your ZFM.

0 Kudos

Yes I am calling the FM in Update Task as already mentioned above in my comment.

0 Kudos

Well you could try two solutions

  • Call the BAPI directly in the transaction, so the COMMIT of the transaction will commit those too.
  • Convert your update FM in a RFC enabled FM and call it in BACKGROUND TASK so it will be executed after the end of update tasks triggered by the transaction.

Regards,

Raymond

0 Kudos

Are you also calling BAPI_TRANSACTION_COMMIT? Because it works in my case.