Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3273

Re: How to delete and instance of a custom BO from a standar BO

$
0
0

Hi Ivan,

 

Deleting an instance is just same as using other BO Action of an instance.

SAP provides Delete and Create as standard BO Action, so you don't have to create yourself.

 

Just Retrieve or query the instance and call the Delete() method.

 

1. Using Retrieve() // only work if the BO has alternative key

     var instance=CustomBO.Retrieve(varAlternativeKey);

     if(instance.IsSet()){

          instance.Delete();

     }

 

2. Using QueryByElements

     var query=CustomeBO.QueryByElements;

     var selParams =query.CreateSelParams();

          selParams.Add(query.CustomID,"I","EQ","123");    

     var results=query.Execute(selParams);

       foreach(var result in results){

        result.Delete();

       }

 

 

Note: For creation or deletion of an instance, you need to perform a Save operation to make the codes actually delete or create the instance in the database.

 

Best Regards,

Fred


Viewing all articles
Browse latest Browse all 3273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>