Skip to Content

Checking if object is locked or not in SAP C4C SDK

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jun 25, 2020 at 09:56 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 25, 2020 at 07:41 AM

    Hi,

    AFAIK, C4C currently do not expose any standard Library or method to check the locking behaviour/status of the business object. It is also one of the highly sought features which should have already been at influence forum. Please check and vote for it.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.