cancel
Showing results for 
Search instead for 
Did you mean: 

Checking if object is locked or not in SAP C4C SDK

Gayatri_Bagde
Active Participant
1,399

Hello Experts,

We have a scenario where we are updating data in Ticket Object from Activity using ABSL. But if the user is editing the ticket, then update to such ticket fails. We need to check if the ticket is being locked by any other user and if yes we will be showing an error message in activity from SDK. But I was not find any such method. By any chance, can we check if the object is being locked by user using ABSL?

Thanks in Advance,

Gayatri

View Entire Topic
jravnik
Participant

Hi Gayatri,

you may try the following code snippet.

import ABSL;
import AP.PlatinumEngineering;

//...

var locked = false;
var checkLock = BOAction.CheckLock("ServiceRequest", "http://sap.com/xi/AP/CRM/Global", "Root", ticket.UUID.content);

if (checkLock.MessageTypeItem.Count() > 0) {
	foreach (var item in checkLock.MessageTypeItem) {
		if (item.MessageSeverityText == "E" && item.MessageID.content == "AP_ESI_COMMON/101") {
			locked = true;
			break;
		}
	}
}

if (locked) {
	//...
}

I did use something like this a few months ago, so I am unsure if it still works, but feel free to experiment with it. Also keep in mind that the PlatinumEngineering libraries are not offically supported by SAP in case it does not work (now or in the future).

Best regards
Jürgen

0 Kudos

Nice question, nice answer. Thank both of you.

itaKraus
Explorer
0 Kudos
hi