on 2024 Sep 10 10:30 AM
hi
Hello everyone
I register a withdrawal
and receives into the variable every SALES ORDER according to the parameters I chose
Right now I want to go through all the results obtained from the fetch
and check whether the record is locked by a system user or not
How to write such a code in ABSL
I hope you can send me a serial code example!
I want to verify a lock on the SALES ORDER object
Request clarification before answering.
Hello,
Can you check if following works?
var currentDate = Context.GetCurrentGlobalDateTime();
var currentDate1 = currentDate.ConvertToLocalNormalisedDateTime();
var SalesOrders = SalesOrder.QueryByElements;
var SalesOrderDate_SelParams = SalesOrders.CreateSelectionParams();
SalesOrderDate_SelParams.Add(SalesOrders.Status.ItemListCustomerOrderLifeCycleStatusCode, "I", "EQ", "1");
SalesOrderDate_SelParams.Add(SalesOrders.Status.ItemListCustomerOrderLifeCycleStatusCode, "I", "EQ", "2");
var SalesOrderData_Results = SalesOrders.Execute(SalesOrderDate_SelParams);
var SalesOrderData_ResultsCopy = SalesOrders.Execute(SalesOrderDate_SelParams);
var ordersToRemove = new List<SalesOrderType>();
foreach (var SO in SalesOrderData_ResultsCopy)
{
var uuid = Library::UUID.ParseFromString(SO.UUID.content.ToString()); // sales order id
var messages;
var lock = BOAction.CheckLock("SalesOrder", "http://sap.com/xi/AP/CRM/Global", "Root", uuid);
messages = lock.MessageTypeItem;
var validationFailed = false; // Reset for each iteration
if (!lock.IsInitial() && messages.Count() > 0)
{
foreach (var message in messages)
{
if (message.MessageSeverityText == "E" && message.MessageID.content == "CL_CDA_DOCHD/000")
{
validationFailed = true;
ordersToRemove.Add(SO); // Mark for removal
lock.Clear();
break; // Break the inner loop since we already know this order is locked
}
}
messages.Clear();
}
}
// Remove all marked orders after the loop
foreach (var orderToRemove in ordersToRemove)
{
SalesOrderData_Results.Remove(ins => ins.ID.content == orderToRemove.ID.content);
}
Regards,
Harshal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
29 | |
9 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.