4 weeks ago
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
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.
HI
Thank you very much for wanting to help and donating your time
The option you suggested is not available to me
I can't register
salesOrder.IsLockedByUser()
I am attaching the code with which I thought to perform the test
Maybe this will give you a direction on how I can check if an adder is locked
The problem is in the code
that when it runs in a loop and checks whether an order is locked or not
After he found some locked order
It does not continue to recheck properly
but as if treating all other orders as if they were locked
For example if order number 150 is currently locked
So all orders after this number are also considered locked
below is my code :
------------------------------------------------
------------------------------------------------
I mean, actually my code is not completely correct and I probably don't check it in the right way
Anyone who can help me, I would be very happy
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.