cancel
Showing results for 
Search instead for 
Did you mean: 

.Delete() Account Item in Route BO

cabraldaniel
Explorer

Hi All!

We're trying to do a mass exclusion in Route Standard BO in SDK using ABSL according to a certain business rule:

import ABSL; 

var selectedDate = this.RemainingVisitsDate;

if (!selectedDate.IsInitial())
{ 
this.Account.Remove(acc => acc.VisitDate != selectedDate);
} else { 
raise Message_RemainingDate_Not_Set.Create("E");
}

The this.Account.Remove() doesn't work, even without any filter (should delete all items), what we're doing wrong?

Thanks in Advance!

Accepted Solutions (0)

Answers (2)

Answers (2)

cabraldaniel
Explorer
0 Kudos

Hi Saurabh!

Thanks for the answer! We tried the Delete() method, but he item doesn't have it (it was our first option actually). We haven't found an alternative until now.

in that case, the protocode tried was:

foreach (var acc in this.Account) {
  if (acc.VisitCode != selectedDate){
     acc.Delete() ---> doesnt have this method :(
  }
}
cabraldaniel
Explorer
0 Kudos

I've taken note on "Attendee" party you mentioned - I've checked it and haven't found the relationship we need. The only one who makes sense was the "Account", based on the item columns (see screenshot on first post)

Any help is very appreciated.

Thanks again!

former_member226
Employee
Employee

Hmmm... I see that it could be because "Account" association is marked with "Public Write Access: No" whereas "AttendeeParty" is marked with "Public Write Access: Yes". And that is why you donot see "Delete()" option for account association but same is available for "AttendeeParty" association.

cabraldaniel
Explorer

I see...we're trying another approach (filter the added Visits instead of deleting the unwanted ones in this context).

Anyway, thank you for helping us!

former_member226
Employee
Employee
0 Kudos

Hello,

"Remove" should only be used when you want to "remove" an instance from iterating/runtime collection which will in result generate a new collection. It has no persistence in the database.

Hence If you want to delete the instance of "Attendee" party then you have to use "Delete" method and then you should be able to remove the instance completely.

For more details pls check:

https://help.sap.com/viewer/cbcebe3cfb1647a8b0322c18dbb0b481/LATEST/en-US/754d2c4973e210148d6cb53283...

https://help.sap.com/viewer/cbcebe3cfb1647a8b0322c18dbb0b481/LATEST/en-US/7297b28173e21014a093b528b5...