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: 

Change Notification Data when saving a maintenance order - Notification is locked

0 Kudos
1,427

Hello,

I am trying to edit two fields in notification header data when I save the associated maintenance order.

For that I'm using user-exit EXIT_SAPLCOIH_009. I am doing some checks in this user-exit and if all is true, I call a Z function in UPDATE TASK that calls FM: BAPI_ALM_NOTIF_DATA_MODIFY and BAPI_ALM_NOTIF_SAVE.

The problem here is that I always get the error message from the first BAPI IM 416 - Notification x locked by user (that's me).

I've tried BADI WORKORDER_UPDATE but the problem remain and already set an WAIT UP TO 2 SECONDS in the top of the update task function.

Can anyone help? Thanks

1 ACCEPTED SOLUTION

DominikTylczyn
SAP Champion
SAP Champion
988

Hello carlos91moreira

I'd suggest to call the notification update in a separate logical unit of work (LUW) using:

CALL FUNCTION func IN BACKGROUND TASK AS SEPARATE UNIT

That's basically the same approach that I'v suggested here: https://answers.sap.com/questions/13768145/what-is-badiexit-to-enhance-cj20n-after-click-save.html?c...

You'd need to create a custom RFC-enabled function module. The function should call both BAPI_ALM_NOTIF_DATA_MODIFY and BAPI_ALM_NOTIF_SAVE to update the notification. Make sure to test the RFC function first, to make sure the notification is updated correctly. Then integrated a call with "IN BACKGROUND TASK AS SEPARATE UNIT" in the BAdI implementation.

Best regards

Dominik Tylczynski

4 REPLIES 4

DominikTylczyn
SAP Champion
SAP Champion
989

Hello carlos91moreira

I'd suggest to call the notification update in a separate logical unit of work (LUW) using:

CALL FUNCTION func IN BACKGROUND TASK AS SEPARATE UNIT

That's basically the same approach that I'v suggested here: https://answers.sap.com/questions/13768145/what-is-badiexit-to-enhance-cj20n-after-click-save.html?c...

You'd need to create a custom RFC-enabled function module. The function should call both BAPI_ALM_NOTIF_DATA_MODIFY and BAPI_ALM_NOTIF_SAVE to update the notification. Make sure to test the RFC function first, to make sure the notification is updated correctly. Then integrated a call with "IN BACKGROUND TASK AS SEPARATE UNIT" in the BAdI implementation.

Best regards

Dominik Tylczynski

988

Thanks a lot for your help.

That didn't solve my issue but maybe it was me who missed some step after the function call.

I solved the issue with a batch program. This was not the way I wanted to solve it but the deadline is very close.

Thanks again for your help.

0 Kudos
988

carlos91moreira Probably my explanation was too brief. I've updated the answer. See if that helps you.

988

Hello, I did all of that the first time but didn't work. Tried again and it worked. It was very late, probably did something wrong that I didn't double check. Anyway, just to thank you once again. That solution worked.